View unanswered posts | View active topics It is currently Tue Feb 09, 2016 4:04 am

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Using Gyro to go straight
Author Message
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
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 202
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
Rookie

Joined: Wed Feb 27, 2013 7:22 pm
Posts: 3
Re: Using Gyro to go straight
 Coder A wrote:I think you need a PID algorithm. What's your code like? Use the code tabs to paste your code here.

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
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 202
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
Rookie

Joined: Wed Feb 27, 2013 7:22 pm
Posts: 3
Re: Using Gyro to go straight
 Coder A wrote: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?

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
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.html
It'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.html

VEX sells the gyro, but the actual part is made by ST microelectronics.

_________________
Check out my website! www.RoboDesigners.com

VRC Team 2190

Sat Mar 02, 2013 9:47 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 6 posts ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

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

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    2014 Robotics Academy Summer of Learning    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge

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