View Single Post
  #6   Spotlight this post!  
Unread 01-02-2013, 15:30
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Gyro Angle Problems

First, don't print useless "I'm here" messages at the maximum loop rate! The first one conveys information all the rest consume bandwidth. (check your logs for when the spinning slows I would not be surprised if your prints are gradually backing up and consuming all your CPU and/or bandwidth)

Second, If your code stays in a while loop forever it means you are not meeting the exit criterea. Period. In this case that almost certainly means your spinning in the wrong direction, or +/- .75 degrees is smaller than the distance covered at 25% power in 6 tenths of a second. (how did you come up with .6 as the magic amount of time between checks?)

Third, never create a loop that can run forever! Create a counter or timer that guarantees you'll exit after, say, 5 seconds, or 10 iterations, or something. If your gyro gets unplugged or damaged you will sit and spin. (been there)
Reply With Quote