View real time path

I am using Carla 0.9.11 and Ros-bridge I am running a simulation with two vehicles. One vehicle is manually controlled and the second vehicle autonomously drive according to the path of the first vehicle.
I would like to draw the path of the two vehicle and compare it graphically, like the two curves in the following example:

I would like the path to be drawn real time, and therefore I think is not possible to use rosbags or csv.

I tried to use RVIZ, and to do so I have tried to publish a nav_msg/Path on two topics called “ego_vehicle_path” and “leader_path”. After that I have tried to add a Path visualization in Rviz and centering the view (fixed frame) on the ego_vehicle. The position is correctly sent to the topics, however I am not able to display it, and I am getting:

Could anyone help me? Any idea would be really appreciated.


Your approach seems good. Just make sure you are republishing the path every time you update it and that the frame you are setting for the message is correct according to your poses.