Farama-Foundation / Gymnasium-Robotics

A collection of robotics simulation environments for reinforcement learning
https://robotics.farama.org/
MIT License
485 stars 79 forks source link

Add asserts for `mj_id2name` calls in `mujoco_utils` #218

Closed DavidPL1 closed 1 month ago

DavidPL1 commented 1 month ago

Description

Added asserts for calls to mj_id2name calls. In case the resource is not available in the model definition the call returns -1. After these calls this case is not handled as an error and values for the wrong joint, site, or body are returned.

This change increases the reusability of mujoco_utils and is especially helpful when creating or customizing mujoco environments.

Type of change

Please delete options that are not relevant.

Checklist:

Kallinteris-Andreas commented 1 month ago

for additional refernce: https://mujoco.readthedocs.io/en/stable/APIreference/APIfunctions.html#mj-name2id