Visualize multirobot in rviz2

Hello,
I managed my code to visualize multi robot in gazebo. At the moment I visualize only one robot with the namespace robot1/cmd_vel…/pointcloud etc. In gazebo all goes well. I have problem in Rviz2 because I am not able to visualize the robot, laser, etc.
Somene can help me with suggentions or tutorials.
Thanks
Salvatore

Hi @saxosun,

On the left hand side in Rviz you will find add button. Click Add then find and select RobotModel.

Hello @nisrindhoondia,
Thanks for your reply, I did.
I verify from the terminal that the topic robot1/laser_scan works, but If I try to subscribe to this topic via Rviz2 I receive this message: Showing [0] points from [0] messages. In any case I did not receive error messages.

Hi @saxosun ,

I think I exactly know what the problem is.

You are using the namespace robot1 but the frame_id in the LaserScan message is probably set to base_link or any frame without the namespace in the urdf/xacro file.

Try to echo the laser scan messages from /robot1/laser_scan and you wil probably notice that the frame_id: base_link line, without the namespace. So technically it should show frame_id: robot1/base_link.

This should be fixed in your urdf/xacro file. Where you have the lidar plugin defined, in that place you will have a tag called frame_name. Set that to “$namespace/base_link” and it should work.

Also, don’t forget to set the TF prefix in RViz for your RobotModel display element to /robot1.

Let me know if your problem is fixed. I am assuming that you are working on an multi-robot environment. I am inferring this from your robot namespace robot1. I am assuming that you will add more robots robot2, robot3… etc.

Regards,
Girish

Hello @girishkumar.kannan,
yesterday I solved the issue. I used the same solution you are suggesting me. Thank you very mush for your reply.

Hi @saxosun ,

Glad that I was able to help you point to the right issue!

Please mark this issue as solved so this issue can be closed, unless you still want to have this thread open for any reason.

Regards.
Girish

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.