Thread: Gyro Help
View Single Post
  #2   Spotlight this post!  
Unread 15-01-2015, 18:55
Bryan Herbst's Avatar
Bryan Herbst Bryan Herbst is offline
Registered User
AKA: Bryan
FRC #2052 (KnightKrawler)
Team Role: Mentor
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Minneapolis, Minnesota
Posts: 544
Bryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond repute
Re: Gyro Help

The first problem is that you are resetting the gyro in every iteration of your loop. Thus the angle variable is always going to contain the number of degrees that you have turned since the last iteration of the loop (plus 90 degrees).

Unless you are turning really fast, you are never going to get the gyro to read a full 90 degrees.

I'm also not sure why you are adding 90 degrees to the angle each time. If you are turning in the positive direction, your angle will always be greater than 90 degrees. If you are turning in the negative direction, your angle will always be less than 90 degrees because of the above problem. Either way, the magic +90 is probably not what you intended and the stopMotor() method is not going to be called when you want it to be called.

What you probably want is to reset the gyro in the robotInit() method or before your autonomous while loop, then leave it alone.
__________________
Team 2052- Knightkrawler
Mentor and volunteer
Reply With Quote