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

Revision history [back]

click to hide/show revision 1
initial version

The way that I find the easiest is like suggested: creating your own "vector" and "repainting" it.

In fact, a Path is simply a collection of Poses. Normally, only one path is displayed; therefore, if you send a new one, whatever was displayed before gets erased. So, you can create one path object locally, and keep adding new points to it.

Here is a skeleton of an algorithm that should do what you want:

nav_msgs::Path pathMsg;

while (node.ok())
{
    ros::spinOnce();

    geometry_msgs::PoseStamped poseMsg;

    // Fill the poseMsg with whatever pose you want (the point on your path)

    pathMsg.poses.push_back(poseMsg);

    pathPublisher.publish(pathMsg);

    // Waits a little before adding another pose to the path
    rate.sleep();

} // end loop