ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Converting vector to orientation in sensor_msgs/Imu

asked 2020-04-18 12:11:14 -0600

JimmyTheFace gravatar image

I'm using the Lego Control+ Technic Hub as an IMU using the node-poweredup library. I am getting the imu data from the hub into ROS just fine but I am having trouble knowing how to correctly publish the orientation data in the sensor_msgs/imu message.

The data I'm getting from the hub is:

  • Gyro: This is coming from the hub as [x, y, z] in degrees per second. I am converting this to radians per second and publishing it on the angular_velocity property of the imu message.
  • Accel: This is the linear acceleration coming from the hub as [x, y, z] in milli-Gs. I am converting this to m/s^2 and publishing it on the linear_velocity property of the imu message.
  • Tilt: This is coming from the hub as [x, y, z] where each value is in (-180, 180]. This is the one I'm not sure how to use. It seems like this is the orientation of the hub but the sensor_msgs/imu message expects a quaternion for the orientation.

If I convert the 'tilt' vector to a quaternion via this method would that work? My understanding of quaternions isn't very strong, but I think it represents a rotation from another position. Is there some information not represented in that vector that would be necessary to accurately track the robot?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-04-18 17:35:34 -0600

It sounds like “tilt” is an orientation, which is what a quaternion represents (actually represents with fewer numerical instability to euler angles, which is sounds like what you have).

Converting to a quaternion will represent everything you need.

edit flag offensive delete link more

Comments

Thanks. Yeah, that worked. I just used the algorithm on the wikipedia page to change it to a quaternion and it seems to be working fine.

JimmyTheFace gravatar image JimmyTheFace  ( 2020-04-18 21:07:17 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2020-04-18 12:11:14 -0600

Seen: 483 times

Last updated: Apr 18 '20