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

publish a path

asked 2018-02-08 02:12:03 -0600

Chris_ROSuser gravatar image


I want to publish a path, but with this code I can publish only one point at a time: geometry_msgs::Point msg;

What can I do to publish the path? This page should work, but I don't know exactly how to write the code for it.

Can you help me out? Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-02-08 02:48:19 -0600

rreignier gravatar image

To fill that kind of messages, create a geometry_msgs/PoseStamped and then insert it in the vector poses in the nav_msgs/Path message.

Note that in C++, an variable length array is a std::vector.

So it should look like:

nav_msgs::Path path;

geometry_msgs::PoseStamped pose;

pose.header.stamp = ...;
pose.header.frame_id = ...;
pose.pose.position.x = ...;

path.header.stamp = ...;
path.header.frame_id = ...;
edit flag offensive delete link more


once you publish a path, how do you make a robot follow the published path in rviz? I am using this package to publish predefined paths but my robot wont move along the path...

aarontan gravatar image aarontan  ( 2018-06-16 10:58:41 -0600 )edit

@aarontan It is a complex subject. Maybe you can start here:

rreignier gravatar image rreignier  ( 2018-06-25 14:05:58 -0600 )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: 2018-02-08 02:12:03 -0600

Seen: 8,392 times

Last updated: Feb 08 '18