Accessing position coordinates in gazebo_msgs/ModelStates

asked 2017-07-24 14:24:30 -0600

BotLover gravatar image

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 model_name geometry_msgs/Pose pose geometry_msgs/Point position float64 x float64 y float64 z geometry_msgs/Quaternion orientation float64 x float64 y float64 z float64 w geometry_msgs/Twist twist geometry_msgs/Vector3 linear float64 x float64 y float64 z geometry_msgs/Vector3 angular float64 x float64 y float64 z string reference_frame 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.

edit retag flag offensive close merge delete