Skip to main content
Complete examples of skills that combine navigation, manipulation, and sensor data to create full-body robot behaviors.

ScanAndWave

Rotate to find a person, then wave:
from brain_client.skill_types import (
    Skill, SkillResult, Interface, InterfaceType, RobotState, RobotStateType
)
import math

class ScanAndWave(Skill):
    """Rotate to scan for people, then wave when found."""

    mobility = Interface(InterfaceType.MOBILITY)
    manipulation = Interface(InterfaceType.MANIPULATION)
    head = Interface(InterfaceType.HEAD)
    image = RobotState(RobotStateType.LAST_MAIN_CAMERA_IMAGE_B64)

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

    def guidelines(self):
        return "Use when greeting someone in the room."

    def execute(self):
        self._cancelled = False

        # Look up to see faces
        self.head.set_position(10)

        # Scan 360 degrees
        for i in range(8):
            if self._cancelled:
                return "Cancelled", SkillResult.CANCELLED

            self._send_feedback(f"Scanning direction {i+1}/8")

            if self.image:
                # Check for person (simplified - use vision API in practice)
                person_detected = self._detect_person(self.image)
                if person_detected:
                    self._wave()
                    return "Found person and waved", SkillResult.SUCCESS

            self.mobility.rotate(math.pi / 4)

        return "No person found", SkillResult.SUCCESS

    def _detect_person(self, image):
        # Placeholder - integrate with vision API
        return False

    def _wave(self):
        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 _ in range(3):
            self.manipulation.goto_joint_state(wave_left)
            self.manipulation.goto_joint_state(wave_right)

    def cancel(self):
        self._cancelled = True
        self.mobility.send_cmd_vel(0, 0)
        return "Scan cancelled"

PickupRoutine

Position, look down, and prepare arm for pickup:
from brain_client.skill_types import (
    Skill, SkillResult, Interface, InterfaceType, RobotState, RobotStateType
)

class PickupRoutine(Skill):
    """Position robot and arm for object pickup."""

    mobility = Interface(InterfaceType.MOBILITY)
    manipulation = Interface(InterfaceType.MANIPULATION)
    head = Interface(InterfaceType.HEAD)
    image = RobotState(RobotStateType.LAST_MAIN_CAMERA_IMAGE_B64)

    # Safe arm positions
    HOME_POSE = [0, -0.5, 1.5, -1.0, 0, 0]
    READY_POSE = [0, -0.3, 1.0, -0.8, 0, 0]

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

    def guidelines(self):
        return "Use to prepare for picking up an object in front of the robot."

    def execute(self, approach_distance: float = 0.3):
        self._cancelled = False

        # Step 1: Safe starting position
        self._send_feedback("Moving arm to safe position")
        self.manipulation.goto_joint_state(self.HOME_POSE)

        if self._cancelled:
            return "Cancelled", SkillResult.CANCELLED

        # Step 2: Look down at target area
        self._send_feedback("Looking at target area")
        self.head.set_position(-20)

        # Step 3: Approach slowly
        self._send_feedback("Approaching target")
        self.mobility.send_cmd_vel(linear_x=0.05, angular_z=0, duration=approach_distance / 0.05)

        if self._cancelled:
            return "Cancelled", SkillResult.CANCELLED

        # Step 4: Move arm to ready position
        self._send_feedback("Preparing arm")
        self.manipulation.goto_joint_state(self.READY_POSE)

        return "Ready for pickup", SkillResult.SUCCESS

    def cancel(self):
        self._cancelled = True
        self.mobility.send_cmd_vel(0, 0)
        return "Pickup routine cancelled"

PatrolAndMonitor

Patrol between positions while monitoring camera:
from brain_client.skill_types import (
    Skill, SkillResult, Interface, InterfaceType, RobotState, RobotStateType
)
import time

class PatrolAndMonitor(Skill):
    """Rotate between positions and capture images."""

    mobility = Interface(InterfaceType.MOBILITY)
    head = Interface(InterfaceType.HEAD)
    image = RobotState(RobotStateType.LAST_MAIN_CAMERA_IMAGE_B64)

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

    def guidelines(self):
        return "Use for surveillance - rotates and captures images at each position."

    def execute(self, positions: int = 4, duration: float = 30.0):
        self._cancelled = False
        images = []
        rotation_per_position = (2 * 3.14159) / positions
        start_time = time.time()

        while time.time() - start_time < duration:
            for i in range(positions):
                if self._cancelled:
                    return f"Patrol cancelled. Captured {len(images)} images.", SkillResult.CANCELLED

                # Scan head up and down at each position
                for angle in [-15, 0, 10]:
                    self.head.set_position(angle)
                    time.sleep(0.5)

                    if self.image:
                        images.append(self.image)
                        self._send_feedback(f"Captured image {len(images)}")

                # Rotate to next position
                self.mobility.rotate(rotation_per_position)

        return f"Patrol complete. Captured {len(images)} images.", SkillResult.SUCCESS

    def cancel(self):
        self._cancelled = True
        self.mobility.send_cmd_vel(0, 0)
        return "Patrol cancelled"

InspectObject

Approach an object and examine it from multiple angles:
from brain_client.skill_types import (
    Skill, SkillResult, Interface, InterfaceType, RobotState, RobotStateType
)
import math

class InspectObject(Skill):
    """Move around an object to inspect it from multiple angles."""

    mobility = Interface(InterfaceType.MOBILITY)
    head = Interface(InterfaceType.HEAD)
    image = RobotState(RobotStateType.LAST_MAIN_CAMERA_IMAGE_B64)

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

    def guidelines(self):
        return "Use to examine an object from multiple angles. Robot should be near the object."

    def execute(self, angles: int = 4):
        self._cancelled = False
        images = []
        rotation_per_angle = (2 * math.pi) / angles

        # Look down at object
        self.head.set_position(-15)

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

            self._send_feedback(f"Capturing angle {i+1}/{angles}")

            # Capture from current angle
            if self.image:
                images.append(self.image)

            # Orbit around (rotate, then strafe)
            self.mobility.rotate(rotation_per_angle)

        return f"Inspection complete - {len(images)} views captured", SkillResult.SUCCESS

    def cancel(self):
        self._cancelled = True
        self.mobility.send_cmd_vel(0, 0)
        return "Inspection cancelled"

GoHomePosition

Return to a safe home configuration:
from brain_client.skill_types import Skill, SkillResult, Interface, InterfaceType

class GoHomePosition(Skill):
    """Return arm and head to home positions."""

    manipulation = Interface(InterfaceType.MANIPULATION)
    head = Interface(InterfaceType.HEAD)

    HOME_ARM = [0, -0.5, 1.5, -1.0, 0, 0]

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

    def guidelines(self):
        return """
        Use to return the robot's arm and head to safe home positions.
        Do not use if carrying something.
        """

    def execute(self):
        self._cancelled = False

        # Arm first (priority for safety)
        self._send_feedback("Moving arm to home")
        self.manipulation.goto_joint_state(self.HOME_ARM)

        if self._cancelled:
            return "Cancelled", SkillResult.CANCELLED

        # Then head
        self._send_feedback("Centering head")
        self.head.set_position(0)

        return "Home position reached", SkillResult.SUCCESS

    def cancel(self):
        self._cancelled = True
        return "Go home cancelled"