-
Notifications
You must be signed in to change notification settings - Fork 0
Motor Controller
Justus Dicker edited this page Jul 14, 2025
·
1 revision
The Motor Controller service (C++) controls the robot’s motors.
It calculates individual motor speeds based on target speed and direction, runs a software PWM loop, and uses a PID controller to maintain correct motor speeds.
It also publishes real-time motor data (speeds, targets, PID values) via MQTT.
- Other services only need to send desired headings and speeds - the controller handles the rest.
- Always run in a named
screensession:MotorController. - Start the MQTT Broker first.
| Action | Command |
|---|---|
| Compile | g++ main.cpp MotorController.cpp MotorControl.cpp Encoder.cpp MQTTHandler.cpp PID.cpp -o MotorController -lgpiod -lmosquitto -lpthread |
| Run | sudo screen -S MotorController ./MotorController |
| Test if running | `sudo screen -list |
| Stop | sudo screen -S MotorController -X stuff "^C" |
Warning
The stop command only works if the session is named MotorController.
Home | Modules | Components