visualizers.mujoco_helpers.utils#

Class for rendering Mujoco trajectories in meshcat

Module Contents#

visualizers.mujoco_helpers.utils.get_sensor_name(model: mujoco.MjModel, sensorid: int) str#

Return name of the sensor with given ID from MjModel.

Parameters:
  • model (mujoco.MjModel) –

  • sensorid (int) –

Return type:

str

visualizers.mujoco_helpers.utils.get_mesh_data(model: mujoco.MjModel, meshid: int) tuple[numpy.ndarray, numpy.ndarray]#

Retrieve the vertices and faces of a specified mesh from a MuJoCo model.

Parameters:
  • model (mujoco.MjModel) – MjModel The MuJoCo model containing the mesh data.

  • meshid (int) – int The index of the mesh to retrieve.

Return type:

tuple[numpy.ndarray, numpy.ndarray]

Result:

tuple[np.ndarray, np.ndarray] Vertices (N, 3) and faces (M, 3) of the mesh.

visualizers.mujoco_helpers.utils.is_trace_sensor(model: mujoco.MjModel, sensorid: int) bool#
Parameters:
  • model (mujoco.MjModel) –

  • sensorid (int) –

Return type:

bool

visualizers.mujoco_helpers.utils.count_trace_sensors(model: mujoco.MjModel) int#

Count the number of trace sensors of a given mujoco model.

Parameters:

model (mujoco.MjModel) –

Return type:

int

visualizers.mujoco_helpers.utils.get_trace_sensors(model: mujoco.MjModel) List[int]#
Parameters:

model (mujoco.MjModel) –

Return type:

List[int]

visualizers.mujoco_helpers.utils.set_mocap_pose(data: mujoco.MjData, mocap_id: int, pose: numpy.ndarray) None#

Set the position of the mocap element.

Parameters:
  • data (mujoco.MjData) –

  • mocap_id (int) –

  • pose (numpy.ndarray) –

Return type:

None

visualizers.mujoco_helpers.utils.set_mocap_poses(data: mujoco.MjData, mocap_ids: list[int], poses: list[numpy.ndarray]) None#

Set the positions of the mocap elements.

Parameters:
  • data (mujoco.MjData) –

  • mocap_ids (list[int]) –

  • poses (list[numpy.ndarray]) –

Return type:

None

visualizers.mujoco_helpers.utils.set_state(plant: jacta.visualizers.mujoco_helpers.dynamics.MujocoPlant, state: torch.FloatTensor) None#

Set plant state.

Parameters:
  • plant (jacta.visualizers.mujoco_helpers.dynamics.MujocoPlant) –

  • state (torch.FloatTensor) –

Return type:

None

visualizers.mujoco_helpers.utils.visualize_state_or_trajectory(plant: jacta.visualizers.mujoco_helpers.dynamics.MujocoPlant, time_step: float, state: torch.FloatTensor | None = None, trajectory: torch.FloatTensor | None = None, display_time: float = 5.0) None#

Visualize the system undergo a trajectory of states.

Parameters:
  • plant (jacta.visualizers.mujoco_helpers.dynamics.MujocoPlant) –

  • time_step (float) –

  • state (torch.FloatTensor | None) –

  • trajectory (torch.FloatTensor | None) –

  • display_time (float) –

Return type:

None