ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

how to publish pitch, roll, yaw to robot_pose_ekf

asked 2013-08-04 12:35:26 -0600

dan gravatar image

updated 2013-08-04 13:27:56 -0600

I have accurate pitch, roll, and yaw values from an IMU, computed on an arduino. I have good serial comm and am already sending odometry data from the encoders and publishing that on /odom. I know that robot_pose_ekf can take in imu_data through sensor_msgs/imu but cannot figure out how to fill in the pitch, roll, yaw data into:

geometry_msgs/Quaternion orientation

float64[9] orientation_covariance

// Row major about x, y, z axes.

Also, do I need to supply values for angular velocity and linear acceleration? I see that those are part of sensor_msgs/imu, but don't want to send serial data at the rate required to accurately keep up with these velocities and it seems that /odom is doing fine with translation.

geometry_msgs/Vector3 angular_velocity

float64[9] angular_velocity_covariance

//Row major about x, y, z axes


linear_acceleration float64[9] linear_acceleration_covariance

Row major x, y z

I have gone through the nav tutorials, looked (a lot) at turtlebot code, but just cannot decipher the details of computing the quaternion and properly filling in the covariances.

I did use this in /odom for yaw:

//since all odometry is 6DOF we'll need a quaternion created from yaw
geometry_msgs::Quaternion> odom_quat => tf::createQuaternionMsgFromYaw(th);

but how do you do that for pitch, roll, and yaw in the context of /imu?

Ultimately, I hope to figure out how to publish TwistWithCovariance and PoseWithCovariance, but for now I'll settle for just getting the imu data to robot_pose_ekf.

Thanks for the help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-05 05:24:58 -0600

jep31 gravatar image

sensor_msgs/Imu use Quaternion, so you have to converter your euler angle to a quaternion angle.

 tf::Quaternion q = tf::createQuaternionFromRPY( roll ,pitch , yaw );

I'm not sure if you have to fill in too velocity and acceleration. I don't think so but if you have it, it's better to supply it.

Covariance is only a float64[9] so you can fill in like a array. You should estimate your accuracy on each axes (roll pitch and yaw) with your sensor. The diagonal terms are the square of your accuracy. Other terms are useful if variables are dependent, if not you can put zero values.

edit flag offensive delete link more


So, I should set orientation = tf::createQuaternionFromRPY( roll ,pitch , yaw ); and enter the variance of each of those into the 3 diagonals of orientation_covariance, with the other entries = 0. Is that right? Finally, do I publish this on /imu or on /imu/data or on /imu/data_raw?

dan gravatar image dan  ( 2013-08-05 09:40:18 -0600 )edit

Yes you're right. You should publish on /imu_data or you can remap this topic to an other name.

jep31 gravatar image jep31  ( 2013-08-05 23:00:29 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-08-04 12:35:26 -0600

Seen: 2,442 times

Last updated: Aug 05 '13