ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Colour coding in RViz

asked 2021-03-11 01:52:38 -0500

Py gravatar image

Is it possible to place some kind of 2D rectangular shape in RViz that is colour coded according to some data value subscribed to and positioned wherever the robot is at the time the data was read?

If so, how might I go about implementing this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-03-11 10:57:35 -0500

Rviz is only a data visualizer. As such, you cannot "place" a shape in rviz, but if the shape is being published somewhere, you can subscribe to it and visualize it! There are two easy ways to go about your problem:
1. Work with gazebo and place an object wherever you want. You can then visualize in either a camera pointed towards it or using some lidar scan.
2. Generate markers in code and publish them. This tutorial will show you how to. I'd recommend this method since it sounds like you want it based on the robot position and you can just keep changing the marker pose in code.

edit flag offensive delete link more


That's great thanks! I've been able to publish some markers and visualise them in RViz. My next challenge is to to colour code them according to the sensor value like a heatmap. Any idea how I'd go about this?

Py gravatar image Py  ( 2021-03-15 14:24:08 -0500 )edit

I believe the markers have a RGB field? You can read your sensor data and using whatever algorithm/idea you have in mind and apply individual markers with relevant RGB values.

Akhil Kurup gravatar image Akhil Kurup  ( 2021-03-15 14:28:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-03-11 01:52:38 -0500

Seen: 208 times

Last updated: Mar 11 '21