# robots

Robots: a structure with its dimensions, or a joint chain, with each axis's range, speed and acceleration, and the tool frame; named by a MOTION block's `robot`.

In the model file this key holds a list of `robot` entries, each named by its `name`.

## Typical uses

These sections describe things that move and the floor they move on. `network` is a path network of nodes and segments. `fleets` are pools of vehicles or workers that carry entities on it. `chargers` recharge batteries. `motion_profiles` and `zones` describe robots and their safety areas. Use them when distances and travel times matter.

## Behaviour and rules

Travel time is exact geometry: the shortest path on the network divided by the speed. A segment can limit the speed. The `length_factor` scales straight-line distances for a segment with no length of its own. A node is named by a STATION through its `node`.

A fleet is a resource under its own name. A TRANSPORT block requests one of its vehicles, which drives empty to the entity, loads, drives loaded to the destination and unloads. `dispatch` decides whose request is served when a vehicle frees, and `select` decides which idle vehicle serves it. With `park` set to `home`, an idle vehicle drives back to its `home` node.

A fleet with `kind` set to `worker` supplies people to PROCESS and SEIZE blocks through `worker_fleet`. A fleet with a `battery` drains it at its power draw and recharges at a charger when its job is done. A fleet with `motion` set to `gantry` ignores the network. A motion profile gives a robot its speed, acceleration, payload derating and a collaborative speed. A zone slows a robot to that speed when a worker is inside.

## Fields

| Field | Type | Required | Default | Unit | Description |
|---|---|---|---|---|---|
| `name` | string | yes |  |  | The robot's name, the `robot` of a MOTION block. |
| `description` | string |  |  |  | What the robot is; the run does not read it. |
| `structure` | choice | yes |  |  | The structure template, or "chain" for a robot given by its joints. One of `serial6`, `palletizer4`, `scara4`, `delta`, `gantry`, `serial7`, `chain`. |
| `params` | object |  |  |  | The template's dimensions in metres (a template names the ones it needs). |
| `joints` | list of object |  |  |  | With structure "chain" only: the serial joints at the zero pose, each {name, type: revolute\|prismatic, origin [m], axis, parent?, coupled?: {axis: factor}, passive?}. |
| `axes` | list of object | yes |  |  | One per actuated axis, in the template's order. |
| `tool` | object |  |  |  | The tool frame (TCP) from the flange. |
| `home` | list of number |  |  |  | The rest pose, one value per axis; all zeros clipped into range when absent. |
| `reach_m` | number or null |  |  | length | The datasheet reach in metres, for comparison. |
| `payload_max` | number or null |  |  | mass (`payload_unit`) | The rated payload; null or absent = no payload derating. |
| `payload_unit` | choice |  | `"kg"` |  | Unit `payload_max` is in. One of `base`, `g`, `kg`, `t`. |
| `payload_derate` | number or null |  | `1.0` | ratio | Axis speed fraction at payload_max, linear from 1.0 at 0 kg. |
| `tcp_speed` | number or null |  |  | speed (`speed_unit`) | Top tool speed along a straight-line move. |
| `speed_unit` | string |  | `"m/s"` |  | Unit `tcp_speed` is in. |
| `tcp_accel` | number or null |  |  |  | Top tool acceleration along a straight-line move, m/s^2. |
| `approximate` | boolean |  |  |  | True when the values are read from a public datasheet rather than the maker's model. |
| `source` | string |  |  |  | Where the values come from. |

A field of a nested object is described in the JSON Schema (`naga schema`).

## Example

```json
{"robots": [{"name": "Gantry", "structure": "gantry", "params": {"mount_height": 2.5}, "axes": [{"name": "x", "range": [0, 3], "speed": 1.0, "accel": 2.0}, {"name": "y", "range": [0, 2], "speed": 1.0, "accel": 2.0}, {"name": "z", "range": [0, 1], "speed": 0.5, "accel": 1.0}]}]}
```

In the Python builder:

```python
from nagasim import build as nb
m = nb.Model()
m.add_robot(name='Gantry', structure='gantry', params={'mount_height': 2.5}, axes=[{'name': 'x', 'range': [0, 3], 'speed': 1.0, 'accel': 2.0}, {'name': 'y', 'range': [0, 2], 'speed': 1.0, 'accel': 2.0}, {'name': 'z', 'range': [0, 1], 'speed': 0.5, 'accel': 1.0}])
```

## Used in

Bundled models: [Palletizing line](../../gallery/manufacturing.md).

Guides: [Motion cycles](../../modelling-guide/motion.md).

## See also

- [All sections](index.md), [Model file keys](../schema.md), [Model file format](../../model-file-format.md)
