An important part of the controller is the loop time/update rate. For our Lego Segways, an update rate of 10 ms or better gave good balancing results (this depends on the dynamics of your system). In each control loop iteration, the students had to do the following:
- Read sensor information from the gyro sensor and wheel encoder
- Numerically integrate the gyro sensor reading to get the segway lean angle
- Differentiate the wheel encoder readings to get the wheel velocity
- Perform the controller math based on sensor information
- Output next command to the motors
While the PI certainly has more horse power than the Lego NXT brick, I'm not sure how much tweaking to the Linux kernel would be needed to meet these requirements! Also, inconsistent loop times will certainly hurt your performance or prevent the segway from balancing. In any case, I'm also excited about the possibilities!