We’re trying to use the Yaw Rate Gyro which came in our Kit of Parts this year. Myself and the programmers have searched for about two hours trying to figure out where or how to implement code for it. Can we use the default gyro code that Kevin has given us or is there something else we can do? Also, we’ve tried just to printf the value from the default code. (It’s an analog sensor) We’re getting a base value of about 536 and when we rotate the gyro, the values will go up about 100 and then drop back to 536. What is this a measure of and how can we use these values to help figure out what direction the robot is facing?
Yes, Kevin’s gyro code works fine with this year’s YRG. Have a look at http://www.chiefdelphi.com/forums/showpost.php?p=430290&postcount=10 and follow the link.
sounds like you want to use the gyro as a compass?
a solid state gyro sensor tells you how fast the robot is turning, in one direction or the other. the reading you get when not turning is the ‘zero’ point.
To figure out compass heading, create a 16 bit variable “heading” and initialize it to 32,000. On each loop of the main SW read the output of the gyro chip, add it to HEADING, and subtract the zero offset (you have been getting 536 for the zero reading)
then if the bot turns one way, this running summation will go up. Turn the other way and it will go down. You will have to do some testing to see what the scaleing is for the sensor you use (what change in reading = 1 degree).
We have tried to figure what the “zero” is and we have determined that 536 is to high, (says the robot is generally moving in the negative direction) and 535 is too low (says the robot is generally moving in the positive direction). but we could still beding something wrong.