Quantcast
Channel: Gazebo: Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 7017

Get model position from objects ( Position is not exact)

$
0
0
Hello guys, i never get an answer to my problem so i think i will describe the problem a bit better this time. So i want to get the position of the Objects in my world. It worked good so far the problem is that the x value is 0.5 above or below the correct position. System is Linux 16.04. Ros Kinetic. Gezabo 7.0 Here is my code: class Block: def __init__(self, name, relative_entity_name): self._name = name self._relative_entity_name = relative_entity_name class Tutorial: _blockListDict = { 'a': Block('cardboard_box', 'link'), 'b': Block('bookshelf_0', 'link'), 'c': Block('cabinet', 'link'), 'd': Block('mars_rover', 'link'), 'e': Block('Dumpster_0', 'link'), 'f': Block('unit_box_0', 'link'), 'g': Block('fire_hydrant', 'link'), 'h': Block('first_2015_trash_can', 'link'), } def update_gazebo_modelPoints(self): try: i = 0 plist = [] 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) plist.append(Point(resp_coordinates.pose.position.x,resp_coordinates.pose.position.y,0)) return plist except rospy.ServiceException as e: rospy.loginfo("Get Model State service call failed: {0}".format(e)) So my first object stands on Point(5,5,0) Here is the screenshot from simulation: ![image description](/upfiles/1541069489296238.png) If i run the code i got this: ![image description](/upfiles/15410696053845245.png) Its the same with all objects . Hope u can help me !

Viewing all articles
Browse latest Browse all 7017

Trending Articles