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

How to create multi colored visual marker for Rviz?

asked 2019-07-15 14:01:32 -0500

Junskter gravatar image

updated 2019-07-15 14:17:46 -0500

I wish to create a multicolored visualization of a car in Rviz. I am using a Collada (.dae) file with the car's 3D mesh.

I followed the steps here: http://wiki.ros.org/rviz/DisplayTypes....

The shape gets correctly visualized but the colors are ignored and the car is shown in grey. I can add a single color by setting the color parameter of visualization_msgs::Marker in the ros node, but doing so adds the same color to all parts of the car.

Thank you in advance for any suggestion :D

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-07-21 23:55:27 -0500

Junskter gravatar image

updated 2019-07-21 23:55:46 -0500

I think there is an issue with Rviz because of which colors in the Collada (.dae) mesh file are ignored. Here's what I did to solve the problem:

1) For each part of the 3D object, I added a different texture from image. Eg. for a red part, I used plain red colored image and added that as a texture to the object. I used Blender software for this.

2) Added these lines to the node that published the visualization marker:

  marker.mesh_resource = "package://rl_car/visual_models/car/car.dae";
  marker.mesh_use_embedded_materials = true;

It takes a few seconds for the marker to be visualized for the first time when I start Rviz, maybe because Rviz needs the time to load the textures. After that the marker position gets updated in real time. I hope it's helpful for you.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2019-07-15 14:01:32 -0500

Seen: 524 times

Last updated: Jul 21 '19