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

nav_msgs Path: is it possible to separate the visualized trajectories?

asked 2019-07-18 05:55:45 -0500

akosodry gravatar image


I'm using the nav_msgs::Path message to visualize multiple trajectories.

With one path publisher!

I want to separate these trajectories, i mean, i don't want them to be connected with the line when its visualized in RViz.

Is it possible to break somehow the visualized path?

I tried to solve it by adding a dummy pose of x,y,z=nan, but that did not work, since RVIZ couldn't visualize the path due to Nans.

I also tried to change the frame_id of the dummy pose, but that resulted in basically a xyz=0 (a 2 lines were drawn to 000 in rviz).

Thank you in advance.

edit retag flag offensive close merge delete



That's not what nav_msgs::Path is designed for so it won't work. You can do this with a geometry_msgs::Marker LINE_LIST type. Or you could use multiple publishers of nav_msgs::Path

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-07-18 06:13:14 -0500 )edit

Thank you. Could you put this into an answer? I will accept it.

akosodry gravatar image akosodry  ( 2019-07-18 06:14:58 -0500 )edit

@PeteBlackerThe3rd it turns out that the LINE_STRIP is the one i need to use for path visualization. But still i don't understand how should i "break"/separate the paths? Suppose i have the following points for two trajectories:

x , y, z

1, 0, 0 <- traj1, point1

1, 1, 0 <- traj1, point2

0, 1, 0 <- traj1, point3


-1, 1, 0 <- traj2, point1

-1, 0, 0 <- traj2, point2

-1, -1, 0 <- traj2, point3

how can i separate traj1 and traj2 with the geometry_msgs::Marker LINE_STRIP?

akosodry gravatar image akosodry  ( 2019-07-18 07:13:44 -0500 )edit

That's why I recommended the LIST_LIST type. You will need to double up the points within each path, to make them continuous, but that means you can also represent unconnected paths within the same message.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-07-18 07:33:28 -0500 )edit


OKay then, im working on it. Thank you.

Should i copy your comment into the answer section?

akosodry gravatar image akosodry  ( 2019-07-18 07:37:53 -0500 )edit

Yes, feel free to add that if you write up an answer to your question.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-07-18 08:16:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-07-18 08:29:25 -0500

akosodry gravatar image

The answer is based on the comment of @PeteBlackerThe3rd.


should be used for the visualization of multiple/separated trajectories. The points in the path should be doubled up to make them look continuous.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-07-18 05:55:45 -0500

Seen: 668 times

Last updated: Jul 18 '19