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

Question related to PoseArray and it's implementation.

asked 2019-12-08 15:09:38 -0500

Parth2851 gravatar image

updated 2022-01-22 16:10:12 -0500

Evgeny gravatar image

Hello, I need to implement Dijkstra's algorithm on a Map I have.

Coding part of my problem is done, however I am having trouble saving the path in a geometry_msgs/PoseArray.

Let's say I have an array(in c++) named prev which stores the shortest path from source to destination.

How can I use this path to publish a PoseArray and then visualise it on rViz?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-12-08 16:37:34 -0500

bob-ROS gravatar image

updated 2019-12-08 16:41:04 -0500

Assuming you included the header files correctly and got a working CMakeLists and a nodehandle (nh).

pose_array_pub = nh.advertise<geometry_msgs::PoseArray>("/my_pose_array", 1);

geometry_msgs::PoseArray my_pose_array;
my_pose_array.header.frame_id = "map"; // or other frame you wish to publish relative to.
std::vector<geometry_msgs::Pose> your_vector;
// push or insert to your vector
my_pose_array.poses = your_vector;

pose_array_pub.publish(my_pose_array);

You can otherwise manually push your pose array with e.g. my_pose_array.poses.push_back(my_pose)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-12-08 15:09:38 -0500

Seen: 276 times

Last updated: Dec 08 '19