Modular robot control, from C++ command models to real hardware prototypes.
RobotProj is an ongoing personal robotics engineering project built around a Raspberry Pi 5, independently controlled ESP32-C3 nodes, and a custom Classical CAN command protocol. The goal is to keep high-level control, message encoding, and low-level actuator firmware separate, so the robot can evolve one subsystem at a time.
Current milestone: the C++ application builds on Windows and Linux (x86-64/ARM64); the protocol encoder and stateful sequence decoder are implemented and tested in software. GitHub Actions CI builds and runs CTest on Windows 2022, Ubuntu x86-64 and Ubuntu ARM64. Hardware prototypes for the neck mechanism and cooling control have also been built and tested independently. On 2026-11-17, Head and Cooling exchanged PING/PONG over physical CAN at 500 kbit/s, and the Raspberry Pi 5 captured both frames through SocketCAN.
Hardware iteration in progress — not a finished robot or a production PCB.
| Area | Current state |
|---|---|
| Host computer | Raspberry Pi 5 (16 GB), Debian 13 ARM64, NVMe SSD — running |
| C++ application | Native CMake builds on Windows x64 and Linux ARM64 — verified |
| Node models | HeadNode builds commands. CoolingNode defines its node ID and fan targets. |
| Protocol | CommandEncoder fragmentation and CommandDecoder Single/Sequence reassembly — implemented and unit-tested in software |
| Neck hardware | Servo-driven mechanism with experimental ESP32 control — motion demonstrated |
| Cooling hardware | ESP32 fan-control prototype with PWM — bench prototype |
| Physical CAN transport | Head/Cooling PING/PONG and Raspberry Pi capture verified on the bench. The C++ CLI integration remains pending. |
| Reassembly, ACKs and retries | Single/Sequence reassembly implemented and tested; ACKs, retries, timeouts and multi-sequence handling pending |
| ROS 2, vision and further nodes | Planned |
The current neck test shows actual movement of the prototype mechanism. This is a standalone hardware demonstration: the motion is not evidence of commands travelling over the Raspberry Pi → CAN → ESP32 actuator command path.
Watch the original motion demo (MP4)
The system is deliberately layered. Hardware-specific responsibilities should not leak into the command model or the serialization code.
flowchart TB
subgraph HOST["Host software · Windows / Raspberry Pi Linux"]
MODEL["C++ node model<br/>HeadNode · CoolingNode (command builder pending)"]
COMMAND["Logical Command<br/>node · action · variable-length data"]
PROTOCOL["RobotProtocol<br/>encode · decode"]
FRAMES["Classical CAN frames<br/>software-generated today"]
MODEL --> COMMAND <--> PROTOCOL <--> FRAMES
end
FRAMES -. "host integration pending" .-> BUS["Shared Classical CAN bus"]
BUS <--> HEAD["ESP32-C3 Head/neck · SN65HVD230"]
BUS <--> COOL["ESP32-C3 Cooling · SN65HVD230"]
HEAD --> NECK["Servo neck prototype"]
COOL --> FAN["Fan / PWM prototype"]
Separation of responsibilities
- Node model: represents an actuator subsystem and builds a logical command. For example,
HeadNodestores yaw/pitch values and a bitmask indicating changed targets. - Protocol layer: converts a command into one or more fixed-size Classical CAN frames. A node does not decide how many CAN frames are required.
- Transport layer: will send and receive physical frames; Raspberry Pi / Linux SocketCAN is the intended host interface. It is not integrated into the demonstrated executable yet.
- ESP32 firmware: will decode addressed commands, enforce local safety constraints, and drive actuators. The bench firmware currently implements PING/PONG.
The repository contains the prototype C++ application, including:
HeadNode— a logical head node with yaw/pitch targets, a change mask, andmakeCommand().HeadController— a separate head-control model.CoolingNode— the cooling node ID and fan targets. Command generation is pending.CommandandCanFramedata types.RobotProtocol— encoding and decoding betweenCommandandCanFrame. The 11-bit CAN ID contains priority, node and frame type.- A command-line demonstration that prints frame IDs, types, lengths and payload bytes.
Command payloads use a variable-length byte container, while Classical CAN frames hold up to 8 data bytes. Fragmentation is the protocol's job, not the actuator node's job.
Single encode/decode works in software and is the first format for hardware integration. Sequence support on the physical bus is reserved for a later stage.
A 19-byte logical payload is encoded into four frames in the current command-line demonstration:
| Frame | CAN ID | DLC | Payload (hex) |
|---|---|---|---|
SequenceStart |
0x309 |
8 | 01 01 00 13 00 01 02 03 |
SequenceData |
0x30A |
8 | 01 01 04 05 06 07 08 09 |
SequenceData |
0x30A |
8 | 01 02 0A 0B 0C 0D 0E 0F |
SequenceEnd |
0x30B |
5 | 01 03 10 11 12 |
The payload is distributed as 4 + 6 + 6 + 3 = 19 bytes. The C++ demonstration produced matching frame IDs, data and lengths on Windows x64 and Raspberry Pi Linux ARM64.
Host tests cover Sequence fragmentation and reassembly. Physical exchange and delivery guarantees remain pending.
Head/neck and Cooling each use an ESP32-C3 and an SN65HVD230 connected in parallel to the same bus. CAN_H is red, CAN_L is black, and both ESP32-C3 boards use GPIO0 for TWAI TX and GPIO1 for TWAI RX. Each transceiver takes 3.3 V from its ESP32-C3 and shares ground with the other node.
Use one approximately 120 Ω terminator at each physical end. Intermediate nodes connect in parallel with termination disabled. With the bus unpowered, expect about 60–65 Ω between CAN_H and CAN_L. See the CAN architecture and wiring guide for the node IDs, ESP32-C3 firmware, and Raspberry Pi bench test.
A hand-assembled ESP32 controller and a servo-driven neck mechanism form the first physical actuator subsystem. The current prototype is intended to experiment with yaw/pitch control, mechanical mounting and integration constraints.
| Head-node PCB (component side) | Hand-soldered connections |
|---|---|
![]() |
![]() |
The second ESP32 prototype explores fan PWM control and discrete driver circuitry. The chassis is still experimental, with accessible wiring, power distribution components, and active cooling hardware.
| Cooling controller | Chassis wiring and control stack |
|---|---|
![]() |
![]() |
Additional hardware photos
| Servo mounting | Cooling fan |
|---|---|
![]() |
![]() |
Host computer: Raspberry Pi 5 with active cooling, an NVMe SSD and a Waveshare expansion HAT.
Prototype caveat: these are hand-built bench assemblies, not production-ready PCBs. Wiring, strain relief, insulation, power protection, mechanical limits and mounting are still being refined. The servo and cooling experiments should not be treated as a validated safety-critical system.
The software demo does not require a connected CAN interface, ESP32 or ROS 2.
Environment used: Debian 13 (Raspberry Pi OS), GCC 14.2, CMake 3.31.
sudo apt update
sudo apt install -y git cmake build-essential
git clone https://github.com/Anahiell/RobotProj.git
cd RobotProj
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j4
./build/RobotProj --demoExpected beginning of the output:
Platform:Linux
Architecture: ARM64
Total frames: 4
CAN ID: 0x309
Priority: 3
Node: Head
Frame Type: SequenceStart
Length: 8
Data: 01 01 00 13 00 01 02 03
The remaining three frames are shown in the table above.
Open the folder containing CMakeLists.txt in Visual Studio, select an x64 configuration and build/run the RobotProj target. The same code generates the same four-frame sequence in the Windows build.
Alternatively, from a Windows terminal with a configured C++ build toolchain:
cmake -S . -B build
cmake --build build --config DebugExecutable location depends on the selected CMake generator and configuration.
RobotProj/
├── CMakeLists.txt
├── README.md
├── .gitignore
├── RobotProj/
│ ├── common/
│ │ ├── nodes/ # Node abstractions and models
│ │ └── protocol/ # Command framing and encoding
│ └── src/ # Application and control implementation
├── firmware/ # PlatformIO project for both ESP32-C3 nodes
└── docs/
└── media/
├── hardware/ # Original prototype photography, web-optimized
└── demos/ # Servo-motion demo (MP4 + GIF preview)
The current executable is primarily a protocol demonstration and integration starting point, not a complete robot runtime.
- Assemble initial ESP32 head and cooling hardware prototypes.
- Demonstrate servo-driven neck movement.
- Bring up Raspberry Pi 5 on Linux ARM64 with NVMe storage and SSH.
- Build and run the C++ application on Windows x64 and Linux ARM64.
- Implement and inspect Classical CAN sequence fragmentation in software.
- Implement and test Single and Sequence decoding in software.
- Verify bidirectional PING/PONG between Head/neck and Cooling on physical CAN.
- Introduce ACKs, timeouts, retries and bounded message handling where required.
- Capture Head/Cooling CAN frames on Raspberry Pi 5 with SocketCAN.
- Integrate the C++ application with the physical CAN bench.
- Implement and validate ESP32 CAN receive/dispatch firmware.
- Add concurrent, interruptible motion handling and actuator-limit enforcement.
- Integrate ROS 2 orchestration and additional robot subsystems (eyes, arms, sensors, mobile base).
The objective is to learn and validate systems-level robotics engineering through a real build: C++ design, binary protocol boundaries, microcontroller firmware, Linux deployment, electrical integration, and motion hardware. The project intentionally exposes intermediate stages instead of presenting unfinished features as completed ones.
Project status: active development · hardware and software prototypes · no complete end-to-end autonomous operation yet.
- Implemented:
RobotCorestatic library, CMake cross-platform builds,CommandEncoder, statefulCommandDecoder(Single,SequenceStart,SequenceData,SequenceEnd), and LinuxSocketCanTransportwith socket open/close/send/receive methods. - Tested in CI: GoogleTest/CTest protocol tests including signed integer round-trips, Single payload, fragmentation for payload lengths 8–1534, and Sequence encode/decode round-trips. GitHub Actions matrix:
windows-2022,ubuntu-24.04,ubuntu-24.04-arm. - Not yet demonstrated:
--can IFACEreceive loop in the CLI, SocketCAN end-to-end traffic through the application, ACK/retry/timeout policy, and deployment automation. - Known limitations: the encoder currently uses a fixed sequence ID; the decoder tracks one pending sequence without a timeout; the command debug formatter uses an 8-bit loop index that can wrap for payloads of 256 bytes or more. These are tracked as GitHub Issues, not completed features.
See open GitHub Issues for small, independently closable tasks. Complete and test one change at a time before closing its issue. CI success confirms current tests pass; it does not imply hardware or transport integration is complete.








