Hurah! MB8 is balancing… Well almost. Due to some known physical parameters the ball-bot prefers to spend it’s time on carpet, and dislikes smooth hard surfaces, at the moment that is. You can view a quick snippet below.
Due to increased friction between the ball and the floor, and with a limited voltage of the 11.1V battery (meaning the motors can not rotate fast enough) the ball-bot is reasonably happy with balancing on the carpet. However on a smoother surface the ball slips away and the motors simply cannot rotate fast enough to counter the top body acceleration, and the bot tips over.
One method already posed for investigation is increasing the voltage supplied to the motors. These JGY-371 DC motors can handle up to 24V at 1A, however the DC motor controller is specified to only 12V. Reviewing the schematic shows this may simply be a cautionary spec as my board has 25V rated capacitors and doesn’t seem to mind running at 18V. This increase in motor voltage makes a large difference in the response of the bot, and greatly increases the stability on smoother surfaces. To achieve this I needed to re-tune both the LQR and adjust the static-boost gain. More work is required to perfect it, as well as investigations into material types of the omni-wheels and ball.
One side effect of re-tuning the LQR was that I found another set of values that greatly improved both the step and impulse responses of the controller. The steady-state is now down to just 0.5s with 0.02% overshoot and is critically damped, as seen in “sys3” below.
The Simulink controller (with LiveScript in MATLAB) is wonderful to work with. All constants and calculations are handled in the LiveScript, where Simulink then reads the work-space and compiles my Arduino version of the controller into a vast array of C code, then embeds the program in the Arduino MEGA 2560. There are two main modes in running the Simulink controller, one is a “connected” version in which data is sent between the connected Arduino and Simulink, allowing software scopes and meters to read specific measurements ( and angles) as well as IMU calibration data. This mode only works once however, and resetting the Arduino or removing the USB connection will terminate the program.
The second mode is embedded, where all Simulink code is compiled as before, however the Arduino is now on it’s own and will always run the embedded system. This is great for final testing as initial startup of the IMU performs a 2-3 second calibration and is required for best performance.
The LiveScript is performing multiple calculations for a very specific set of values, in this order;
- create equations of motion for both x-axis and y-axis (don’t care about z-axis)
- re-arrange and collect and terms using Euler-Lagrange method
- linearise equations about 0-degrees of rotation (vertical) using Jacobian method
- create the state-space equations matrix with three states (not four) of
- substitute in the “real” values, i.e. V_max = 12V and g = 9.81m/s²
- using Optimal Control theory, calculate the LQR gains of Kx and Ky
Now you are ready to balance!
Рассудок говорил ей, что надо бежать, но Дэвид мертвой тяжестью не давал ей сдвинуться с места. Ей казалось, что она слышит его голос, зовущий ее, заставляющий спасаться бегством, но куда ей бежать.
Шифровалка превратилась в наглухо закрытую гробницу.