How to show robot tipping over in Rviz
I've created a URDF model of my robot, linked it to Tf and configured Rviz to show my robot and show joint rotations in realtime when the actual robot moves.
My robot also has an IMU that can measure the yaw, pitch and roll. If I tip over my robot, I want this to be reflected in Rviz. How do you accomplish this? The joints are automatically updated based on the URDF and associated JointState messages, but there's no joint between the robot and the ground. How do I make Rviz tilt the model proportional the angles shown in my IMU messages and/or moving around as the IMU and odometry change?
Asked by Cerin on 2016-10-18 13:41:46 UTC
Answers
The simplest first step is to have a node that subscribes to odometry and imu data and broadcasts the map to base_link transform (or you could have a map-to-odom broadcaster in one node handling odometry and a odom-to-base_link in another that handles the imu).
Take a look at http://wiki.ros.org/tf2/Tutorials/Writing%20a%20tf2%20broadcaster%20(Python), the python example is a good starting point (instead of zeroing the roll and pitch you would insert your imu roll and pitch).
There is going to be disagreement between your imu yaw and your odometry yaw, you could take one or the other, but the next step is to replace a simple broadcaster with robot_localization
http://docs.ros.org/kinetic/api/robot_localization/html/index.html
Asked by lucasw on 2016-10-18 15:26:13 UTC
Comments
Don't forget to set the fixed frame in rviz to the map
or odom
frame and the target frame to base_link
(or whichever names are being broadcast to tf).
Asked by Thomas D on 2016-10-18 16:08:51 UTC
Comments