Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 1516

How to get model state of gazebo object code not working.

$
0
0
This code I wrote to find the position of the turtlebot using the rosservice gazebo_msgs/getmodelstate. But it always returns a failure. Please help. ros::init(argc,argv,"finder"); ros::NodeHandle n; ros::ServiceClient client=n.serviceClient("/gazebo_msgs/GetModelState"); gazebo_msgs::GetModelState gms; gms.request.model_name="mobile_base"; if (client.call(gms)) { ROS_INFO("X= %lf ;",gms.response.pose.position.x); } else{ ROS_INFO("FAILED"); } Edit: the client.call() function returns zero, there is no other problem regarding messages,etc.

Viewing all articles
Browse latest Browse all 1516

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>