> For the complete documentation index, see [llms.txt](https://hackerbot-industries.gitbook.io/documentation-hackerbot-industries/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hackerbot-industries.gitbook.io/documentation-hackerbot-industries/firmware/serial-commands.md).

# Serial Commands

Supported Boards (Main Controller = MC, Dynamixel Controller = DC, Audio/Mouth/Eyes = AME, Arm Controller = AC, Eyes = E)

> **Important**: You must run the `B_INIT` command to initiate a handshake between the Main Controller and the SLAM base robot before sending any other commands to the base. If the base is rebooted, `B_INIT` must be sent again.

***

### 🔧 System & Setup Commands

#### PING

* **Boards**: MC, DC, AME, AC
* **JSON**: ✅
* **Description**: Pings all attached boards and returns which ones are connected.
* **Usage**: `PING`

#### VERSION

* **Boards**: MC, DC, AME, AC
* **JSON**: ✅
* **Description**: Reports firmware versions. On MC, it also reports versions for all connected boards.
* **Usage**: `VERSION`

#### JSON,enabled

* **Boards**: MC
* **JSON**: ✅
* **Description**: Enables/disables JSON formatted responses for easier parsing.
* **Usage**: `JSON,1`
* **Params**:
  * `enabled`: `0` = Off, `1` = On (default off)

#### TOFS,enabled

* **Boards**: MC
* **JSON**: ✅
* **Description**: Enables/disables Time-of-Flight (ToF) object avoidance.
* **Usage**: `TOFS,0`
* **Params**:
  * `enabled`: `0` = Off, `1` = On (default)

***

### 🤖 SLAM Base Commands

#### B\_INIT

* **Boards**: MC
* **JSON**: ❌
* **Description**: Initializes handshake with SLAM base (must be sent once per power cycle).
* **Usage**: `B_INIT`

#### B\_MODE,mode

* **Boards**: MC
* **JSON**: ❌
* **Description**: Sets base mode. (Untested; report findings on Discord.)
* **Usage**: `B_MODE,11`
* **Params**: `mode` = 0..12

#### B\_START

* **Boards**: MC
* **JSON**: ❌
* **Description**: Wakes robot, undocks, and starts LiDAR.
* **Usage**: `B_START`

#### B\_QUICKMAP

* **Boards**: MC
* **JSON**: ❌
* **Description**: Starts quick mapping (may not save map).
* **Usage**: `B_QUICKMAP`

#### B\_GOTO,x,y,angle,speed

* **Boards**: MC
* **JSON**: ❌
* **Description**: Drives robot to a specified pose on an existing map.
* **Usage**: `B_GOTO,0.5,-1,0,0.1`
* **Params**:
  * `x`, `y`: in meters
  * `angle`: in degrees
  * `speed`: in m/s (e.g., 0.1)

#### B\_DOCK

* **Boards**: MC
* **JSON**: ❌
* **Description**: Sends robot to charging dock.
* **Usage**: `B_DOCK`

#### B\_KILL

* **Boards**: MC
* **JSON**: ❌
* **Description**: Unknown effect (untested).
* **Usage**: `B_KILL`

#### B\_BUMP,left,right

* **Boards**: MC
* **JSON**: ✅
* **Description**: Simulates bump sensor triggers.
* **Usage**: `B_BUMP,1,1`
* **Params**:
  * `left`, `right`: `0` = No bump, `1` = Triggered

#### B\_DRIVE,linear\_velocity,angular\_velocity

* **Boards**: MC
* **JSON**: ✅
* **Description**: Direct drive control of base.
* **Usage**: `B_DRIVE,-50,0`
* **Params**:
  * `linear_velocity`: mm/s
  * `angular_velocity`: degrees/s

#### B\_MAPLIST

* **Boards**: MC
* **JSON**: ✅
* **Description**: Lists stored maps and their IDs.
* **Usage**: `B_MAPLIST`

#### B\_MAPDATA,map\_id

* **Boards**: MC
* **JSON**: ✅
* **Description**: Returns lz4-compressed map data.
* **Usage**: `B_MAPDATA,10`
* **Params**: `map_id`

#### B\_STATUS

* **Boards**: MC
* **JSON**: ✅
* **Description**: Returns current base status packet.
* **Usage**: `B_STATUS`

#### B\_POSE

* **Boards**: MC
* **JSON**: ✅
* **Description**: Reports robot's current pose after localization.
* **Usage**: `B_POSE`

***

### 🧠 Head Commands (AI Pro / Elite)

#### H\_IDLE,enabled

* **Boards**: MC, DC
* **JSON**: ❌
* **Description**: Enables/disables head idle animation.
* **Usage**: `H_IDLE,0`
* **Params**: `enabled` = 0 = Off, 1 = On

#### H\_LOOK,yaw,pitch,speed

* **Boards**: MC, DC
* **JSON**: ❌
* **Description**: Sets head yaw/pitch; disables IDLE.
* **Usage**: `H_LOOK,180.0,180.0,10`
* **Params**:
  * `yaw`: degrees (100.0–260.0)
  * `pitch`: degrees (150.0–250.0)
  * `speed`: 6–70

#### H\_GAZE,x,y

* **Boards**: MC, AME, E
* **JSON**: ❌
* **Description**: Controls gaze direction on LCD eyes.
* **Usage**: `H_GAZE,0,-0.36`
* **Params**:
  * `x`, `y`: -1.0 to 1.0

***

### 🤖 Arm Commands (AI Elite)

#### A\_CAL

* **Boards**: MC, AC
* **JSON**: ❌
* **Description**: Calibrates the gripper's closed position.
* **Usage**: `A_CAL`

#### A\_OPEN

* **Boards**: MC, AC
* **JSON**: ❌
* **Description**: Fully opens the gripper.
* **Usage**: `A_OPEN`

#### A\_CLOSE

* **Boards**: MC, AC
* **JSON**: ❌
* **Description**: Closes the gripper until resistance or fully closed.
* **Usage**: `A_CLOSE`

#### A\_ANGLE,joint,angle,speed

* **Boards**: MC, AC
* **JSON**: ❌
* **Description**: Sets a single joint's angle.
* **Usage**: `A_ANGLE,6,-30.0,20`
* **Params**:
  * `joint`: 1–6
  * `angle`: degrees
  * `speed`: 0–100

#### A\_ANGLES,j1,j2,j3,j4,j5,j6,speed

* **Boards**: MC, AC
* **JSON**: ❌
* **Description**: Sets all joint angles at once.
* **Usage**: `A_ANGLES,0,0,0,0,0,0,30`
* **Params**:
  * `j1..j6`: degrees (range: -165.0 to 165.0, joint 6 up to 175.0)
  * `speed`: 0–100
