|
Page 1 of 1
|
[ 6 posts ] |
|
Using Gyro to go straight
Author |
Message |
MutatedGamer
Rookie
Joined: Wed Feb 27, 2013 7:22 pm Posts: 3
|
 Using Gyro to go straight
Hi, I'm working on my robot and got a gyro sensor in. I'm trying to get the robot to go exactly straight, but it doesn't seem to be working. My problem I'm getting is that it over time drifts left or right. Like, it will still be going straight, but on a different line. For instance, if it was a graph, it would start at (0,0), go to (0,1) then (0,2), etc. Over time though, it may go to (1,1) and start going from there.
The way the code works is first it sets the gyro to 0. Then, it will go forward. It will CONSTANTLY check the gyro value. If it's positive, the left side will go faster (so it goes to the middle more). If it's negative, the right goes faster.
Does anyone know a sample program I can look at for this purpose? Perhaps my program isn't correct. I can't post it at the moment, it's at my school's computer.
|
Wed Feb 27, 2013 7:26 pm |
|
 |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 Re: Using Gyro to go straight
I think you need a PID algorithm. What's your code like? Use the code tabs to paste your code here.
_________________ I'm not a robot! I'm british! ~ quote from an asparagus I am not a robot! I am a unicorn! ~ quote from a robot
|
Wed Feb 27, 2013 10:03 pm |
|
 |
MutatedGamer
Rookie
Joined: Wed Feb 27, 2013 7:22 pm Posts: 3
|
 Re: Using Gyro to go straight
What is that? I cannot post the code at the moment, it is on my school's computer. I'll try ASAP, though.
|
Wed Feb 27, 2013 10:19 pm |
|
 |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 Re: Using Gyro to go straight
Ask someone else what it stands for. it's where the turn is calculated based on previous and current values read from the sensor, to get a smooth line, instead of a left-right-left-right jerky movement. Without a perfect robot and sensor, I think you will drift at least a little bit after a while. Which company makes the gyro?
_________________ I'm not a robot! I'm british! ~ quote from an asparagus I am not a robot! I am a unicorn! ~ quote from a robot
|
Wed Feb 27, 2013 10:32 pm |
|
 |
MutatedGamer
Rookie
Joined: Wed Feb 27, 2013 7:22 pm Posts: 3
|
 Re: Using Gyro to go straight
Alright, I'll google that. It's from the VEX store, so I assume Vex does. http://www.robotc.net/blog/2011/10/13/p ... in-robotc/ that one.
|
Wed Feb 27, 2013 10:38 pm |
|
 |
RoboDesigners
Novice
Joined: Sat Jul 10, 2010 3:06 pm Posts: 86 Location: Roanoke, VA
|
 Re: Using Gyro to go straight
PID stands for Proportional, Integral, Derivative control. It's a type of feedback loop that takes into account the current error (that's the P part), the cumulative error (I part), and the predicted error (D part). Typically, you only need the P part, or sometimes the PI part. Using D starts to cause oscillations unless you're careful. This is a good introduction to PID: http://www.inpharmix.com/jps/PID_Contro ... obots.htmlIt's written for the NXT and line following, but the concepts carry over nicely. I wrote up an introduction to proportional control (specifically for arm control) with VEX a while ago: http://robodesigners.blogspot.com/2012/ ... obots.htmlVEX sells the gyro, but the actual part is made by ST microelectronics.
_________________Check out my website! www.RoboDesigners.comVRC Team 2190 Twitter: @RoboDesigners
|
Sat Mar 02, 2013 9:47 pm |
|
|
|
Page 1 of 1
|
[ 6 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
|
|