As part of the lecture “Data Processing in Technology” (DT), the Regensburg Balance Bot (ReBaBo) was developed – an autonomous, two-wheeled robot that balances on the principle of the inverted pendulum. My focus in this project was on the conception and implementation of the control technology using fuzzy logic.
System Architecture
The ReBaBo is based on a dual-platform strategy:
- Infineon XE167F: Responsible for hardware-near control, sensors (gyroscope, accelerometer, wheel encoders), and real-time regulation.
- BeagleBoard (ARM): Takes over high-level tasks like communication and future extensions.
The Fuzzy Control
Instead of a classic PID controller, fuzzy logic was used to map the complex balancing behavior. The control processes three essential input variables:
- Angular Velocity ($\omega$): Supplied directly by the gyro sensor.
- Tilt Angle ($\alpha$): Calculated from the accelerometer values.
- Position Deviation: Determined via the wheel encoders to prevent uncontrolled drifting.
Fuzzification and Rule Base
The input variables are translated into linguistic terms (fuzzy sets) like Negative Big (NB), Zero (ZE), or Positive Small (PS). The rule base links these terms to determine the necessary motor speed.
| Angle \ $\omega$ | NB | NM | ZE | PS | PB |
|---|---|---|---|---|---|
| NB | NB | NB | NM | - | - |
| NM | NB | NM | NS | - | - |
| ZE | NM | NS | ZE | PS | PM |
| PM | - | - | PS | PM | PB |
| PB | - | - | PM | PB | PB |
Excerpt from the decision table for angle and angular velocity.
Implementation Details (Embedded C)
Implementation was done in C on the XE167F using the real-time operating system µC/OS-II. Since the controller had no floating-point unit (FPU), the entire fuzzy arithmetic was optimized for efficient execution to keep computational load low.
- FuzzySets: Definition of trapezoid and triangle functions for membership degrees.
- Inference: Application of the Min-Max method.
- Defuzzification: Calculation of the crisp output value (motor duty cycle) using the Center of Gravity method.
Result
The fuzzy control enabled the ReBaBo to balance stably at standstill and autonomously compensate for external disturbances (like slight nudges). By including wheel encoder data, position in space could also be stabilized.