Home | Tutorials | Wiki | Issues
Ask Your Question

How to add a link/joint in runtime

asked 2015-01-08 14:41:27 -0500

Trmotta gravatar image


Id like to know if its possible to edit a robot in runtime by adding new Links/Joints to it while still having the simulation running and affecting the whole model (unlike the method editor). Ive stumbled upon this UpdateParameters method, but Im not quite sure this will do what I want, although updating an SRDF seems promising.

Im currently using Gazebo 4 on Ubuntu Precise.

If this is possible, does anyone know how to accomplish it ?

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-01-09 02:48:54 -0500

AndreiHaidu gravatar image


you can create new models similarly to this tutorial, I am not sure if you can add a new links to an existing model, but, you can connect links of different models.

The code should be something like this:

physics::JointPtr joint;

joint = this->world->GetPhysicsEngine()->CreateJoint("revolute", model1);

joint->Load(model1_link, model2_link, math::Pose());

joint->Attach(model1_link, model2_link);

joint->SetAxis(0, axis_ex);

joint->SetHighStop(0, high_stop_ex);
joint->SetParam("cfm", 0, cfm_ex);

Cheers, Andrei

edit flag offensive delete link more


Thanks! That solved it!

Trmotta gravatar imageTrmotta ( 2015-01-13 12:36:20 -0500 )edit

(Edited) I made a plugin to attach any two links in gazebo: https://github.com/pal-robotics/gazebo_ros_link_attacher

awesomebytes gravatar imageawesomebytes ( 2016-04-19 09:40:18 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-01-08 14:41:27 -0500

Seen: 2,702 times

Last updated: Jan 16 '15