Overview
The goal of this project was to design and build a Stewart platform that could autonomously balance a ball on its upper platform. A Stewart platform is a type of parallel robot that can control the position and orientation of an upper moving plate relative to its fixed base in six degrees of freedom using six legs (with linear or rotary actuators).
Typical applications of the Stewart Platform include flight simulators, animatronics, underwater research, earthquake simulation, orthopedic surgery, and satellite dish positioning.
Implementation
Rotary actuation model design
A. Mechanical - all frame components were 3D printed with the exception of the vertical rod for the camera support which uses a wooden dowel, and the platform which is made from polycarbonate sheet.
B. Electrical - the individual components used include an Arduino Uno R3 microcontroller, a Pixy2 camera, a Pololu maestro 6-channel motor controller, and a DC power supply.
2. Inverse kinematics (IK) derivation - see references 3 and 4 below. From the desired position and orientation (pose) of the platform, the servo arm angles to reach this pose can be determined using the IK derivation.
The process involved first determining the design constants of the system (leg anchor point location with platform base in platform coordinates, the leg length, the servo arm length, the servo locations in base coordinates, and the servo arm angles relative to the base X-axis). Then platform height and servo arm angles at the home position were calculated. The rotation matrix from platform to base coordinates based on a desired orientation is determined and used to find the effective leg lengths to reach this orientation. Then, the servo arm angles are found to achieve the effective leg lengths.
3. Assembly and Integration
4. Object detection - I used the Pixy2 camera's color connected components algorithm to track the ball's position on the upper platform: https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:color_connected_components.
5. Controller design and tuning - a PD controller is used in which the proportional and derivative error terms are the ball's position vector relative to the platform origin and the velocity vector of the ball respectively. The output command of the controller is the desired roll and pitch of the platform about the X and Y axes respectively. This is fed into the IK equations to determine the servo arm angles required to reach this pose.
Results
The robot was able to autonomously balance a ball on its upper platform using a Pixy2 camera and Arduino controller to control six servos.
There is a lot of jitter while moving which affects the controller commands and prevents a perfectly smooth stabilization of the ball at the origin. This is likely due to a lack of stiffness in the system based on the size of the platform relative to the platform base, and the long, slender rods used to attach the servomotor arms to the platform. Also, the camera is not positioned high enough to capture the full range of motion of the platform which causes the camera to lose ball position information and send the platform back to the home position. These issues could be mitigated by incorporating a smaller platform and using shorter and/or stiffer rods to attach the servomotor arms to the platform base.
The motion of the platform also shakes the camera which affects the sensed location of the ball relative to the platform. This could be addressed by decoupling the camera from the base or stiffening the camera support frame to prevent undesired motion of the camera.
Conclusions and Future Work
I had been interested in the Stewart platform for a while now and this was a good way to dive into the details to understand how it works. It was also a good way to work through an electromechanical design project and to deal with all of the issues that come with integration of hardware, sensors, and code. The Pixy2 camera was powerful and very easy to use and I'm already thinking of other projects to use it with.
Future work could include completing the improvements as listed in the Results section above. Also, upgrading to a linear actuated design and/or implementing path control to guide the ball along a prescribed path on the upper platform could be investigated.
See the link below for all code used in this project.
References
Example project reference - https://www.instructables.com/Stewart-Platform/
Example project reference 2 - https://www.instructables.com/Ball-Balancing-Robot/
Inverse kinematics derivation - https://raw.org/research/inverse-kinematics-of-a-stewart-platform/
Inverse kinematics derivation 2 - https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://cdn.instructables.com/ORIG/FFI/8ZXW/I55MMY14/FFI8ZXWI55MMY14.pdf&ved=2ahUKEwi53Nua0suMAxW2JNAFHWLgK1wQFnoECBQQAQ&usg=AOvVaw3pegFOq-IPnGsj17SrsyfH