Handling kinematic loops
Some robots have kinematic loops, meaning that the kinematic chain is not a tree but a graph.
Introduction
Here is a 2D planar robot with kinematic loop, we assume the two first joints to be actuated and the others to be passive:
However, robot description are usually trees. To model this type of robot, we break it down to a tree. We attach frames to this tree, and need to enforce run-time constraints.

Specifying closing constraints
While you could manually add frames, onshape-to-robot
provides a more convenient way to handle kinematic loops: mate connectors.
To achieve that, add a mate with the name closing_something
:

Support for <equality>
in MuJoCo
When using the MuJoCo format, onshape-to-robot
will add <equality>
constraints to enforce the kinematic loop.
For example, the above robot can be exported using the following config.json
:
{
// Document URL, MuJoCo output
"url": "https://cad.onshape.com/documents/04b05c47de7576f35c0e99b3/w/68041f3f5c827a258b40039c/e/db543f501b01adf8144064e3",
"output_format": "mujoco",
// Disable the freejoint to fix the robot
"freejoint": false,
// Don't create actuators for passive joints
"joint_properties": {
"passive1": {"actuated": false},
"passive2": {"actuated": false}
}
}
Here is the result of the export:
Ressources
Here are some ressources on how to handle kinematic loops in software:
Onshape assembly for the above example robot.
MuJoCo equality constraints.
In pyBullet, you can use createConstraint method to add the relevant constraint.
In the PlaCo solver, you can create a RelativePositionTask. See the kinematics loop documentation section for more details. Some examples created with onshape-to-robot can be found in the example gallery.