Skip to content

Movement Tutorial

RoboCrew provides pre-built wheel controls and navigation logic for mobile robots like the XLeRobot. This tutorial covers how to implement basic and advanced movement.

To move a robot, you need to initialize a ServoControler or utilize the SDK-based tools and pass them to an LLMAgent.

from robocrew.robots.XLeRobot.tools import create_move_forward, create_turn_right, create_turn_left
from robocrew.robots.XLeRobot.servo_controls import ServoControler
from robocrew.robots.XLeRobot.xlerobot_LLM_agent import XLeRobotAgent

# 1. Initialize Controller (provide your USB port)
servo_controler = ServoControler(right_arm_wheel_usb="/dev/arm_right")

# 2. Create Tools
move_forward = create_move_forward(servo_controler)
turn_right = create_turn_right(servo_controler)

# 3. Initialize Agent
agent = XLeRobotAgent(
    model="google_genai:gemini-3-flash-preview",
    tools=[move_forward, turn_right],
    servo_controler=servo_controler,
    # ... other params like main_camera
)

RoboCrew supports several standard movement types through its tool factory functions:

  • Linear Movement: move_forward(distance_meters) and move_backward(distance_meters).
  • Rotation: turn_left(angle_degrees) and turn_right(angle_degrees).
  • Sideways Movement: strafe_left(distance_meters) and strafe_right(distance_meters).
  • Look Around: Use the look_around tool if a target is not visible. This rotates the head/camera to capture a 270° panorama (Left, Left-Center, Right-Center, Right) instead of moving blindly.

XLeRobot supports two distinct navigation modes that allow the agent to move effectively or precisely based on the situation in indoor environments:

  • Normal Mode: Used for long-distance navigation (0.5m – 3m). The camera looks forward at the horizon to identify distant targets.
  • Precision Mode: Used for close-range movement (0.1m – 0.5m) and manipulation. The camera tilts downward so the agent can see its own body, arm reach boundaries (green lines), and obstacles immediately in front of it.