> ## Documentation Index
> Fetch the complete documentation index at: https://docs.innate.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# Body Control Interfaces

export const HeadTiltAnglesTable = () => {
  const rows = [{
    angle: "-25deg",
    view: "Floor and objects below."
  }, {
    angle: "0deg",
    view: "Straight ahead."
  }, {
    angle: "+15deg",
    view: "Faces and shelves above."
  }];
  return <div className="interface-methods-table-wrap">
      <table className="interface-methods-table">
        <thead>
          <tr>
            <th>Angle</th>
            <th>View</th>
          </tr>
        </thead>
        <tbody>
          {rows.map(row => <tr key={row.angle}>
              <td>
                <span className="interface-param-badge">{row.angle}</span>
              </td>
              <td>{row.view}</td>
            </tr>)}
        </tbody>
      </table>
    </div>;
};

export const HeadInterfaceMethods = () => {
  const rows = [{
    method: "set_position()",
    params: [{
      name: "angle",
      type: "int"
    }],
    desc: "Set head tilt angle (from -25deg to +15deg)."
  }];
  return <div className="interface-methods-table-wrap">
      <table className="interface-methods-table">
        <thead>
          <tr>
            <th>Method</th>
            <th>Parameters</th>
            <th>Description</th>
          </tr>
        </thead>
        <tbody>
          {rows.map(row => <tr key={row.method}>
              <td>
                <span className="interface-method-pill">{row.method}</span>
              </td>
              <td>
                {row.params?.length ? <div className="interface-method-params">
                    {row.params.map(param => <span key={`${row.method}-${param.name}`} className="interface-param-badge">
                        {param.name}
                        {param.type ? <span className="interface-param-type">: {param.type}</span> : null}
                      </span>)}
                  </div> : <span className="interface-no-params">None</span>}
              </td>
              <td>{row.desc}</td>
            </tr>)}
        </tbody>
      </table>
    </div>;
};

export const ManipulationInterfaceMethods = () => {
  const rows = [{
    method: "move_to_cartesian_pose()",
    params: [{
      name: "x",
      type: "float"
    }, {
      name: "y",
      type: "float"
    }, {
      name: "z",
      type: "float"
    }, {
      name: "roll",
      type: "float"
    }, {
      name: "pitch",
      type: "float"
    }, {
      name: "yaw",
      type: "float"
    }, {
      name: "duration",
      type: "float (seconds)"
    }],
    desc: "Move the end-effector to a target Cartesian pose. duration is in seconds."
  }, {
    method: "goto_joint_state()",
    params: [{
      name: "joints",
      type: "list[float]"
    }],
    desc: "Move the arm to a target joint configuration (6 values)."
  }, {
    method: "get_current_orientation_rpy()",
    params: [],
    desc: "Get current end-effector orientation as roll/pitch/yaw values."
  }, {
    method: "get_current_end_effector_pose()",
    params: [],
    desc: "Get current end-effector pose (position + quaternion)."
  }, {
    method: "solve_ik()",
    params: [{
      name: "x",
      type: "float"
    }, {
      name: "y",
      type: "float"
    }, {
      name: "z",
      type: "float"
    }, {
      name: "roll",
      type: "float"
    }, {
      name: "pitch",
      type: "float"
    }, {
      name: "yaw",
      type: "float"
    }, {
      name: "timeout",
      type: "float"
    }],
    desc: "Solve inverse kinematics for a target pose without moving the arm."
  }];
  return <div className="interface-methods-table-wrap">
      <table className="interface-methods-table">
        <thead>
          <tr>
            <th>Method</th>
            <th>Parameters</th>
            <th>Description</th>
          </tr>
        </thead>
        <tbody>
          {rows.map(row => <tr key={row.method}>
              <td>
                <span className="interface-method-pill">{row.method}</span>
              </td>
              <td>
                {row.params?.length ? <div className="interface-method-params">
                    {row.params.map(param => <span key={`${row.method}-${param.name}`} className="interface-param-badge">
                        {param.name}
                        {param.type ? <span className="interface-param-type">: {param.type}</span> : null}
                      </span>)}
                  </div> : <span className="interface-no-params">None</span>}
              </td>
              <td>{row.desc}</td>
            </tr>)}
        </tbody>
      </table>
    </div>;
};

The `ManipulationInterface` and `HeadInterface` give you direct control over the robot's arm and head. Use these for manipulation tasks, gestures, and camera positioning.

## ManipulationInterface

Declare the interface at class level:

```python theme={null}
from brain_client.skill_types import Skill, Interface, InterfaceType

class MySkill(Skill):
    manipulation = Interface(InterfaceType.MANIPULATION)
```

### Methods

<ManipulationInterfaceMethods />

### Cartesian Control

Move the end-effector to a specific position and orientation:

```python theme={null}
# Move to position (x, y, z) with orientation (roll, pitch, yaw)
self.manipulation.move_to_cartesian_pose(
    x=0.2, y=0.0, z=0.3,
    roll=0.0, pitch=0.0, yaw=0.0,
    duration=2.0  # motion duration in seconds (not milliseconds)
)
```

### Joint Control

Move directly to joint angles (6 joints):

```python theme={null}
# Move to joint configuration [j1, j2, j3, j4, j5, j6]
self.manipulation.goto_joint_state([0, -0.5, 1.5, -1.0, 0, 0])
```

### Reading State

```python theme={null}
# Get current end-effector pose
pose = self.manipulation.get_current_end_effector_pose()
# Returns: {'position': [x, y, z], 'orientation': [qx, qy, qz, qw]}

# Get orientation as roll/pitch/yaw
rpy = self.manipulation.get_current_orientation_rpy()
# Returns: {'roll': r, 'pitch': p, 'yaw': y}
```

### Inverse Kinematics

Check if a pose is reachable before moving:

```python theme={null}
joints = self.manipulation.solve_ik(
    x=0.2, y=0.0, z=0.3,
    roll=0.0, pitch=0.0, yaw=0.0,
    timeout=1.0
)
if joints:
    self.manipulation.goto_joint_state(joints)
else:
    return "Pose unreachable", SkillResult.FAILURE
```

## HeadInterface

Control camera tilt:

```python theme={null}
from brain_client.skill_types import Skill, Interface, InterfaceType

class MySkill(Skill):
    head = Interface(InterfaceType.HEAD)
```

### Methods

<HeadInterfaceMethods />

### Tilt Angles

<HeadTiltAnglesTable />

```python theme={null}
self.head.set_position(-15)  # Look down at objects
self.head.set_position(0)    # Look straight ahead
self.head.set_position(10)   # Look up at faces
```

## Example: Wave

A skill that waves the arm:

```python theme={null}
from brain_client.skill_types import Skill, SkillResult, Interface, InterfaceType
import time

class Wave(Skill):
    manipulation = Interface(InterfaceType.MANIPULATION)

    @property
    def name(self):
        return "wave"

    def guidelines(self):
        return "Use to wave at someone in greeting."

    def execute(self, times: int = 3):
        # Wave positions
        wave_left = [0.5, -0.3, 1.0, -0.5, 0.5, 0]
        wave_right = [0.5, -0.3, 1.0, -0.5, -0.5, 0]

        for i in range(times):
            if self._cancelled:
                return "Wave cancelled", SkillResult.CANCELLED

            self.manipulation.goto_joint_state(wave_left)
            time.sleep(0.3)
            self.manipulation.goto_joint_state(wave_right)
            time.sleep(0.3)

        return f"Waved {times} times", SkillResult.SUCCESS

    def cancel(self):
        self._cancelled = True
        return "Wave cancelled"
```

## Example: LookAtObject

A skill that adjusts head to look at objects:

```python theme={null}
from brain_client.skill_types import Skill, SkillResult, Interface, InterfaceType

class LookAtObject(Skill):
    head = Interface(InterfaceType.HEAD)

    @property
    def name(self):
        return "look_at_object"

    def guidelines(self):
        return "Use to tilt camera to look at objects on the floor or shelves."

    def execute(self, location: str = "floor"):
        angles = {
            "floor": -25,
            "table": -10,
            "ahead": 0,
            "face": 10,
            "shelf": 15
        }

        angle = angles.get(location, 0)
        self.head.set_position(angle)

        return f"Looking at {location}", SkillResult.SUCCESS

    def cancel(self):
        return "Cannot cancel head movement"
```
