ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
if you want to use only yaw , first you have to convert quarternian to eurl angle and then convert yaw in quarternian then publish msg . you can use something like this code:
float yaw;
tf::Quaternion robot_imu;
robot_imu.setX(msg->orientation.x);
robot_imu.setY(msg->orientation.y);
robot_imu.setZ(msg->orientation.z);
robot_imu.setW(msg->orientation.w);
yaw_ = tf::getYaw(robot_imu);
tf::Quaternion yaw(tf::createQuaternionFromYaw(yaw));
you can't simply set x and y to zero.
2 | No.2 Revision |
if you want to use only yaw , first you have to convert quarternian to eurl angle and then convert yaw in quarternian then publish msg . you can use something like this code:
float yaw;
tf::Quaternion robot_imu;
robot_imu.setX(msg->orientation.x);
robot_imu.setY(msg->orientation.y);
robot_imu.setZ(msg->orientation.z);
robot_imu.setW(msg->orientation.w);
yaw_ = tf::getYaw(robot_imu);
tf::Quaternion yaw(tf::createQuaternionFromYaw(yaw));
yaw(tf::createQuaternionFromYaw(yaw_));
you can't simply set x and y to zero.