Gazebo | Ignition | Community
Ask Your Question
0

Getting model state via rospy

asked 2018-01-24 03:34:40 -0600

Fiddle gravatar image

updated 2018-01-29 04:07:58 -0600

Hello there, In my reinforcement learning simulation I am trying to get the pose of one of the models to use it for some calculations. Although I think I am using correct methods, the results are not what I want. Here is what the data for the model looks like in Gazebo:

gazebo model description

Here what interests me is the model pose.

And when I use the rosservice call on this model to get the state, same as in the tutorial it returns the correct pose. But when I am trying to use rospy, I get the pose of a link, which stays the same. Here is the code that I use to do this:

self.model_coordinates = rospy.ServiceProxy( '/gazebo/get_model_state', GetModelState)
self.object_coordinates = self.model_coordinates("8115RC_V2", "8115RC_V2")
z_position = self.object_coordinates.pose.position.z
y_position = self.object_coordinates.pose.position.y
x_position = self.object_coordinates.pose.position.x
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-01-29 08:17:30 -0600

Fiddle gravatar image

I've found an answer, the second parameter to model_coordinates needs to be an empty string.

edit flag offensive delete link more

Comments

precision about the "empty string": that second argument to the service client call (model_coordinates() in this case) represents the relative_entity_name As the docs say : "leave empty or "world" will use inertial world frame" http://docs.ros.org/melodic/api/gazeb...

ljburtz gravatar imageljburtz ( 2020-06-18 21:29:34 -0600 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2018-01-24 03:34:40 -0600

Seen: 3,494 times

Last updated: Jan 29 '18