Help with balancing GyroBoy (Lego Mindstorms EV3) using MATLAB

43 visualizaciones (últimos 30 días)
Mohammad Sarim
Mohammad Sarim el 22 de Oct. de 2014
Editada: Sandip el 3 de Feb. de 2015
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.

Respuestas (1)

Jon Boerner
Jon Boerner el 23 de Oct. de 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 comentarios
Mohammad Sarim
Mohammad Sarim el 23 de Oct. de 2014
Editada: Mohammad Sarim el 5 de Nov. de 2014
Hi Jon,
First of all, I am using the MATLAB support package included in the MATLAB R2014b. I am using the Gyro Sensor to get the inclination of the robot with the vertical and implementing PID control over that to keep it at the stable position (zero degrees). I am estimating the rate of change of the Gyro angle through Kalman filter. This serves as the differential error in my PID loop. (The rate of change of Gyro angle can be found directly using the MATLAB support package, but it doesn't work and messes up the calibration of the gyro sensor).
I already looked at the example, but I was unable to test it since I am unable to connect the EV3 to MATLAB using Bluetooth (tried a few times), and I don't have a WiFi dongle. The Simulink doesn't connect through USB.
I also noticed that scaling is not an option, and I have been trying for weeks now to tweak the parameters of the PID loop, but have been unsuccessful.
I was wondering has no one tried balancing a two-wheeled robot using MATLAB?
Sandip
Sandip el 3 de Feb. de 2015
Editada: Sandip el 3 de Feb. de 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 ?

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by