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

Using Makers Array in rviz

asked 2013-08-15 03:46:45 -0500

micheal gravatar image

For my laboratory project, I have to use markers arrays in rviz to show the movement of satellites around the globe. The parameters of satellites are changing constantly. I have to represent every satellite in spherical coordinates for 3D movement. I have successfully been able to publish all the 3 parameters of every satellite on a topic "menutopic". Now I do not know how can I represent the satellites as markers array in rviz with constantly changing parameters.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2013-08-19 01:14:38 -0500

There's a good tutorial on Markers on the 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., = 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.

edit flag offensive delete link more


TEXT_VIEW_FACING does not display the text

Kansai gravatar image Kansai  ( 2021-01-25 02:34:38 -0500 )edit

Question Tools

1 follower


Asked: 2013-08-15 03:46:45 -0500

Seen: 5,272 times

Last updated: Aug 19 '13