> Documentation index: https://nao-rs.lukaloehr.com/llms.txt, a list of every page in this documentation.

# Quick start

> From a NAO6 running HULKs-OS 9.0.1 to nao-rs on its own drivers, checked with naoctl.

This page takes a NAO6 that already runs HULKs-OS 9.0.1 to nao-rs. If your
robot still runs NAOqi, flash HULKs-OS first: [Install, flash and
rollback](https://nao-rs.lukaloehr.com/get-started/install.md#flash-hulks-os) shows how.

> **Warning:** Before you start
>
> Put the robot down sitting or lying, with room around it. nao-rs doesn't
> command the motors yet, so every joint goes limp when it takes over. A
> standing robot falls.

## What you need

- A **NAO6** on HULKs-OS 9.0.1, reachable over Ethernet or Wi-Fi, with the
  default `nao` user (password `nao`).
- A checkout of the **nao-rs** repository
  ([github.com/luka-loehr/nao-rs](https://github.com/luka-loehr/nao-rs), branch
  `main`) with the **nao-rs drivers** linked into it as `./drivers`, and Rust
  installed. The drivers are not public yet, and prebuilt bundles are
  **planned**; today you build the bundle yourself.
- An **x86_64 Linux machine with Docker** for the robot build. The build runs
  in HULKs' NAO SDK container (`ghcr.io/hulks/naosdk:9.0.1`).

## Install

### 1. Build the robot bundle

In the nao-rs checkout, with `<host>` being your Linux build machine (an SSH
host name):

```bash
cargo nao-rs robot build --host <host>
```

This copies the sources to `<host>`, builds `hulk`, `nao-rs-guard` and
`naoctl` for the robot and fetches `dist/nao-rs-robot.tar.gz`.

### 2. Install it on the robot

```bash
cargo nao-rs robot install <robot-address>
```

The bundle is streamed to the robot over SSH and the installer on the robot
takes over: it keeps the running installation, stops and masks HAL, LoLA and
HULA, installs the guard and the `hulk` unit for the nao-rs drivers, and
checks for 30 seconds that the runtime is up and beating. If that check fails,
it puts the previous installation back by itself. Details in [Install, flash
and rollback](https://nao-rs.lukaloehr.com/get-started/install.md).

### 3. Check the death switch

```bash
ssh nao@<robot-address>
/home/nao/hulk/bin/naoctl status
```

A healthy robot prints the switch state and a heartbeat a few milliseconds
old, for example:

```text
TRIPPED (Cli) for 12.4 s: all motors off
driver: pid 812, cycle 1033, last beat 3.1 ms ago, last all-off cycle 1033
```

The switch starts **tripped** on every new page, so the motors stay off until a
person re-arms it. While nao-rs rejects the version 11 motor boards, re-arming
changes nothing on the motors; leave it tripped.

### 4. Stop it from your computer

From the nao-rs checkout on your computer:

```bash
cargo nao-rs stop <robot-address>
```

This sends the stop datagram to the guard on UDP port 7701. It works even when
the runtime is stuck. See [Safety model](https://nao-rs.lukaloehr.com/safety.md) for every other way to stop.

## Reach it

After the install, nao-rs owns the wired port: the robot takes an address by
DHCP, and also always answers at `172.28.28.28` on a direct cable (give your
computer `172.28.28.1/24`). See [Network](https://nao-rs.lukaloehr.com/get-started/install.md#network).

| Interface | Address |
| --- | --- |
| [REST API](https://nao-rs.lukaloehr.com/reference/rest-api.md) | `http://<robot-address>:7702/v1`, token in `~/.config/nao-rs/rest-token` on the robot |
| [Robot API](https://nao-rs.lukaloehr.com/reference/api.md) (the brain) | `<robot-address>:7700` |
| UDP stop | `<robot-address>:7701` |

```bash
TOKEN=$(ssh nao@<robot-address> cat .config/nao-rs/rest-token)
curl -H "Authorization: Bearer $TOKEN" http://<robot-address>:7702/v1/safety
```

To talk with the robot, set up [the brain](https://nao-rs.lukaloehr.com/brain.md) with your own ElevenLabs
agent:

```bash
cargo brain --robot <robot-address>:7700 --agent-id <agent-id>
```

## Go back

```bash
cargo nao-rs robot restore <robot-address>
```

This removes the guard and the nao-rs units, unmasks HAL, LoLA and HULA and
starts them again in order.

## Related topics

- [What nao-rs is](https://nao-rs.lukaloehr.com/get-started.md)
- [Install, flash and rollback](https://nao-rs.lukaloehr.com/get-started/install.md)
- [What the robot says](https://nao-rs.lukaloehr.com/get-started/voice.md)
- Previous: [What nao-rs is](https://nao-rs.lukaloehr.com/get-started.md)
- Next: [Install, flash and rollback](https://nao-rs.lukaloehr.com/get-started/install.md)
