User Tools

Site Tools


dbkim_ballbeam

This is an old revision of the document!


Single Degree of Freedom Ball Balancing Tutorial

Author: <DONGBIN KIM> Email: dongbin.kim@unlv.edu
Date: Last modified on <06/01/19>
Keywords: <ballandbeam, ballbalancing, controls>


The photo above depicts ball balancing systems which allows you to understand classic control theory from simulation to the real life application. The big picture problem is that the theoretical simulation normally does not require lots of efforts due to the exponential development in computers and software such as MATLAB, but it is always tough to convert from simulation into real-life application because it requires extra problems. Solving this completely is important as becoming a roboticist. This tutorial shows you how to simulate your system, and fabricate it in real life. It takes approximately 5 hours to complete.

Motivation and Audience

This tutorial's motivation is to practice basic dynamic system control from simulation to fabrication. Readers of this tutorial assumes the reader has the following background and interests:

* Know how to derive equation of motion of a system
* Perhaps also know how to use Robot Operating Systems for the system fabrication
* Perhaps additional background needed may include C++ or Python programming language

The rest of this tutorial is presented as follows:

  • Parts List and Sources
  • Construction
  • Programming
  • Final Words

Parts List and Sources

To complete this tutorial, you'll need the following items



  • For dynamixel motor control, the following article should be downloaded Dynamixel SDK
  • For Robot Operating System installation, use the following link. ROS-kinetic kame is used ROS Website
  • 3D printing is required for the connector that links the dynamixel and the beam. (Ask [email protected] for the CAD file. Wiki wasn't able to upload here)

Hardware Construction

                                           (Ball balancing scheme)

                                     (Ball balancing Hardware Setup)

This section gives step-by-step instructions along with photos to build the ball balancing system set-up.

Step 1

  • 8020 Aluminum Build : Connect 8020 Aluminum beams like the hardware setup above

Step 2

  • The Foam Board : Cut the board 48cm by 10cm. In 10cm area, slice a little bit 3 cm from both edges, so you can fold to the create a semi-triangle shape. It will be the beam that will support the hallow ball

Step 3

  • Dynamixel MX-28 : Mount the 3D-Printed connector on Dynamixel MX-28, then connect with the beam.

Step 4

  • Sony Camera : Mount the camera on top border of the aluminum frame.
  • Dynamixel + Beam : Place is 36cm under the sony camera. It's because all part of the beam will be inside the camera display. Therefore the position of the ball will be achieved correctly.

Step 5

  • Power Supply : Place it near the dynamixel to provide the continuous power
  • USB Cable : Organize nicely so the cable will not touch the beam or interfere the camera.

Software Construction

Prerequisites

To run this tutorial. The following should be completed

  • ROS Tutorial - begineer/intermediate ROS Website
  • Dynamixel SDK tutorial → read/write on dynamixel motor to change the position or velocity of joint Dynamixel SDK
  • OPENCV Tutorial - Object recognition, Object position recognition DASL OpenCV Tutorials


MATLAB Simulation


The above describe the MATLAB code for the simulation. The code on the right identifies the hardware specification of the ball-and-beam system. The equation of motion and transfer functions are computed in the following attached PDF. (Code line could not be added on this post due to the crack that occurs when the author wrote this tutorial) MATLAB_CODE



The top above figure describes the simulink of the ball and beam system. PID compensator is used to deal with the feedback. The bottom above figure describes the simulated results. The ball should settle in desired position around 2~3 seconds.

Robot Operating System Set-up



The above figure describes ROS scheme of the final ball and beam control system. The control frequency is set to 100Hz. There are 3 nodes, Vision, PID Compensator, and the dynamixel controller. The nodes are sharing topics including position of the ball, motor position angle, and motor position angle feedback to control the ball to the desired point.

Finalized codes are written in Python, and it is not opened as this tutorial is built for the DASL's control class. For people outside of DASL, if you need the code. please email to the author. The author will explain more details. But prerequisites should have been done beforehand

Experiment Results

Trouble Shooting

The experiment is to target the ball to 30cm position from the motor.

The Video above shows that the system is not balancing the ball at all. It also shows that there is latency from the response.

The figure above shows that there's 0.2 second latency. The motor position is not responding well the the feedback motor angle.

The author tried to take measurement of the motor response time to approximate motor transfer function. The above picture shows how slow the dynamixel is. It takes 0.06 seconds to move every 5 degrees angle. The author then assumed the motor transfer function has like a first order system with 0.06 seconds rise time. The next 3 pictures describes the final simulink blocks as well as the simulation change with and without the latency.

Same condition with latency, The position of the ball shows the divergence. Even if the ball is positioned at 30cm, desired position. it will slowly rolling to get out of the beam. See the video below



Solution




To solve the troubleshooting described in the previous section, new gain system is added on the simulink. The gain number will drastically increase the motor feedback angle value, so the motor position can track the feedback much quicker. The simulation result and actual result are shown in the below. Also you can check it by the video

The video shows the result with gain of 25. You can see the ball is controlled to reach at 30cm from the motor.

Conclusion

For questions, clarifications, etc, Email: dongbin.kim@unlv.edu

dbkim_ballbeam.1559509118.txt.gz · Last modified: 2019/06/02 13:58 by dongbinkim