πŸš€ API Quick Reference#

πŸ“‹ Core Module - motrixsim#

Function Category

API

Description

Model Loading

load_model(path)

Load MJCF/URDF model files

Simulation Step

step(model, data)

Execute a single simulation time step

Kinematics

forward_kinematic(model, data)

Perform forward kinematics computation

πŸ”§ Core Objects#

Object

Type

Usage Description

SceneModel

Model

Static simulation world description, including robot geometry, joints, and sensor definitions

SceneData

Data

Dynamic simulation state, storing real-time data such as positions and velocities

Options

Config

Simulation parameter settings, controlling integrator and solver parameters


πŸ” Named Access - Model Component Access#

MotrixSim provides convenient named access interfaces for model components, supporting direct access and manipulation of various components by name or index.

πŸ”§ Access Methods#

MotrixSim’s Named Access supports two access methods:

  • Access by name: model.get_body("my_body")

  • Access by index: model.get_body(0)

Each component access method returns the corresponding component object, providing its properties and methods.

🎯 Model Components#

Component

Access Method

Returned Object Functionality

Index Query Method

Body

model.get_body(name/id)

Get rigid body pose, DoF state

get_body_index(name)

Link

model.get_link(name/id)

Get link pose, velocity

get_link_index(name)

Joint

model.get_joint(name/id)

Set/get joint position, velocity

get_joint_index(name)

Site

model.get_site(name/id)

Get site position, orientation

get_site_index(name)

Sensor

model.get_sensor_value(id, data)

Read sensor data

-

Actuator

model.get_actuator(name/id)

Set actuator control, limits

get_actuator_index(name)

πŸ”’ Batch Access#

API

Type

Description

model.get_actuator_ctrls(data)

ndarray

Get all actuator control values

model.get_link_poses(data)

ndarray

Get positions and orientations of all links

model.bodies

List[Body]

List of all body objects

model.links

List[Link]

List of all link objects

model.joints

List[Joint]

List of all joint objects

model.sites

List[Site]

List of all site objects


πŸ“Š SceneData - State Data#

Property/Method

Type

Description

data.dof_pos

ndarray

DoF position array

data.dof_vel

ndarray

DoF velocity array

data.actuator_ctrls

ndarray

Set/get actuator control values

data.reset(model)

-

Reset scene data state

data.low

LowData

Low-level data object (contact info, etc.)


πŸ”¨ Model Building Module - motrixsim.msd#

Function/Method

Description

msd.from_file(path)

Load model file for combining and building

scene.attach(other, ...)

Attach another model with transform and prefix

scene.build()

Build the final SceneModel for simulation


🎨 Rendering Module - motrixsim.render#

Object/Class

Category

Main Functionality

RenderApp

Main Renderer

Model loading, scene synchronization

RenderGizmos

Gizmo Drawing

Drawing spheres, cubes, etc.

RenderUI

User Interface

Buttons, switches, controls

Input

Input Handler

Keyboard, mouse, ray detection