ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The magnetic field information is fundamentally a 3D vector, with the direction and strength of the field. You could use an Arrow Marker message to represent this information. If you set the start of the arrow to your robot body and scale the length suitably so it's visible this should work.
Unless you're near the equator this vector will be pointing up or down a fair bit since the Earth's magnetic field isn't parallel to the surface of the earth. So if you're just interested in the direction of magnetic north you could zero out the z element of the magnetic field vector and normalize the length of the vector to 1.
You'd need to make a small node to subscribe to sensor_msgs/MagneticField messages and publish an equivalent visualization_msgs/Marker to do this.
Hope this helps.