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

Filling geometry_msgs/Pose2D[] message

asked 2012-06-18 06:20:05 -0500

mapa17 gravatar image

updated 2014-01-28 17:12:42 -0500

ngrennan gravatar image


i am failing to fill a ros message and google serves me no good.

The message is of the following format

Header header
string child_frame_id
geometry_msgs/Pose2D[] pose

Maybe i lack the needes C++ skills, but i just dont understand the automatic created class for this message. How do i fill Pose2D elements to a new message?

I tried something like the following without success:

pedestrianSim::pedestrians msg;
geometry_msgs::Pose2D_ singlePos;
singlePos.x = x;
singlePos.y = y;
singlePos.theta = omega;
msg.pose.push_back( singlePos );

Thank you for your help!

Regards, Manuel

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-06-18 06:42:56 -0500

joq gravatar image

It would help to see your error messages.

Looking at what information you did provide, I suggest leaving off the trailing '_' from the message type name:

geometry_msgs::Pose2D singlePos;
edit flag offensive delete link more

answered 2012-06-19 01:56:03 -0500

mapa17 gravatar image


thank you, you where right. Removing the trailing underscore was enough! I thought i was completely of track and only posted the code as an example.

Thank you!

edit flag offensive delete link more

Question Tools


Asked: 2012-06-18 06:20:05 -0500

Seen: 3,826 times

Last updated: Jun 19 '12