← All projects

Robot Arm Control System

A personal robotics project for a robot arm: custom motion control, gamepad teleoperation, and plan execution.

Overview

This repository is a personal control and experimentation environment for a robot arm based on the LeRobot SO-101 platform. It enables controller teleoperation through custom control software and the hardware interface, with calibration data, safety limits, automated tests, and step-based motion plans kept alongside the control software.

Architecture & Implementation

The hardware-control layer combines an arm model with LeRobot's SO-101 interface. It manages the connection lifecycle, synchronizes software state from the servos, and sends commands for the six joints: shoulder pan, shoulder lift, elbow flex, wrist flex, wrist roll, and gripper. The control system supports both direct joint movement and movement to a target position calculated with inverse kinematics. The control system supports both direct joint movement and movement to a target position calculated with inverse kinematics. To explore the underlying mathematics and kinematics in more depth, I researched the IK calculations and implemented a custom solver based on the arm's geometry. A small browser-based simulator was built primarily to confirm that the inverse-kinematics calculations behaved as intended while developing the motion logic. It was built as a 2D debugging aid and as a visual sanity check for the geometric model.

The browser-based simulator mirroring arm movement to sanity-check the inverse-kinematics solver.

Forward kinematics calculates the arm's end-effector position and orientation from its joint angles, link lengths, base offset, joint offsets, and motor direction signs. The inverse-kinematics solver turns a requested arm position into joint angles. It checks possible poses against the calibrated limits and chooses the one closest to the arm's current posture, helping movements stay smooth and avoid sudden flips. When the requested orientation is unreachable, nearby orientations can be searched for an alternative solution.

Calibration data provides degree limits for every motor. These limits are loaded for the planar kinematics and applied again immediately before commands are transmitted, so direct controls, IK targets, presets, and recorded plans all use the same safety boundaries. Automated tests cover the kinematics calculations, joint-limit behavior, and robot-arm state handling.

flowchart LR
    G[Gamepad] --> T[Teleoperation]
    D[Pygame Dashboard] <--> I[JSON IPC]
    I <--> T
    T --> C[Robot Control]
    K[Calibration Data] --> C
    C --> M[IK and FK]
    C --> L[LeRobot SO-101]
    S[Browser Simulator] --> M

Gamepad teleoperation maps sticks and triggers to end-effector movement, orientation, wrist roll, and gripper changes. A Pygame dashboard visualizes the controller state and provides manual joint-entry controls. It communicates with the teleoperation process through project-local JSON files, keeping hardware communication in one process while exchanging commands and live telemetry with the dashboard. Deadzones, change thresholds, controller profiles, and a deadman control are used to make input predictable and stop continuous movement when the safety control is released. Preset poses move the joints gradually rather than making the arm jump straight to a new position.

The planning mode uses the gamepad to record the end effector's position and orientation as a sequence of MOVE steps. The controller's exact path between recorded steps is not preserved. During playback, the arm takes the fastest available route between each pair of positions. Arm movements use a default speed, while the dashboard interface allows the speed to be adjusted as a percentage. Users can also add PAUSE steps and set their duration. Plans can be edited through the dashboard, saved as JSON, played once, or looped, and manual input or dashboard commands will interrupt their playback.