Quantcast
Viewing all articles
Browse latest Browse all 1516

How to use GetModelState service from Gazebo in python

Hi, I'm actually working on Baxter robot with gazebo and I wanted to get the model state of cubes I create, so I made this method : def show_gazebo_models(self): try: model_coordinates = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState) for block in self._blockListDict.itervalues(): blockName = "block_" + str(block._name) resp_coordinates = model_coordinates(blockName, "model") print(blockName) print("Cube " + str(block._name)) print("Valeur de X : " + str(resp_coordinates.pose.position.x)) print("Quaternion X : " + str(resp_coordinates.pose.orientation.x)) except rospy.ServiceException as e: rospy.loginfo("Get Model State service call failed: {0}".format(e)) But this returns 0.00 for each print I made. In documentation GetModelState needs two arguments : **model_name** and **relative_entity_name** and I don't know what I need to use for the second argument. (For model_name it's block_a for the first one, block_b for the second, 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>