View unanswered posts | View active topics It is currently Mon Mar 18, 2019 5:22 pm






Reply to topic  [ 2 posts ] 
Two wheeled self balancing robot 
Author Message
Rookie

Joined: Mon Oct 05, 2015 5:03 pm
Posts: 4
Post Two wheeled self balancing robot
Hello, I am wanting to build a two wheeled self balancing robot with the lego mindstorms Ev3 kit. My configuration that I initially built was that of the BALANC3R (http://robotsquare.com/2014/06/23/tutorial-building-balanc3r/). I ended up modifying it by deciding to drop the control brick down between the motors, lowering the center of gravity.

I am trying to figure out how I need to approach coding it now. I have attached a gyro sensor to the top of the bot. I have tried using if statements that check for different input values for the gyro sensor. When the if statement is activated, I call the setmotorsynch() function where the motor speeds vary depending upon what gyro value was detected. By doing this, I was attempting to tune the numbers through trial and error to get it to be able to balance. However, this does not seem efficient.

After doing some Googling, it seems that the programs people are creating for two wheeled self balancing robots are pretty complex in nature (PID, error checking, etc.). For those more experienced in this platform than I, is there a simpler way to make the robot capable of self balance or do I need to do some research into PID and try to go from there? I am looking for what I need to account for in order to program a two wheeled self balancing robot.

On another note, my gyro sensor sometimes seems to go haywire. It will work fine one day. Then the next time I use it, the gyro sensor will have massive drift when I run the program. It will very quickly increase in value to infinity. Not sure why this is happening...I read about some issues on another forum where the sensor had to be plugged in before power on, but that did not seem to be the same cause for me.

Thanks for any input you may have, it is appreciated.


Sun Nov 22, 2015 10:39 pm
Profile
Moderator
Moderator

Joined: Tue May 19, 2015 3:07 pm
Posts: 91
Post Re: Two wheeled self balancing robot
So in all honesty PID at the very least is going to be necessary. I can point you towards some good tutorials if you would like to read into how to set it up. It is for the most part exactly what you were saying just continuous rather than discrete if statements. The central idea to PID is "if I am far away from where I want to be move more than if I was close to where I want to be".

If your goal is to balance then I would think you probably want to look at raw gyro data rather than accumulated gyro data so drift is a nonissue. (Velocity of angle change rather than angle) Most "real" robot applications do complicated stuff to get a better understand of the angle rather than just looking at the sensor data but I do not believe that is necessary.


Mon Dec 28, 2015 1:29 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.