Ask Your Question
0

Question related to PoseArray and it's implementation.

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

Parth2851 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 -0600

bob-ROS gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 24 times

Last updated: Dec 08 '19