Skip to content
@MAR-Quadrupede

MAR Quadrupede

M.A.R. — Multi-legged Autonomous Robot

Quadruped Robotics Platform with Active 3D Perception, On-Edge AI and Microservices Architecture


A high-performance autonomous locomotion system inspired by biomechanical engineering principles,
integrating real-time stereoscopic computer vision, 360° LiDAR sensing and reactive decision intelligence.


Overview

M.A.R. is an advanced robotics project that combines mechatronic engineering, on-edge artificial intelligence and autonomous reactive navigation into a four-legged platform inspired by the architecture of Boston Dynamics Spot.

The system is built around a core principle of Active Perception: rather than continuously processing high-resolution 360° video streams at a prohibitive computational cost, the robot adopts a strategy similar to biological vision — a fast perimetral scan, a targeted saccade toward the detected anomaly, and high-fidelity semantic understanding only where it matters.

flowchart TD
    subgraph Perimetral_Sensing ["Perimetral Sensing Layer"]
        LIDAR["360° LiDAR (USB)"] --> DETECT["Obstacle / Anomaly Detection"]
    end

    DETECT -->|"Azimuth θ Computation"| SACCADE["Active Camera Pointing (Saccade)"]

    subgraph Vision_Intelligence ["Vision & Spatial Intelligence · Raspberry Pi 5"]
        SACCADE --> STEREO["3D Global Shutter Stereo Camera"]
        STEREO --> YOLO["Object Recognition · YOLOv8 / v11 On-Edge"]
        STEREO --> DEPTH["Disparity & 3D Depth Estimation (StereoSGBM)"]
        YOLO --> ENGINE["AI Decision & Risk Engine · Safety FSM"]
        DEPTH --> ENGINE
    end

    subgraph Hardware_Control ["Low-Level Motion Control · Arduino"]
        ENGINE -->|"Serial USB: CMD:FORWARD, CMD:STOP, CMD:EVADE..."| FIRMWARE["Arduino Firmware · Inverse Kinematics & Gait Engine"]
        FIRMWARE --> MOTORS["4× Hip DC Motors + Belt-Drive Knees"]
        FIRMWARE --> SERVOS["4× Abduction Servos"]
    end

    subgraph Supervision ["Operator Supervision"]
        ENGINE -.-> DASHBOARD["Web Dashboard · Next.js 14 · WebSocket Telemetry"]
    end
Loading

Mechanical Architecture

The quadruped features 4 symmetrical legs (Front Left, Front Right, Rear Left, Rear Right), each with 3 degrees of freedom:

  • Hip joint (2 DoF): one DC motor for forward/backward flexion-extension, one dedicated servo for lateral abduction-adduction controlling track width and enabling turning-in-place.
  • Knee joint (1 DoF): belt-driven transmission — the knee actuator is positioned near the hip/body rather than at the joint itself. This minimises distal inertia, enabling faster gait transitions, reduced vibrations and lower energy consumption.
Component Hardware Role
High-Level Brain Raspberry Pi 5 (8 GB) LiDAR processing, stereo acquisition, YOLO inference, FSM, WebSocket server
Low-Level Controller Arduino Mega / GIGA Inverse kinematics, gait patterns, PID motor control, safety watchdog
3D Vision Global Shutter Stereo Camera Synchronised stereo acquisition, no rolling-shutter artefacts during motion
Spatial Telemetry 360° USB LiDAR Continuous environment scan, obstacle azimuth and proximity detection

Software Architecture — Microservices

The software is structured as 7 independent microservices, each living in its own repository, communicating over an internal MQTT message bus and orchestrated via Docker Compose.

Repository Language Host Responsibility
mar-firmware C++ / PlatformIO Microcontroller Inverse kinematics, gait engine, PID, hardware safety watchdog
mar-serial-bridge Python Raspberry Pi 5 USB serial HAL, heartbeat generator, telemetry publisher
mar-lidar-service Python Raspberry Pi 5 360° LiDAR driver, sector analyser, saccade proximity trigger
mar-vision-service Python Raspberry Pi 5 Stereo depth (StereoSGBM), YOLO on-edge inference, MJPEG streaming
mar-decision-engine Python Raspberry Pi 5 Safety FSM, active perception, sensor fusion, obstacle avoidance
mar-gateway Python Raspberry Pi 5 MQTT broker (Mosquitto) + WebSocket gateway for the dashboard
mar-dashboard TypeScript / Next.js 14 Browser / RPi 5 Operator UI, telemetry, 2D radar, video stream, E-Stop

Inter-Service Communication

All Raspberry Pi 5 services exchange data via MQTT Pub/Sub topics (Eclipse Mosquitto), decoupling each service completely:

Topic Direction Description
mar/lidar/alert LiDAR → Decision Engine Obstacle azimuth θ, sector, distance (m)
mar/lidar/scan LiDAR → Gateway → Dashboard 360° compressed point cloud for radar widget
mar/vision/detections Vision → Decision Engine Semantic class, 3D coordinates (X, Y, Z), confidence
mar/control/motion Decision Engine → Serial Bridge Kinematic macro-command (FORWARD, TURN_L, STOP…)
mar/hardware/telemetry Serial Bridge → Gateway → Dashboard Battery voltage, current, pitch, roll, FSM state
mar/safety/estop Dashboard / Any → Serial Bridge Priority emergency stop signal
mar/fsm/state Decision Engine → Gateway → Dashboard Current FSM state for UI

Active Perception Pipeline

sequenceDiagram
    autonumber
    participant L as mar-lidar-service
    participant D as mar-decision-engine
    participant V as mar-vision-service
    participant S as mar-serial-bridge
    participant A as mar-firmware

    Note over D: State: PATROL_FORWARD
    L->>D: mar/lidar/alert (θ = 38°, dist = 0.9 m, sector = FRONT_RIGHT)
    Note over D: Transition → INSPECTING_OBJECT
    D->>S: mar/control/motion (CMD:TURN_R, 38°)
    S->>A: Serial CMD:TURN_R,38
    D->>V: mar/vision/target (TRIGGER_ACQUISITION)
    Note over V: Stereo Capture + YOLO + StereoSGBM
    V->>D: mar/vision/detections (class=box, Z=0.90 m, conf=0.91)
    Note over D: Risk: Evadable · Transition → AVOIDANCE
    D->>S: mar/control/motion (CMD:TURN_L, 45°)
    S->>A: Serial CMD:TURN_L,45
    Note over D: Transition → PATROL_FORWARD
Loading

Safety FSM — Behavioural States

stateDiagram-v2
    [*] --> IDLE
    IDLE --> PATROL_FORWARD : Start command
    PATROL_FORWARD --> INSPECTING_OBJECT : LiDAR alert received
    PATROL_FORWARD --> EMERGENCY_STOP : Critical proximity (< 30 cm) / HW fault
    INSPECTING_OBJECT --> AVOIDANCE : Vision confirms obstacle (Z < 1.5 m)
    INSPECTING_OBJECT --> PATROL_FORWARD : False alarm — clear terrain
    INSPECTING_OBJECT --> EMERGENCY_STOP : Fast-approaching dynamic obstacle
    AVOIDANCE --> PATROL_FORWARD : Evasion complete
    AVOIDANCE --> EMERGENCY_STOP : Escape path blocked
    EMERGENCY_STOP --> IDLE : Manual operator reset
Loading

Risk thresholds:

  • Z < 0.30 m or sensor failure → EMERGENCY_STOP (immediate)
  • 0.30 m ≤ Z ≤ 1.50 m → AVOIDANCE (compute evasion trajectory from LiDAR clearance)
  • Z > 1.50 m or no detection → RESUME_FORWARD

Quick Start — Docker Compose

Clone the workspace and launch all services with a single command. Hardware device paths (/dev/ttyACM0, /dev/ttyUSB0, /dev/video*) are commented in the compose file and can be enabled when physical hardware is connected.

git clone https://github.com/MAR-Quadrupede/mar-gateway    # clone any repo that has docker-compose.yml
# OR clone the workspace monorepo (if available)

docker compose up -d --build

Services will be available at:

  • Dashboard UI → http://localhost:3000
  • Video Stream (MJPEG) → http://localhost:8080/stream/left
  • WebSocket Telemetry → ws://localhost:8765
  • MQTT Broker → localhost:1883

To enable physical hardware, uncomment the devices: blocks in docker-compose.yml for each relevant service.


Serial Protocol — Raspberry Pi 5 ↔ Arduino

Communication uses a structured ASCII protocol over USB at 115200 baud:

Downlink (RPi 5 → Arduino)

CMD:FORWARD,<speed_0_100>
CMD:STOP
CMD:TURN_L,<deg>
CMD:TURN_R,<deg>
CMD:STAND,<height_mm>
CMD:SIT
CMD:HIP_WIDTH,<angle_deg>
CMD:PING                    ← heartbeat to keep watchdog alive (every 200 ms)

Uplink (Arduino → RPi 5)

TLM:STATUS=<OK|WARN|FAULT>,BATT=<V>,CURR=<A>,PITCH=<deg>,ROLL=<deg>

Safety watchdog: if Arduino does not receive a valid packet within 500 ms, it immediately enters EMERGENCY_STANDSTILL, cutting all motor power regardless of any ongoing gait sequence.


Team

Area Responsibilities
Software Engineering LiDAR & stereo sensor drivers, 3D vision pipeline (YOLO + disparity), active perception & saccade logic, AI decision FSM, serial protocol, Next.js web dashboard
Electronics & Mechatronics Battery sizing, BMS & power delivery, motor driver wiring, Arduino firmware & inverse kinematics, PID tuning, servo calibration & belt transmission

M.A.R. Robotics Team — 2026

All repositories in this organisation are private. Access is restricted to team members.

Popular repositories Loading

  1. mar-firmware mar-firmware Public

    Low-level kinematics, motor control, gait generator & safety watchdog firmware

    C++

  2. mar-serial-bridge mar-serial-bridge Public

    Hardware abstraction layer & heartbeat watchdog daemon for Arduino serial communication

    Python

  3. mar-lidar-service mar-lidar-service Public

    360-degree 2D LiDAR perception, sector obstacle analyzer & active perception saccade trigger

    Python

  4. mar-vision-service mar-vision-service Public

    3D Stereo vision, StereoSGBM disparity depth, on-edge YOLO inference & MJPEG multi-streaming

    Python

  5. mar-decision-engine mar-decision-engine Public

    Autonomous core brain, Finite State Machine (FSM), sensor fusion & reactive obstacle avoidance

    Python

  6. mar-gateway mar-gateway Public

    Inter-service MQTT message broker & real-time WebSocket telemetry gateway

    Python

Repositories

Showing 8 of 8 repositories

Top languages

Loading…

Most used topics

Loading…