All projects

04 / Systems programming / Reliability

RTOS Motion Control

Two-axis firmware simulator

A modular C firmware simulator with two-axis motion, explicit controller states, fault recovery, and host-side validation.

In development · Host simulator implemented

01 / Context

Problem statement

Motion-control logic needs predictable stop, bounds, and recovery behavior. A software simulator allows those rules to be exercised and tested before targeting a physical controller.

02 / Approach

Solution overview

Modular C components parse commands, update X/Y motion, manage faults, and format telemetry. A host RTOS wrapper supports hardware-free testing, while an optional FreeRTOS POSIX backend exercises real task and scheduler APIs.

03 / Toolkit

Technology stack

  • C
  • CMake
  • CTest
  • FreeRTOS
  • Python
  • GitHub Actions

04 / Structure

System architecture

Implemented controller state model
RTOS Motion Control architectureThe simulated controller transitions from IDLE to MOVING and DONE. STOP produces STOPPED; emergency stop or an out-of-bounds condition produces FAULT. Clearing the fault enables recovery. No hardware deployment is implied.MOVE commandTarget reachedIDLEMOVINGDONESTOP → STOPPED · ESTOP → FAULT

Commands enter a task layer with queues, a state mutex, and event flags. Motion, fault, and telemetry modules share explicit state through the RTOS abstraction. The host backend and FreeRTOS POSIX backend expose the same wrapper boundary.

05 / Ownership

My contributions

  • Developed modular command, motion, fault-handling, and telemetry components for a simulated two-axis stage.
  • Implemented explicit motion states, travel bounds, emergency-stop handling, and fault recovery.
  • Added host-side validation and a task-oriented RTOS layer with an optional FreeRTOS POSIX scheduler path.

06 / Engineering

Challenges & design decisions

01

Make state transitions inspectable

IDLE, MOVING, STOPPED, DONE, and FAULT states make command handling and motion outcomes explicit and testable.

02

Keep a hardware-free regression path

The host backend lets parser, motion, fault, and task behavior run through CTest without requiring a microcontroller.

03

Isolate the RTOS boundary

A shared wrapper separates application modules from host and FreeRTOS implementations. ARM and hardware integration remain future work.

07 / Correctness

Testing & reliability

The repository contains CTest unit suites for the parser, motion, faults, telemetry, RTOS wrapper, and task flow, along with Python smoke tests. GitHub Actions defines host and FreeRTOS build/test paths.

08 / Progress

Results & current status

In development · Host simulator implemented

The host simulator and FreeRTOS POSIX demo are implemented. ARM Cortex-M deployment, QEMU integration, and hardware validation remain future work. An ARM toolchain configuration is present; it is not evidence of a validated hardware deployment.

09 / Further reading

Source & links

Next projectShelfLife