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

Revision history [back]

There's a good tutorial on Markers on the ros.org wiki; make sure to go through that first.

Some things to watch out for in general (otherwise the markers won't be displayed):

  • set the alpha value (marker.color.a) to something non-zero
  • you have to specify a valid quaternion as orientation (e.g., marker.pose.orientation.w = 1.0)

Some more specific answers to your question:

  • You need to convert the spherical coordinates into a geometry_msgs/PoseStamped, and put that into marker.pose.
  • You can either publish each marker in an individual message and publish them on some topic of type visualization_msgs/Marker, or put several of them into a MarkerArray and publish them on a topic of type visualization_msgs/MarkerArray. The latter is more efficient than the former, but for your use case either should work.
  • Constantly updating the position of each satellite works like this: You set the namespace of all markers to the same namespace (e.g., marker.ns = "satellites"), and give each satellite a unique id (e.g., marker.id = 23). Whenever you want to update the pose of a marker, just publish another Marker message with the same id (it will overwrite the previous one). Even if nothing changes, you should re-publish all existing markers regularly.

In order to add text/name to a marker in RViz, just add a second marker of type TEXT_VIEW_FACING and fill out the text property.