semantic_digital_twin.adapters.mjcf#

Classes#

MJCFParser

Class to parse an MJCF file and convert it into a World object.

Module Contents#

class semantic_digital_twin.adapters.mjcf.MJCFParser#

Class to parse an MJCF file and convert it into a World object.

file_path: str#

The file path of the scene.

prefix: str | None = None#

The prefix for every name used in this world.

parse() semantic_digital_twin.world.World#

Parse the MJCF file and convert it into a World object.

Returns:

The World object representing the MJCF scene.

parse_body(mujoco_body: mujoco.MjsBody)#

Parse a Mujoco body and add it to the world.

Parameters:

mujoco_body – The Mujoco body to parse.

parse_inertial(mujoco_body: mujoco.MjsBody) semantic_digital_twin.world_description.inertial_properties.Inertial | None#

Parse the inertial properties of a Mujoco body.

Parameters:

mujoco_body – The Mujoco body to parse.

Returns:

The Inertial properties of the body, or None if not applicable.

parse_joints(mujoco_body: mujoco.MjsBody)#

Parse the joints of a Mujoco body and add them to the world.

Parameters:

mujoco_body – The Mujoco body whose joints to parse.

parse_geom(mujoco_geom: mujoco.MjsGeom) semantic_digital_twin.world_description.geometry.Shape#

Parse a Mujoco geometry and convert it into a Shape object.

Parameters:

mujoco_geom – The Mujoco geometry to parse.

Returns:

The Shape object representing the geometry.

parse_joint(parent_name: str, child_name: str, mujoco_joint: mujoco.MjsJoint | None = None)#

Parse a Mujoco joint and add it to the world.

Parameters:
  • parent_name – The name of the parent body.

  • child_name – The name of the child body.

  • mujoco_joint – The Mujoco joint to parse. If None, a fixed connection is created.

parse_dof(mujoco_joint: mujoco.MjsJoint) semantic_digital_twin.world_description.degree_of_freedom.DegreeOfFreedom#

Parse a Mujoco joint and return the corresponding DegreeOfFreedom.

Parameters:

mujoco_joint – The Mujoco joint to parse.

Returns:

The DegreeOfFreedom corresponding to the joint.

parse_actuator(mujoco_actuator: mujoco.MjsActuator)#

Parse a Mujoco actuator and add it to the world.

Parameters:

mujoco_actuator – The Mujoco actuator to parse.