Implement differential drive in Mujoco

Discussion in 'Modeling' started by Rocky Duan, Aug 25, 2016.

  1. Is there a good way (or even better, an example) to implement a 2D differential drive robot in Mujoco? The main purpose is to build a model of a simple robot capable of navigating in 2D with nontrivial control. I've attached an XML file I tried, which I could control the orientation in the Mujoco GUI, but failed to get it moving somewhere by actually applying control inputs.

    Attached Files:

    Henrique G. likes this.
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    You can use a fixed tendon whose length is the sum of the two rotational joint angles of the wheels. Then you can attach an actuator to that tendon. This will give you the desired control torque.

    For steering, you probably need a steering wheel which has one hinge joint. Then use equality constraints to couple that hinge joint to the orientation of the front wheels. If you feel adventurous, you could use nonlinear coupling to represent Ackermann steering. Note that scalar equality constraints in MuJoCo allow up to 4th-order polynomials. This should be sufficient to approximate the trigonometric formulas for Ackermann steering over the relevant range of wheel orientations.

    I should add an official code sample with a car model at some point...
  3. I would like to thank you, Todorov.

    I just implemented this and it's working. At least seems so. I need to run some tests to be sure.