Module: MJObject
-
template<typename mjsObjectType>
class MJObject - #include <MJObject.h>
A wrapper class for managing a MuJoCo object.
This class provides functionality for configuring and accessing a MuJoCo object, including name and ID retrieval. It also assigns a default name to nameless objects.
- Template Parameters:
mjsObjectType – The MuJoCo object type.
Public Functions
-
inline MJObject(mjsObjectType *mjsObject)
Constructs an MJObject with a given MuJoCo object pointer.
Initializes the MuJoCo object’s name, setting it to a unique default name if it is unnamed.
- Parameters:
mjsObject – Pointer to the MuJoCo object.
-
inline void configure(const mjModel *mujocoModel)
Configures the MJObject by linking it to the given MuJoCo model.
Sets the object’s ID by searching for its name within the MuJoCo model. Throws an exception if the object cannot be found.
- Parameters:
mujocoModel – Pointer to the MuJoCo model to configure the object with.
- Throws:
std::runtime_error – If the object name cannot be found in the model.