# Mechanism and motion simulation

Ask Adam to build a MuJoCo model of a mechanism when the question is about motion: whether a linkage reaches its travel, how an actuated joint responds, or how parts settle under gravity and contact. For stress use [structural analysis](/cae/structural-analysis); for flow use [fluid analysis](/cae/fluid-analysis).

MuJoCo runs in Adam's task environment. You do not need a desktop simulator or another connection.

## Give Adam the physical facts

A STEP file describes shape. It does not say which parts move or how. Supply the facts of the machine, and ask Adam to label anything it assumes.

| Adam needs | Examples |
| --- | --- |
| Geometry and units | The CAD model, in the task or a connected application |
| Mass | A measured mass for each body, or a stated material density |
| Joints | Type, axis, anchor point, and travel limits |
| Actuators | Which joints are driven, and their torque or force limits |
| Contact | Which surfaces touch, and a friction value with its source |

```text
Build a MuJoCo model of [mechanism] from the attached CAD. Use these joints: [joint, axis, limits]. Body masses are [values or material density]. Drive [joint] with an actuator limited to [torque or force]. List every value you assumed, including friction, damping, and collision shapes. Check that the model compiles and that [quantity] stays within [tolerance], then show me the simulation.
```

Collision shapes are simplified by default, which fills holes and concave regions. For grippers, insertion, or other contact inside a concave shape, ask Adam to model the contact surfaces explicitly.

## Run the simulation

Adam saves the model as an `.mjcf` file. Select it in the task to open the simulation pane, then select **Start simulation**.

| Control | What it does |
| --- | --- |
| **Play**, **Pause**, **Step**, **Reset** | Run the model, advance it one step at a time, or return to the start |
| Actuator controls | Drive each actuator within its limits while the model runs |
| Timeline and playback speed | Move through the recorded motion |
| Collision geometry | Show the collision shapes, which are hidden at first |
| **Send frame to chat** | Attach the current joint state, contacts, and a picture to your next message |
| **Save replay** | Download the recording to your computer as a `.mujoco.json` file |

A replay opens without starting a new simulation. To let a teammate review the same motion, add the downloaded file to the task.

A model has to be saved in a task before it can run. An attachment that is not saved to a task opens as readable source instead. Material colors are shown; texture images are not.

## Check the result

A model that compiles and runs is only the first check. Before using the motion for a design decision, ask Adam to:

- exercise the intended controls and report warnings from the solver;
- report contact penetration, drift, settling, or tracking error against your tolerances; and
- record mass, density, friction, damping, and actuator limits with their sources.

Use **Send frame to chat** to point Adam at the moment that looks wrong, such as a part passing through another.

## If the simulation does not start

- **The pane asks you to open the model from a task:** save the file to a task first, then open it there.
- **The simulation ended:** select **Start simulation** again. A running simulation has a time limit and ends by itself.
- **A referenced mesh or include is missing:** ask Adam to publish the referenced files in the same task as the model.
- **The replay cannot be saved:** record a shorter run.

For solver and setup problems in other analyses, see [simulation troubleshooting](/cae/troubleshooting).
