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

publish a path

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

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 -0500

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 -0500 )edit

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

rreignier gravatar image rreignier  ( 2018-06-25 14:05:58 -0500 )edit

Question Tools



Asked: 2018-02-08 02:12:03 -0500

Seen: 9,719 times

Last updated: Feb 08 '18