> For the complete documentation index, see [llms.txt](https://doc.ancoraspring.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ancoraspring.com/asmagic/sensors-and-simulation/astriad.md).

# asTriad — Coordinate Frames

Coordinate frames for MuJoCo scenes and dimensioned STL models.

asTriad renders visual coordinate frames in MuJoCo and exports MJCF and STL models. The sphere center is the origin; red **X**, green **Y** and blue **Z** arrows show the positive local directions.

{% hint style="info" %}
[**Online generator**](https://ancoraspring.com/astriad/): set **Sphere diameter** in millimeters, then choose **Download STL** or **Download MJCF**.
{% endhint %}

<figure><img src="https://3069436181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTOs5tBJUyhQCv2lbX6A%2Fuploads%2Fgit-blob-2c343273f800da3304b369f174d7462d0c789f41%2FasTriad-size-control.gif?alt=media" alt="MuJoCo coordinate frame resizing as the sphere diameter slider changes"><figcaption><p>Native MuJoCo viewer.</p></figcaption></figure>

## Open in MuJoCo Live

Open [MuJoCo Live](https://live.mujoco.org/), then drop the sample XML onto the canvas:

{% file src="/files/N8F3h6cgaYw3X39Vd180" %}
asTriad MJCF component, 20 mm sphere diameter.
{% endfile %}

In **View → Editor**, select geometry and edit its numeric fields, then choose **Compile and Reload**. To scale the whole frame, [export XML with the desired sphere diameter](https://doc.ancoraspring.com/asmagic/sensors-and-simulation/astriad/simulation.md#open-in-mujoco-live).

The XML also opens in local MuJoCo 3.3.7 or 4.0:

```bash
python -m mujoco.viewer --mjcf asTriad_20mm.xml
```

## Use in a robot scene

Attach the exported XML to a body or named site in your existing scene. The frame follows that part of the robot. See [XML composition and Python attachment](https://doc.ancoraspring.com/asmagic/sensors-and-simulation/astriad/simulation.md#attach-to-an-existing-scene), then run the [UR5e robot experiments](https://doc.ancoraspring.com/asmagic/sensors-and-simulation/astriad/examples.md).

## Dimensions

`size` supplies the sphere diameter **D in millimeters**, the only independent geometric size parameter. Every component length is a fixed multiple of D. The sphere center is the shared local origin **O = (0, 0, 0)**; X, Y and Z form a right-handed frame and point in their positive directions.

```python
from asTriad import AsTriad

frame = AsTriad(size=20)
```

For each axis, measure local distance from O along that axis:

| Component         | Local position                            | Dimensions                                        |
| ----------------- | ----------------------------------------- | ------------------------------------------------- |
| Origin sphere     | Center at O                               | Radius 0.5D                                       |
| Cylindrical shaft | Starts at 0, ends at 3.2D; center at 1.6D | Length 3.2D; radius 0.18D, diameter 0.36D         |
| Cone head         | Base center at 3.2D; tip at 4D            | Height 0.8D; base radius 0.4D, base diameter 0.8D |

<figure><img src="https://3069436181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiTOs5tBJUyhQCv2lbX6A%2Fuploads%2Fgit-blob-895bf2fe3b114967fed47ed9ae2ed44cdde3cdca%2FasTriad-dimensions.png?alt=media" alt="Engineering dimensions of the origin sphere, cylindrical shaft and cone head, all defined from sphere diameter D"><figcaption><p>Local geometry and engineering dimensions. D is the sphere diameter.</p></figcaption></figure>

At D = 20 mm, the sphere radius is 10 mm, the shaft is 64 mm long with a 3.6 mm radius, and the cone height and base diameter are both 16 mm. Each arrow reaches 80 mm from O; the full XYZ model measures 90 × 90 × 90 mm.

### Pose and units

`position` places the sphere center in world coordinates, in meters. `rotation` sets the axis directions. For attachments, `offset` and `rotation` use the target's local coordinates.

Let d = D/1000 meters, O be the sphere center in world coordinates, and R map local axes into world axes. The centerline of axis i is

$$
\mathbf q\_i(t)=\mathbf O+R(t\mathbf e\_i),\qquad 0\le t\le4d.
$$

`e_i` is the local unit vector for X, Y or Z. The shaft spans 0 to 3.2d, and the cone spans 3.2d to 4d.

## Usage

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Use in an existing scene</strong></td><td>Attach XML to a robot, or add frames to a Python rendering loop.</td><td><a href="https://doc.ancoraspring.com/asmagic/sensors-and-simulation/astriad/simulation.md">Place and Attach Frames</a></td></tr><tr><td><strong>Install the viewer</strong></td><td>Adjust the diameter and select visible axes.</td><td><a href="https://doc.ancoraspring.com/asmagic/sensors-and-simulation/astriad/quick-start.md">Install and Use the Viewer</a></td></tr><tr><td><strong>Export for printing</strong></td><td>Create a connected STL with physical dimensions.</td><td><a href="https://doc.ancoraspring.com/asmagic/sensors-and-simulation/astriad/printing.md">Export for 3D Printing</a></td></tr></tbody></table>

[Source repository](https://github.com/asMagicApp/asTraid) · [Release files](https://github.com/asMagicApp/asTraid/releases/tag/v0.10.0) · [Python API reference](https://github.com/asMagicApp/asTraid/blob/v0.10.0/docs/api.md)

This guide describes **asTriad 0.10.0**.
