Model states with Code Deviation for position Values

asked 2017-11-27 04:19:36 -0500

Baumboon gravatar image

updated 2018-01-22 07:00:31 -0500

Hello Guys,

i used a ros gazebo code example to get on my model state data for my objects in the world.

class Block:
    def __init__(self, name, relative_entity_name):
        self._name = name
        self._relative_entity_name = relative_entity_name

class Tutorial:

    _blockListDict = {
        'block_a': Block('fire_hydrant', 'link')


    def show_gazebo_models(self):
            model_coordinates = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState)
            for block in self._blockListDict.itervalues():
                blockName = str(block._name)
                resp_coordinates = model_coordinates(blockName, block._relative_entity_name)
                print '\n'
                print 'Status.success = ', resp_coordinates.success
                print("fire_hydrant " + str(block._name))
                print("x Wert : " + str(resp_coordinates.pose.position.x))
                print("Y Wert : " + str(resp_coordinates.pose.position.y))

        except rospy.ServiceException as e:
            rospy.loginfo("Get Model State service call failed:  {0}".format(e))

So i get the x and y position for my fire hydrant. Now my problem is that there is a deviation for arround 0.5 for the x Value only the x value the y value and the z value are correct. And there are another deviations for the x and y data i got from my slam map.

I use two different commands:

rosservice call gazebo/get_model_state '{model_name: first_2015_trash_can}'

There i get following result:

    x: 2.14281687169
    y: -0.00116752407381
    z: -4.58441595449e-05

When i use my own programm i got following results:

Status.success =  True
first_2015_trashcan first_2015_trash_can
x Wert : 1.64513587169
Y Wert : -0.00116752407381

Without moving the trash. So thats why i think one of the values is wrong

i Updated the question a bit hope someone can help me why i get different values?

edit retag flag offensive close merge delete


That service should give you the exact location of the model in the world, what are you comparing the result against (why do you think it is wrong)?

chapulina gravatar imagechapulina ( 2017-11-27 10:02:11 -0500 )edit

I updated my question so its easier to see why i think something is wrong there is a deviation of 0.5 between the x values. I have no idea where it comes from. Addtionally both x and y values deviates a bit from my SLAM values for x and y

Baumboon gravatar imageBaumboon ( 2017-11-27 10:19:14 -0500 )edit