In this PR I add the codebase I developed for generating some mujoco models of ergoCub.
There is an environment.yaml that can be used to create a conda environment with minimal dependencies.
To run the examples a superbuild needs to be active for resolve_robotics_uri_py boing able to find the original urdfs. In addition the repo needs to be installed with pip install -e . into the conda env.
Available examples
generate_ergoCub_mjcf.py : Generates the full ergoCub model, with floating base, with position actuators in every joint (hands excluded, with caveats, see below);
generate_ergoCub_torso.py: Generates only the upperbody of ergocub, removing the legs, the actuators are again position servos for all joints (hands see below);
'generate_ergoCub_hand.py`: Generate only a single hand (right) extracted from ergoCub, this deals with adding the position servos only for the joints that are actually actuated and equality constraints to fake the linkages of the hand ( this is done in all models above aswell) in addition the thumb orientation can be changed.
All examples load the package://ergoCub/robots/ergoCubSN001/model.urdf model, converts it to mjcf and saves it, thent shows the obtained model in a simple world in the interactive mujoco viewer.
The codebase is split into 4 main files:
generator.py: contains general functions needed to generate a mjcf file ( currently only load_urdf_into_mjcf);
'hands_fcn.py`: contains all funcitons needed to deal with the hands, that in general need more care (linkages, different actuatror gains, different joint damping)
mjcf_fcn.py: contains functions that deal with already converted mjcf files, for example adding actuators, sensors etc.
urdf_fcn.py: contains functions that deal with the original urdf files, for example to strip some parts, finding the mesh locations etc.
There is a small and incomplete test suite that runs on pytest.
In this PR I add the codebase I developed for generating some mujoco models of ergoCub.
There is an
environment.yaml
that can be used to create a conda environment with minimal dependencies.To run the examples a superbuild needs to be active for
resolve_robotics_uri_py
boing able to find the original urdfs. In addition the repo needs to be installed withpip install -e .
into the conda env.Available examples
generate_ergoCub_mjcf.py
: Generates the full ergoCub model, with floating base, with position actuators in every joint (hands excluded, with caveats, see below);generate_ergoCub_torso.py
: Generates only the upperbody of ergocub, removing the legs, the actuators are again position servos for all joints (hands see below);All examples load the
package://ergoCub/robots/ergoCubSN001/model.urdf
model, converts it to mjcf and saves it, thent shows the obtained model in a simple world in the interactive mujoco viewer.The codebase is split into 4 main files:
generator.py
: contains general functions needed to generate a mjcf file ( currently onlyload_urdf_into_mjcf
);mjcf_fcn.py
: contains functions that deal with already converted mjcf files, for example adding actuators, sensors etc.urdf_fcn.py
: contains functions that deal with the original urdf files, for example to strip some parts, finding the mesh locations etc.There is a small and incomplete test suite that runs on pytest.