1
$\begingroup$

Rosanswers logo

Is there a way to control robot models in gazebo by using external controller? I know usually it is controlled using plugins which we are adding in urdf file.

I mean, without using a gazebo control plugin is there a way to control robot model?


Originally posted by SVS on ROS Answers with karma: 233 on 2015-03-21

Post score: 3


Original comments

Comment by 130s on 2015-03-21:
I'm interested in the answer too. I would ask on Gazebo's forum http://answers.gazebosim.org/questions/

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You can do non-physical movements like this:

rostopic pub -1 /gazebo/set_model_state gazebo_msgs/ModelState '{model_name: testbot, pose: { position: { x: -0.32, y: 0, z: 2.1 }, orientation: {x: 0.0, y: 0.0, z: -0.766, w: 0.643 } }, reference_frame: world }'

It's okay for setting model positions while time is stopped but intersecting two things will explode the sim. It might be better to set velocities instead of positions but the model state has both, so any publish is going to overwrite both (in my example the velocities are going to be zero by default). More advanced stuff can be done with GazeboJS, but C++ plugins are going to be the most powerful.

The rawest controller plugins are the effort ones, in order to achieve a position you would have to write your own controller around them. Are those not usable for your application?


Originally posted by lucasw with karma: 8729 on 2015-03-21

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by SVS on 2015-03-21:
Thank u lucasw. It is useful.

Comment by FabianD on 2017-12-20:
For reference, wth gazebojs and gazebo8 it would the equivalent would be:

 gazebo.publish('gazebo.msgs.Model', '/gazebo/default/model/modify', {name: 'testbot, pose: { position: { x: -0.32, y: 0, z: 2.1 }, orientation: {x: 0.0, y: 0.0, z: -0.766, w: 0.643 } } })
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.