Robotics StackExchange | Archived questions

Accessing position coordinates in gazebo_msgs/ModelStates

I have been trying to access xyz coordinates of pose position of each of my objects in gazebo. I have three models in gazebo world- ground, quad copter & square box. The structure of the modelSates is string modelname geometrymsgs/Pose pose geometrymsgs/Point position float64 x float64 y float64 z geometrymsgs/Quaternion orientation float64 x float64 y float64 z float64 w geometrymsgs/Twist twist geometrymsgs/Vector3 linear float64 x float64 y float64 z geometrymsgs/Vector3 angular float64 x float64 y float64 z string referenceframe I am getting error in accessing the position xyz coordinate. The way I am doing is double p = ms->pose.position[1].x; where ms is the pointer to the ModelStates in the callback function.

Asked by BotLover on 2017-07-24 14:24:30 UTC

Comments

Answers