motrixsim#

Classes:

Actuator

The Actuator object represents a controllable actuator in the simulation.

Body

The Body object represents a rigid body in the scene.

Camera

The Camera object in the scene.

CameraMgr

ContactQuery

FloatingBase

The FloatingBase object represents a floating base in the scene.

Joint

The Joint object represents a joint in the scene.

Link

The Link object represents a kinematic link in the scene.

Options

The Options object represents the simulation options.

SceneData(model)

The SceneData object represents the simulation state.

SceneModel

The SceneModel object represents the entire simulation world.

Site

The Site object represents a reference point or marker in the scene.

Functions:

forward_kinematic(model, data)

Run forward kinematic only.

load_mjcf_str(mjcf)

Load a model from a string containing MJCF data.

load_model(path)

Load a model from the given file path.

step(model, data)

Advance the simulation by one step.

class motrixsim.Actuator#

基类:object

The Actuator object represents a controllable actuator in the simulation.

This class provides access to the properties and methods of an actuator, allowing users to query its name, index, control range, and set the control value.

Methods:

get_ctrl(data)

Get the control value of the actuator.

set_ctrl(data, ctrl)

Set the control value of the actuator.

Attributes:

ctrl_range

The control range of the actuator.

index

The index of the actuator in the simulation world.

name

The name of the actuator.

target_name

The name of the actuator target.

target_type

The type of the actuator target.

typ

The type of the actuator.

get_ctrl(data)#

Get the control value of the actuator.

参数:

data (SceneData) -- The scene data.

返回:

The current control value of the actuator.

返回类型:

float

set_ctrl(data, ctrl)#

Set the control value of the actuator.

参数:
  • data (SceneData) -- The scene data.

  • ctrl (float) -- The control value to set.

ctrl_range#

The control range of the actuator.

Returns None if not set.

Type:

Optional[Tuple[float, float]]

index#

The index of the actuator in the simulation world.

Type:

int

name#

The name of the actuator.

Return "None" if not set.

Type:

Optional[str]

target_name#

The name of the actuator target. (e.g., joint name, tendon name).

Type:

str

target_type#

The type of the actuator target.

valid values are:

  • "floating_base": For floating base actuators.

  • "joint": For joint actuators.

  • "tendon": For tendon actuators.

Type:

str

typ#

The type of the actuator.

valid values are:

  • "general": General actuator.

  • "position": Position servo. The ctrl represents the target position

  • "velocity": Velocity servo. The ctrl represents the target velocity

  • "motor": The ctrl represents the torque or force

Type:

str

class motrixsim.Body#

基类:object

The Body object represents a rigid body in the scene.

This class provides access to the properties and state of a rigid body in the simulation. It allows you to retrieve information about the body's name, floating base, pose, and DoF positions and velocities.

Methods:

get_joint_dof_pos(data)

Get the DoF positions of all joints on the body.

get_joint_dof_vel(data)

Get the DoF velocities of all joints on the body.

get_pose(data)

Get the world pose of the body.

Attributes:

floatingbase

The floating base object.

is_mocap

Whether the body is a mocap (kinematic) body.

name

The name of the body.

num_joints

The number of joints that belong to this body.

num_links

The number of links that belong to this body.

get_joint_dof_pos(data)#

Get the DoF positions of all joints on the body.

参数:

data (SceneData) -- The scene data.

返回:

The DoF positions.

返回类型:

NDArray[float]

get_joint_dof_vel(data)#

Get the DoF velocities of all joints on the body.

参数:

data (SceneData) -- The scene data.

返回:

The DoF velocities.

返回类型:

NDArray[float]

get_pose(data)#

Get the world pose of the body.

参数:

data (SceneData) -- The scene data.

返回:

The pose as a 7-element array [x, y, z, i, j, k, w].

返回类型:

NDArray[float]

floatingbase#

The floating base object.

Return None if not present.

备注

In mjcf, a body is free moving if it has <freejoint>

Type:

Optional[FloatingBase]

is_mocap#

Whether the body is a mocap (kinematic) body.

Return True if the body has no joints and fixed to the world, False otherwise.

Type:

bool

name#

The name of the body.

Return None if not present.

Type:

Optional[str]

num_joints#

The number of joints that belong to this body.

备注

The <freejoint> is not counted as a joint in motrixsim but a floating base.

Type:

int

The number of links that belong to this body.

Type:

int

class motrixsim.Camera#

基类:object

The Camera object in the scene.

Methods:

get_pose(data)

Get the world pose of the camera.

set_near_far(near, far)

Set the near and far plane of the camera.

set_render_target(target[, w, h])

Set the render target of the camera.

Attributes:

depth_only

Whether the camera is in depth-only mode.

far_plane

Get the far plane distance of the camera.

index

The index of the camera in the motrixsim.SceneModel.cameras().

model

The scene model that this camera belongs to.

name

Get the name of the camera.

near_plane

Get the far plane distance of the camera.

render_target

Get the render target of the camera, either "window" or "image".

get_pose(data)#

Get the world pose of the camera.

参数:

data (SceneData) -- The scene data object.

返回:

A 7-element array containing the camera's position (x, y, z) and rotation (i, j, k, w).

返回类型:

NDArray[float]

set_near_far(near, far)#

Set the near and far plane of the camera.

参数:
  • near (float) -- The near plane distance. Must be positive.

  • far (float) -- The far plane distance. Must be larger than near.

set_render_target(target, w=400, h=300)#

Set the render target of the camera.

参数:
  • target (str) -- The render target, either "window" or "image".

  • w (int) -- The width of the image if the target is "image". ignored if the target is

  • "window".

  • h (int) -- The height of the image if the target is "image". ignored if the target is

  • "window".

备注

This method must be called before you launch the render application.

depth_only#

Whether the camera is in depth-only mode.

备注

This attribute must be set before you launch the render application.

Type:

bool

far_plane#

Get the far plane distance of the camera.

Type:

float

index#

The index of the camera in the motrixsim.SceneModel.cameras().

Type:

int

model#

The scene model that this camera belongs to.

Type:

SceneModel

name#

Get the name of the camera.

Type:

Option[str]

near_plane#

Get the far plane distance of the camera.

Type:

float

render_target#

Get the render target of the camera, either "window" or "image".

Type:

str

class motrixsim.CameraMgr#

基类:object

Attributes:

cameras

All the cameras defined in the model.

model

The scene model that this camera manager belongs to.

cameras#

All the cameras defined in the model.

Type:

List[Camera]

model#

The scene model that this camera manager belongs to.

Type:

SceneModel

class motrixsim.ContactQuery#

基类:object

Methods:

is_colliding(geom_pairs)

Given a list of geometry pairs, check if they are colliding.

Attributes:

num_contacts

The number of contacts in the world.

is_colliding(geom_pairs)#

Given a list of geometry pairs, check if they are colliding.

返回:

A 1D array of booleans indicating whether each pair is colliding.

返回类型:

NDArray[bool]

num_contacts#

The number of contacts in the world.

Type:

int

class motrixsim.FloatingBase#

基类:object

The FloatingBase object represents a floating base in the scene.

This class provides access to the properties and state of a floating base in the scene. It allows you to retrieve information about the base's name, DoF velocities and positions, and to set its world translation and rotation.

Methods:

get_dof_pos(data)

Get the DoF positions of the floating base.

get_dof_vel(data)

Get the DoF velocities of the floating base.

get_global_angular_velocity(data)

Extract the world angular velocity of the floating base from the dof velocity array.

get_global_linear_velocity(data)

Extract the world linear velocity of the floating base from the dof velocity array.

get_local_angular_velocity(data)

Extract the local angular velocity of the floating base from the dof velocity array.

get_rotation(data)

Extract the world rotation of the floating base from the dof position array.

get_translation(data)

Extract the world translation of the floating base from the dof position array.

set_global_angular_velocity(data, vel)

Set the global angular velocity of the floating base to dof velocity array directly.

set_global_linear_velocity(data, vel)

Set the global linear velocity of the floating base to dof velocity array directly.

set_local_angular_velocity(data, vel)

Set the local angular velocity of the floating base to dof velocity array directly.

set_rotation(data, quat)

Set the world rotation of the floating base.

set_translation(data, translation)

Set the world translation of the floating base.

Attributes:

dof_pos_indices

The DoF position indices of the floating base.

dof_pos_start

The DoF position address of the floating base.

dof_vel_indices

The DoF velocity indices of the floating base.

dof_vel_start

The DoF velocity address of the floating base

name

The name of the floating base.

get_dof_pos(data)#

Get the DoF positions of the floating base.

参数:

data (SceneData) -- The scene data.

返回:

The DoF positions.

返回类型:

NDArray[float]

get_dof_vel(data)#

Get the DoF velocities of the floating base.

参数:

data (SceneData) -- The scene data.

返回:

The DoF velocities.

返回类型:

NDArray[float]

get_global_angular_velocity(data)#

Extract the world angular velocity of the floating base from the dof velocity array.

参数:

data (SceneData) -- The scene data.

返回:

The world angular velocity.

返回类型:

NDArray[float]

get_global_linear_velocity(data)#

Extract the world linear velocity of the floating base from the dof velocity array.

参数:

data (SceneData) -- The scene data.

返回:

The world linear velocity.

返回类型:

NDArray[float]

get_local_angular_velocity(data)#

Extract the local angular velocity of the floating base from the dof velocity array.

get_rotation(data)#

Extract the world rotation of the floating base from the dof position array.

参数:

data (SceneData) -- The scene data.

返回:

A quaternion representing the rotation in the format [i, j, k, w].

返回类型:

NDArray[float]

get_translation(data)#

Extract the world translation of the floating base from the dof position array.

参数:

data (SceneData) -- The scene data.

返回:

The world translation.

返回类型:

NDArray[float]

set_global_angular_velocity(data, vel)#

Set the global angular velocity of the floating base to dof velocity array directly.

参数:
  • data (SceneData) -- The scene data.

  • vel (NDArray[float]) -- The local angular velocity, the size is 3.

备注

This method only updates the dof velocity array.

set_global_linear_velocity(data, vel)#

Set the global linear velocity of the floating base to dof velocity array directly.

参数:
  • data (SceneData) -- The scene data.

  • vel (NDArray[float]) -- The world linear velocity, the size is 3.

备注

This method only updates the dof velocity array.

set_local_angular_velocity(data, vel)#

Set the local angular velocity of the floating base to dof velocity array directly.

参数:
  • data (SceneData) -- The scene data.

  • vel (List[float]) -- The local angular velocity, the size is 3.

备注

This method only updates the dof velocity array.

set_rotation(data, quat)#

Set the world rotation of the floating base.

参数:
  • data (SceneData) -- The scene data.

  • quat (NDArray[float]) -- The quaternion [i, j, k, w].

备注

This function only updates the DoF position of the floating base. The actual rotation is updated through the forward kinematic phase.

set_translation(data, translation)#

Set the world translation of the floating base.

参数:
  • data (SceneData) -- The scene data.

  • translation (List[float]) -- The translation [x, y, z].

备注

This function only updates the DoF position of the floating base. The actual translation is updated through the forward kinematic phase.

dof_pos_indices#

The DoF position indices of the floating base.

Return the indices of the 7 DoF positions.

Type:

List[int]

dof_pos_start#

The DoF position address of the floating base.

Return the starting index of the DoF positions.

Type:

int

dof_vel_indices#

The DoF velocity indices of the floating base.

Return the indices of the 6 DoF velocities.

Type:

List[int]

dof_vel_start#

The DoF velocity address of the floating base

Return the starting index of the DoF velocities.

Type:

int

name#

The name of the floating base.

Return None if not set.

Type:

Optional[str]

class motrixsim.Joint#

基类:object

The Joint object represents a joint in the scene.

This class provides access to the properties and state of a joint in the scene. It allows you to retrieve information about the joint's name, link index, number of DoF velocities and positions, and DoF velocity and position addresses.

Methods:

get_dof_pos(data)

Get the DoF positions of the joint.

get_dof_vel(data)

Get the DoF velocities of the joint.

set_dof_pos(data, position)

Set the DoF positions of the joint.

set_dof_vel(data, velocity)

Set the DoF velocities of the joint.

Attributes:

dof_pos_index

The position DoF address of the joint.

dof_vel_index

The velocity DoF address of the joint.

link_index

The index of the link this joint is attached to.

name

The name of the joint.

num_dof_pos

The number of position DoFs of the joint.

num_dof_vel

The number of velocity DoFs of the joint.

get_dof_pos(data)#

Get the DoF positions of the joint.

参数:

data (SceneData) -- The scene data.

返回:

The DoF positions.

返回类型:

NDArray[float]

get_dof_vel(data)#

Get the DoF velocities of the joint.

参数:

data (SceneData) -- The scene data.

返回:

The DoF velocities.

返回类型:

NDArray[float]

set_dof_pos(data, position)#

Set the DoF positions of the joint.

参数:
  • data (SceneData) -- The scene data.

  • position (NDArray[float]) -- The new DoF positions.

set_dof_vel(data, velocity)#

Set the DoF velocities of the joint.

参数:
  • data (SceneData) -- The scene data.

  • velocity (NDArray[float]) -- The new DoF velocities.

dof_pos_index#

The position DoF address of the joint.

Return the starting index of the position DoFs.

Type:

int

dof_vel_index#

The velocity DoF address of the joint.

Return the starting index of the velocity DoFs.

Type:

int

The index of the link this joint is attached to.

Type:

int

name#

The name of the joint.

Return the name of the joint, or None if not set.

Type:

Optional[str]

num_dof_pos#

The number of position DoFs of the joint.

Type:

int

num_dof_vel#

The number of velocity DoFs of the joint.

Type:

int

基类:object

The Link object represents a kinematic link in the scene.

This class provides access to the properties and state of a kinematic link in the scene. It allows you to retrieve information about the link's name, index, joint indices, number of joints, and the joints associated with the link.

Methods:

get_angular_velocity(data)

Get the world angular velocity of the link.

get_joint(index)

Get the joint at the specified index if the link has multiple joints.

get_linear_velocity(data)

Get the world linear velocity of the link.

get_pose(data)

Get the world pose of the link.

joints()

The joints associated with this link.

set_mass(mass)

Set the custom mass for a link.

Attributes:

index

The index of the link in the motrixsim.SceneModel.links().

joint_indices

The joint indices of this link in the motrixsim.SceneModel.joints().

model

The scene model that this link belongs to.

name

The name of the link.

num_joints

The number of joints associated with this link.

get_angular_velocity(data)#

Get the world angular velocity of the link.

参数:

data (SceneData) -- The scene data.

返回:

The angular velocity [wx, wy, wz].

返回类型:

NDArray[float]

get_joint(index)#

Get the joint at the specified index if the link has multiple joints.

参数:

index (int) -- The local index of the joint.

返回:

The joint object, or "None" if not found.

返回类型:

Optional[Joint]

get_linear_velocity(data)#

Get the world linear velocity of the link.

参数:

data (SceneData) -- The scene data.

返回:

The linear velocity [vx, vy, vz].

返回类型:

NDArray[float]

get_pose(data)#

Get the world pose of the link.

参数:

data (SceneData) -- The scene data.

返回:

The pose as a 7-element array [x, y, z, i, j, k, w].

返回类型:

NDArray[float]

joints()#

The joints associated with this link.

返回:

A list of joint objects.

返回类型:

List[Joint]

set_mass(mass)#

Set the custom mass for a link.

参数:

mass (Real) -- The new mass.

返回:

True if the set operation success. False if fail due to the setting opearation on a Mocap type link or an internal virtual link.

返回类型:

bool

index#

The index of the link in the motrixsim.SceneModel.links().

Type:

int

joint_indices#

The joint indices of this link in the motrixsim.SceneModel.joints().

返回:

The size of the list must be equal to num_joints()

返回类型:

List[int]

model#

The scene model that this link belongs to.

Type:

SceneModel

name#

The name of the link. Must be unique within the scene.

返回:

The name of the link, or "None" if not set.

返回类型:

Optional[str]

num_joints#

The number of joints associated with this link.

返回:

the number of joints associated with this link.

返回类型:

int

class motrixsim.Options#

基类:object

The Options object represents the simulation options.

This class is used to configure the simulation options. You can access it through model.options.

Attributes:

disable_contacts

Is all contact constraints disabled in the simulation?

disable_gravity

Is the gravity disabled in the simulation?

disable_impedance

Is impedance effects disabled in the simulation?

gravity

The gravity vector applied to the simulation.

max_iterations

The maximum number of iterations for the solver.

solver_tolerance

The tolerance for the solver.

timestep

The delta time for each simulation step.

disable_contacts#

Is all contact constraints disabled in the simulation?

Type:

bool

disable_gravity#

Is the gravity disabled in the simulation?

Type:

bool

disable_impedance#

Is impedance effects disabled in the simulation?

Type:

bool

gravity#

The gravity vector applied to the simulation.

A numpy array of shape (3,) or a list of three floats representing the gravity vector.

Type:

NDArray[float]

max_iterations#

The maximum number of iterations for the solver.

抛出:

ValueError -- The set max iterations is zero.

Type:

int

solver_tolerance#

The tolerance for the solver.

抛出:

ValueError -- The set tolerance is not positive.

Type:

float

timestep#

The delta time for each simulation step.

抛出:

ValueError -- The set timestep is not positive.

Type:

float

class motrixsim.SceneData(model)#

基类:object

The SceneData object represents the simulation state.

This class provides access to the dynamic state of the simulation, including joint positions, velocities, and other runtime data. Users can query or modify the simulation state, reset the scene to its initial state, and access low-level simulation data for advanced use cases. The state can be accessed via properties such as qpos, qvel, and via methods like reset(). For advanced control, the low property exposes the low-level data object.

Methods:

reset(model)

Reset the scene data with the given model.

Attributes:

actuator_ctrls

Get all the actuator control values.

dof_pos

The dof position array of the world.

dof_vel

The dof velocity array of the world.

low

The low-level data object for advanced simulation control.

reset(model)#

Reset the scene data with the given model.

Reinitializes all simulation state variables using the provided model.

参数:

model (SceneModel) -- The scene model to reset the data with.

actuator_ctrls#

Get all the actuator control values.

Array of actuator control values. Size matches the number of actuators in the model.

抛出:

TypeError -- If the input is not a list of floats or numpy array.

Type:

NDArray[float]

dof_pos#

The dof position array of the world.

Array of DoF positions. Size matches the number of position DoFs in the model.

Type:

NDArray[float]

dof_vel#

The dof velocity array of the world.

Array of DoF velocities. Size matches the number of velocity DoFs in the model.

Type:

NDArray[float]

low#

The low-level data object for advanced simulation control.

备注

Only modify the low-level data if you understand the implications. Incorrect modifications may lead to unstable simulation behavior.

Type:

LowData

class motrixsim.SceneModel#

基类:object

The SceneModel object represents the entire simulation world.

This class provides a high-level interface to access and manipulate the simulation world model, including all bodies, joints, actuators, links, and sites. Users can query the scene structure and configuration, modify simulation options, and access components through properties (joints, options) or methods (get_body(), get_sensor_values()).

Methods:

compute_init_dof_pos()

Compute the initial DoF positions for the world.

forward_kinematic(data)

Perform forward kinematic calculations using the current model and data.

get_actuator(arg)

Get an actuator by name or index.

get_actuator_ctrls(data)

Get all the actuator control values.

get_actuator_index(name)

Get actuator index by its name.

get_body(key)

Get a body by name or index.

get_body_index(name)

Get the body index by its name.

get_contact_query(data)

Get a contact query object for the current model and data.

get_geom_index(name)

Get the geometry index by its name.

get_joint(key)

Get a joint by name or index.

get_joint_index(name)

Get the joint index by its name.

get_link(arg)

Get a link by name or index.

get_link_index(name)

Get the link index by its name.

get_link_poses(data)

Get the world poses of all links.

get_sensor_value(id, data)

Get the value of a specific sensor by its ID.

get_sensor_values(data)

Get all sensor values in the world.

get_site(key)

Get a site by name or index.

get_site_index(name)

Get site index by name.

step(data)

Advance the simulation by one step using the current model and data.

Attributes:

actuator_ctrl_limits

The actuator control ranges.

actuator_names

The list of actuator names in the world.

actuators

Get all actuators defined in the model.

bodies

The list of all bodies in the world.

body_names

The list of all body names in the world.

cameras

All the cameras in the scene

joint_dof_pos_indices

The start dof index for each joint in the dof positions array.

joint_dof_pos_nums

The number of DoF positions for each joint.

joint_dof_vel_indices

The start dof index for each joint in the dof velocities array.

joint_dof_vel_nums

The size of DoF velocities of each joint.

joint_limits

The joint position limits for each joint.

joint_names

The list of all joint names in the world.

joints

The list of all joints in the world.

link_names

The list of all link names in the world.

links

The list of all links in the world.

low

The low-level model for advanced or internal simulation access.

num_actuators

The number of actuators in the world.

num_bodies

The number of bodies in the world.

num_dof_pos

The number of DoF positions in the world.

num_dof_vel

The number of DoF velocities in the world.

num_joints

The number of joints in the world.

num_links

The number of links in the world.

num_sensors

The number of sensors in the world.

num_sites

The number of sites in the world.

options

The simulation options of the model.

site_names

The list of all site names in the world.

sites

The list of all sites in the world.

compute_init_dof_pos()#

Compute the initial DoF positions for the world.

返回:

shape=(num_dof_pos,). Initial DoF positions.

返回类型:

NDArray[float]

forward_kinematic(data)#

Perform forward kinematic calculations using the current model and data.

备注

This method only updates the world poses of all links and bodies based on the current joint positions.

get_actuator(arg)#

Get an actuator by name or index.

参数:

key (str or int) -- Name or index of the actuator.

返回:

The actuator object, or None if not found.

返回类型:

Optional[Actuator]

get_actuator_ctrls(data)#

Get all the actuator control values.

参数:

data (SceneData) -- Scene data.

返回:

The actuator control values.

返回类型:

NDArray[float]

get_actuator_index(name)#

Get actuator index by its name.

参数:

name (str) -- Name of the actuator.

返回:

Index of the actuator, or None if not found.

返回类型:

Optional[int]

get_body(key)#

Get a body by name or index.

参数:

key (str or int) -- Name or index of the body.

返回:

The body object, or None if not found.

返回类型:

Optional[Body]

get_body_index(name)#

Get the body index by its name.

参数:

name (str) -- Name of the body.

返回:

Index of the body, or None if not found.

返回类型:

Optional[int]

get_contact_query(data)#

Get a contact query object for the current model and data.

参数:

data (SceneData) -- Scene data.

返回:

A contact query object that can be used to query contacts in the world.

返回类型:

ContactQuery

get_geom_index(name)#

Get the geometry index by its name.

参数:

name (str) -- Name of the geometry.

返回:

Index of the geometry, or None if not found.

返回类型:

Optional[int]

get_joint(key)#

Get a joint by name or index.

参数:

key (str or int) -- Name or index of the joint.

返回:

The joint object, or None if not found.

返回类型:

Optional[Joint]

get_joint_index(name)#

Get the joint index by its name.

参数:

name (str) -- Name of the joint.

返回:

Index of the joint, or None if not found.

返回类型:

Optional[int]

Get a link by name or index.

参数:

key (str or int) -- Name or index of the link.

返回:

The link object, or None if not found.

返回类型:

Optional[Link]

Get the link index by its name.

参数:

name (str) -- Name of the link.

返回:

Index of the link, or None if not found.

返回类型:

Optional[int]

Get the world poses of all links.

参数:

data (SceneData) -- Scene data.

返回:

A 2-dimensional numpy array with shape (num_links, 7). Each pose is composed of [x, y, z, i, j, k, w],

返回类型:

NDArray[float]

get_sensor_value(id, data)#

Get the value of a specific sensor by its ID.

参数:
  • id (str) -- Sensor ID.

  • data (SceneData) -- Scene data.

返回:

Sensor values.

返回类型:

NDArray[float]

get_sensor_values(data)#

Get all sensor values in the world.

参数:

data (SceneData) -- Scene data.

返回:

All sensor values.

返回类型:

NDarray[float]

get_site(key)#

Get a site by name or index.

参数:

key (str or int) -- Name or index of the site.

返回:

The site object, or None if not found.

返回类型:

Optional[Site]

get_site_index(name)#

Get site index by name.

参数:

name (str) -- Name of the site.

返回:

Index of the site, or None if not found.

返回类型:

Optional[int]

step(data)#

Advance the simulation by one step using the current model and data.

actuator_ctrl_limits#

The actuator control ranges.

Return a 2-dimensional numpy array with shape (2, num_actuators). The first dimension is the minimum control value, and the second dimension is the maximum control value. If the limits do not set for a actuator, (-inf, inf) will be used as the limits.

Type:

NDArray[float]

actuator_names#

The list of actuator names in the world.

Return list of actuator names, can be None if the actuator does not have a name.

Type:

List[Optional[str]]

actuators#

Get all actuators defined in the model.

返回:

A list of all actuator objects in the world.

返回类型:

List[Actuator]

bodies#

The list of all bodies in the world.

Type:

List[Body]

body_names#

The list of all body names in the world.

Return list of body names, can be None if the body does not have a name.

Type:

List[Optional[str]]

cameras#

All the cameras in the scene

joint_dof_pos_indices#

The start dof index for each joint in the dof positions array.

A list of start indices for each joint's dof positions in the dof positions array. size = num_joints.

备注

The DoF of floating base is not included.

Type:

List[int]

joint_dof_pos_nums#

The number of DoF positions for each joint.

List of position DoF sizes for each joint. size = num_joints

Type:

List[int]

joint_dof_vel_indices#

The start dof index for each joint in the dof velocities array.

A list of start indices for each joint's dof velocities in the dof velocities array.

备注

The DoF of floating base is not included.

Type:

List[int]

joint_dof_vel_nums#

The size of DoF velocities of each joint.

List of velocity DoF sizes for each joint. size = num_joints.

Type:

List[int]

joint_limits#

The joint position limits for each joint.

A 2-dimensional numpy array with shape (2, num_joints).

The first dimension is the minimum position limit, and the second dimension is the maximum position limit. If the limits are not set for a joint, -inf, inf will be used as the limits.

Type:

NDArray[float]

joint_names#

The list of all joint names in the world.

Return list of joint names, can be None if the joint does not have a name.

Type:

List[Optional[str]]

joints#

The list of all joints in the world.

Type:

List[Joint]

The list of all link names in the world.

A list of link names, can be None if the link does not have a name.

Type:

List[Optional[str]]

The list of all links in the world.

Type:

List[Link]

low#

The low-level model for advanced or internal simulation access.

This property exposes the underlying low-level scene model, which provides direct access to internal simulation data and advanced features.

备注

Do not use this property unless you know what you are doing.

Type:

LowSceneModel

num_actuators#

The number of actuators in the world.

Type:

int

num_bodies#

The number of bodies in the world.

Type:

int

num_dof_pos#

The number of DoF positions in the world.

Type:

int

num_dof_vel#

The number of DoF velocities in the world.

备注

This value may be different from the [num_dof_pos] because for some joint (like ball joint), we use Quaternion to represent the rotation, which has 4 components.

Type:

int

num_joints#

The number of joints in the world.

备注

freejoint in MJCF is not considered as a joint but a floating base.

Type:

int

The number of links in the world.

备注

The worldbody in MJCF is not considered as a link.

Type:

int

num_sensors#

The number of sensors in the world.

Type:

int

num_sites#

The number of sites in the world.

Type:

int

options#

The simulation options of the model.

Type:

Options

site_names#

The list of all site names in the world.

Type:

List[str]

sites#

The list of all sites in the world.

Return list of site objects.

Type:

List[Site]

class motrixsim.Site#

基类:object

The Site object represents a reference point or marker in the scene.

Methods:

get_pose(data)

Get the pose of the site in the world frame.

Attributes:

index

The index of the site in the site list.

local_pos

The local position of the site in the parent frame in (x, y, z).

local_quat

The local orientation of the site as a quaternion (i, j, k, w).

model

The model that this site belongs to.

name

The name of the site, or None if not set.

parent_link

The parent link of the site, or None if the site is attached to the world frame.

get_pose(data)#

Get the pose of the site in the world frame.

返回:

The pose of the site in the world frame as a 7-element array with [x,y, z, i, j, k, w].

返回类型:

NDArray[float]

index#

The index of the site in the site list.

Type:

int

local_pos#

The local position of the site in the parent frame in (x, y, z).

Type:

NDArray[float]

local_quat#

The local orientation of the site as a quaternion (i, j, k, w).

Type:

NDArray[float]

model#

The model that this site belongs to.

name#

The name of the site, or None if not set.

Type:

Optional[str]

The parent link of the site, or None if the site is attached to the world frame.

Type:

Link

motrixsim.forward_kinematic(model, data)#

Run forward kinematic only.

参数:
motrixsim.load_mjcf_str(mjcf)#

Load a model from a string containing MJCF data.

参数:

mjcf (str) -- The MJCF data as a string.

返回:

The loaded scene model.

返回类型:

SceneModel

motrixsim.load_model(path)#

Load a model from the given file path.

参数:
  • path (str) -- The path to the model file.

  • supported. (currently mjcf and urdf are)

返回:

The loaded scene model.

返回类型:

SceneModel

motrixsim.step(model, data)#

Advance the simulation by one step.

参数: