Robotics algorithms - Balancing a ball on a plate
A physics simulation of a servo-driven plate on which a ball is placed. An algorithm to balance the ball on the plate — despite external forces — has been successfully demonstrated.
- Written entirely in C++ .
- 3,000 lines of code.
- Uses the following open-source libraries:
- Bullet physics library for rigid body dynamics calculations.
- OpenGL for the 3D graphics rendering API.
- GLFW for setting up the OpenGL context and window.
- GLM for 3D math utilities.
- Boost C++ libraries.
- Bison/Flex for the parser generator for CRBscript, a custom scripting language.
Balancing a ball on a plate controlled by servos is a traditional problem in the field of robotics. I wanted to test out a few ideas I had in solving this problem. Before I procure an actual robot to test these ideas, I thought it prudent to first test them out in a simulation. This project aims to create a framework within which various robotics algorithms could be tested out.
For my first experiment, I have successfully set up the simulation for a plate that tilts along two axes with the help of two servos. I have applied a simple linear response control system that responds to the motion of the ball. Although more sophisticated mathematical models exist to solve this problem more optimally, my simple solution works and thus is sufficient. The results are shown below.
To make things more interesting, the next challenge is to balance a ball on a plate that is attached to the end of a robotic arm with several joints. The solution may work using inverse-kinematics, or depending on how noisy I decide the simulation to be (to simulate reality more closely), a neural network might come in handy.