Help with balancing GyroBoy (Lego Mindstorms EV3) using MATLAB
43 views (last 30 days)
Show older comments
Hello all,
I am trying to program a self-balancing two-wheeled robot (GyroBoy) using Lego Mindstorms EV3. I have programmed the PID controller in MATLAB to balance it. I tried to program it by taking some help from an online available code which works perfectly well to balance it. (Code available here in the form of Lego EV3 software program). The problem is that the output of my PID, which is the input to the motors, has an unbound value. The EV3 motors take an input in the range [-100, 100]. Hence, when ever my PID output is more than 100, it runs the motor at 100% power. So, I am unable to balance the robot. I have tried scaling the PID output, but then the value is too low to be able to balance it. Can someone guide me in any direction regarding how to balance a GyroBoy using MATLAB? I am using the EV3 hardware support in MATLAB R2014b.
0 Comments
Answers (1)
Jon Boerner
on 23 Oct 2014
Hi Mohammad,
When you say you have programmed the PID controller, using MATLAB, what exactly do you mean? Are you still using the Mindstorms environment to program the EV3, or are you using a MATLAB/Simulink Support Package? Also, how are you developing your PID loop?
Lastly, have you seen this example already?
Not exactly what you are trying to do, but fairly similar in terms of setup.
Lastly, scaling the PID probably is not the best thing to do. You would want to re-tune it with different levels of aggressiveness and confirm that the motor effort does not exceed 100 (in this case). Just directly scaling the output allows the poles of the closed-loop system to become unstable, even if the original PID controller was stable.
2 Comments
Sandip
on 3 Feb 2015
Edited: Sandip
on 3 Feb 2015
Hi Mohammad,
I am also facing a similar problem regrading the connection to EV3 over Bluetooth from Matlab R2014b. I have also included the support package in MATLAB R2014b, but no matter what I do, I am not able to connect to EV3 over Bluetooth.
I am also getting the following error:
-------
myev3 = legoev3('Bluetooth','COM21') Error using error Unable to load a message catalog 'legoev3io:build'. Please check the file location and format.
Error in legoev3 (line 157) error(message('legoev3io:build:CommInvalidType'));
---------
I was wandering what to do ?
See Also
Categories
Find more on MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!