# Motion Routes

{% hint style="info" %}
For all headers refer to [Overview](https://axibo-support.gitbook.io/axibo-docs/axibo-rest-api-work-in-progress/overview) --> Headers
{% endhint %}

### Configure Motion Request

The purpose of this request is to configure the AXIBO axis.&#x20;

#### Endpoint

```url
PUT http://<axibo-ip>:2200/v1/direct-control/config
```

#### Body Properties

| Property                        | Type   | Required | Description                                          |
| ------------------------------- | ------ | -------- | ---------------------------------------------------- |
| `tilt, pan, slide, focus, zoom` | string | Yes      | The axis that will have their configuration set.     |
| `accel`                         | int    | No       | Sets the axis acceleration.                          |
| `current`                       | int    | No       | Sets the current that is being supplied to the axis. |
| `maxPos`                        | int    | Yes      | Sets the maximum position of the set axis.           |
| `minPos`                        | int    | Yes      | Sets the minimum position of the set axis.           |
| `maxVel`                        | int    | Yes      | Sets the maximum velocity of the set axis.           |
| `speed`                         | int    | Yes      | Sets the speed of the axis.                          |

#### Example (PUT)

```json
{
    "slide": {
        "accel": 1,
        "current": 12,
        "maxPos": 150,
        "maxVel": 40,
        "minPos": -150,
        "speed": 10
    },
    "pan": {
        "accel": 1,
        "current": 10,
        "maxPos": 100,
        "maxVel": 40,
        "minPos": -100,
        "speed": 8
    }
}
```

### Motors Homing Request

The purpose of this request is to configure the AXIBO axis for homing.&#x20;

#### Endpoint&#x20;

```uri
PUT http://<axibo-ip>:2200/v1/direct-control/home
```

#### Body Properties

| Property                        | Type   | Required | Description                                                                 |
| ------------------------------- | ------ | -------- | --------------------------------------------------------------------------- |
| `tilt, pan, slide, focus, zoom` | string | Yes      | The axis that will have their configuration set.                            |
| `direction`                     |        |          |                                                                             |
| `homingSpeed`                   | int    | Yes      | Set the homing speed of the axis.                                           |
| `maxPos`                        | int    | Yes      | Set the max position the axis will home too.                                |
| `minPos`                        | int    | Yes      | Set the min position the axis will home too.                                |
| `useTorque`                     | int    | No       | Select if the axis is in **high speed** or **high torque** mode for homing. |

#### Example (PUT)

```json
{
  "pan": {
    "direction": 0,
    "homingSpeed": 40,
    "maxPos": 10,
    "minPos": -10,
    "useTorque": 0
  },
  "tilt": {
    "direction": 0,
    "homingSpeed": 40,
    "maxPos": 10,
    "minPos": -10,
    "useTorque": 0
  },
  "slide": {
    "direction": 0,
    "homingSpeed": 10
  }
}
```

### Switch Modes Request

The purpose of this request is to switch the operating mode of the AXIBO axis.&#x20;

#### Endpoint

```url
PUT http://<axibo-ip>:2200/v1/direct-control/switch-mode
```

#### Body Properties

| Property | Type   | Required | Description                                                            |
| -------- | ------ | -------- | ---------------------------------------------------------------------- |
| mode     | string | Yes      | Sets the axis to either be in **"highspeed"** or **"hightorque"** mode |

#### Example (PUT)

```json
{
    "mode":"highspeed"
}
```

### Packet Confirmation Request

The purpose of this request is to set the packet confirmation of the AXIBO.

#### Endpoint

```uri
PUT http://<axibo-ip>:2200/v1/direct-control/packet-confirmation
```

#### Body Properties

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |
| mode     | int  | Yes      |             |

#### Example (PUT)

```json
{
    "mode": 1
}
```

### Move Absolute Request

The purpose of this request is to set the speed and position as well as move the AXIBO absolutely.&#x20;

#### Endpoint

```uri
PUT http://{axibo-ip}:2200/v1/direct-control/move-absolute
```

#### Body Properties

| Property                        | Type                    | Required | Description                                                                  |
| ------------------------------- | ----------------------- | -------- | ---------------------------------------------------------------------------- |
| `tilt, pan, slide, focus, zoom` | Array\<Position, Speed> | Yes      | Set the how far and how fast the AXIBO will move from its **absolute** axis. |

#### Example (PUT)

```json
{ 
    "tilt":[0,5],
    "pan":[0,5], 
    "slide":[0,5]
}
```

### Move Relative Request

The purpose of this request is to set the speed and position as well as move the AXIBO relatively.

#### Endpoint

```uri
PUT http://<axibo-ip>:2200/v1/direct-control/move-relative
```

#### Body Properties

| Property                        | Type                    | Required | Description                                                                  |
| ------------------------------- | ----------------------- | -------- | ---------------------------------------------------------------------------- |
| `tilt, pan, slide, focus, zoom` | Array\<Position, Speed> | Yes      | Set the how far and how fast the AXIBO will move from its **relative** axis. |

#### Example (PUT)

```json
{ 
    "tilt":[0,5],
    "zoom":[0,5], 
    "focus":[0,5]
}
```

### Trigger Control Request

The purpose of this request is to set the trigger control of the AXIBO and HDMI camera.

#### Endpoint

```json
PUT http://{axibo-ip}:2200/v1/direct-control/trigger
```

#### Body Properties

| Properties    | Type | Required | Description |
| ------------- | ---- | -------- | ----------- |
| `trigCase`    | int  |          |             |
| `timeSpacing` | int  |          |             |
| `pauseAmount` | int  |          |             |
| `count`       | int  |          |             |
| `bulb`        | int  |          |             |
| `focus`       | int  |          |             |

#### Example (PUT)

```json
{
    "trigCase":0,
    "timeSpacing":5000,
    "pauseAmount":5000,
    "count":10, 
    "bulb":0.1,
    "focus": 0
}
```

### Stop Motion Request

The purpose of this request is to stop all current AXIBO motion.

#### Endpoint&#x20;

```uri
PUT http://{axibo-ip}:2200/v1/direct-control/stop-motion
```

#### Body Properties

No body properties. PUT the request to stop all motion.

#### Example (PUT)

```json
{
    "status": 200,
    "message": "success"
}
```

### Motion Status Request

This requests it meant to receive the motion status of the AXIBO.&#x20;

#### Endpoint

```uri
GET http://{axibo-ip}:2200/v1/direct-control/trigger
```

#### Example (GET)&#x20;

```json
{
    "panHomed": 0,
    "tiltHomed": 0,
    "panPos": 0.27,
    "tiltPos": -0.68
}
```

### Config Hardware Request

This requests it meant to receive the hardware configuration of the AXIBO.&#x20;

#### Endpoint

```uri
GET http://{axibo-ip}:2200/v1/direct-control/hardware-config
```

#### Example (GET)&#x20;

```json
{
    "homeOnBoot": 0,
    "P_pan": 0,
    "I_pan": 0,
    "D_pan": 0,
    "ROI_pan": 0,
    "P_til": 0,
    "I_til": 0,
    "D_til": 0,
    "ROI_til": 0,
    "xTarget": 0,
    "yTarget": 0
}
```
