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

FirmYn's profile - activity

2022-03-31 09:15:22 -0500 received badge  Student (source)
2018-09-14 17:37:54 -0500 marked best answer 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)

2017-07-21 02:44:16 -0500 received badge  Notable Question (source)
2017-07-21 02:44:16 -0500 received badge  Famous Question (source)
2017-05-26 23:01:56 -0500 received badge  Popular Question (source)
2017-05-15 09:08:01 -0500 asked a question How to use GetModelState service from Gazebo in python

How to use GetModelState service from Gazebo in python Hi, I'm actually working on Baxter robot with gazebo and I wanted

2017-05-15 09:08:00 -0500 asked a question How to recover Gazebo model state in python with GetModelState

How to recover Gazebo model state in python with GetModelState Hi, I'm actually working on Baxter robot with gazebo and