0
$\begingroup$

Rosanswers logo

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?


Originally posted by JimmyTheFace on ROS Answers with karma: 3 on 2020-04-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by stevemacenski with karma: 8272 on 2020-04-18

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by JimmyTheFace on 2020-04-18:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.