0
$\begingroup$

I need to fix one part of my robot to the static environment. Can this be done in Webots? I'm using R2022b.

$\endgroup$

1 Answer 1

1
$\begingroup$

Yes it is possible, you have two solutions:

  1. If you want to modify your robot such that one part is always pinned to the static environment, you could remove the Physics node from the top Robotnode.

    Then you can add Physics nodes only in the parts that you want.

    This is what is done in this example with the staticBase option: the base is static but the robotic arm have physics.

  2. If you do not want to modify your robot or want to only immobilize your robot temporary, you can do it with a physics plugin. You can add a physics plugin with the File / New / New Physics Plugin... menu item. In the plugin code, you must simply add an ODE fixed joint between the dBodyID of the robot part and the static environment. This can be implemented like this:

    #include <ode/ode.h> #include <plugins/physics.h> void webots_physics_init() { // get body of the robot part dBodyID body = dWebotsGetBodyFromDEF("MY_ROBOT_PART"); // get the matching world dWorldID world = dBodyGetWorld(body); // the joint group ID is 0 to allocate the joint normally dJointID joint = dJointCreateFixed(world, 0); // attach robot part to the static environment: 0 dJointAttach(joint, body, 0); // fix now: remember current position and rotation dJointSetFixed(joint); } void webots_physics_step() { // nothing to do } void webots_physics_cleanup() { // nothing to do } 

    You will find the description of Webots physics plugin API here. You will find the description about the ODE functions on this page.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.