Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Reading gyro before Autonomous mode (http://www.chiefdelphi.com/forums/showthread.php?t=60829)

Doug Leppard 06-01-2008 14:09

Reading gyro before Autonomous mode
 
Before the autonomous mode starts (Hybrid mode) and after the robot is booted, can you initialize the gyro and get readings from it to see how stable it is?

So while the robot is sitting can you initalize the gyro and get readings? If so can you store data from it? Anything special you have to do?

Joohoo 06-01-2008 14:14

Re: Reading gyro before Autonomous mode
 
One thing that you could do, is in the initialization function. you could initialize the value to a function return or a hard coded value. so inside the initialization function you would do this
Quote:

gyroHeading = initGyroHeading();
or something to that effect, this should set the heading to what ever you want it to be. Im not %100 sure that you can get values straight off the pins right away before you exit whatever mode you are in before a match, but i dont see why.

artdutra04 06-01-2008 14:23

Re: Reading gyro before Autonomous mode
 
Last year for our drive-by autonomous mode, we used a gyro on our arm to get the angle that we had to turn to. As soon as the robot was turned on, we set the code to initialize the gyro (which takes a few seconds) on our arm before autonomous started. As soon as the gyro is initialized, it would sit right around 0, but over long periods of time the default value can drift as much as 15 degrees over a two or three minute period.

DonRotolo 06-01-2008 14:26

Re: Reading gyro before Autonomous mode
 
Before Hybrid Mode starts, you really can't read anything, since the robot is 'disabled', but in the first microsecond of the match, the gyro is at rest (as is the robot) and so the reading you get should be zero.

If your concern is some kind of calibration to know what "not turning" looks like, I don't think you have to worry much, just read the value in that first microsecond. If the value happens to be read before that - such as when you snap the power on when setting the robot onto the field - then it's a bonus.

The sensor is very well-behaved in our experience - zero means zero, it did not really drift or move enough to worry about. In our 2007 'bot, we never looked for an initial value, we just used whatever the reading came back as and never saw any issues

We're thinking that we'll be using the gyro to help with those 180 degree left turns.

Good luck,
Don

[Edit: Maybe this needs to be tried. Our experience may be different from yours]

Doug Leppard 06-01-2008 14:38

Re: Reading gyro before Autonomous mode
 
Quote:

Originally Posted by artdutra04 (Post 669844)
Last year for our drive-by autonomous mode, we used a gyro on our arm to get the angle that we had to turn to. As soon as the robot was turned on, we set the code to initialize the gyro (which takes a few seconds) on our arm before autonomous started. As soon as the gyro is initialized, it would sit right around 0, but over long periods of time the default value can drift as much as 15 degrees over a two or three minute period.

So you did the initialize routine before start of automode? If so that is good.

Doug Leppard 06-01-2008 14:39

Re: Reading gyro before Autonomous mode
 
Quote:

Originally Posted by Don Rotolo (Post 669846)
Before Hybrid Mode starts, you really can't read anything, since the robot is 'disabled', but in the first microsecond of the match, the gyro is at rest (as is the robot) and so the reading you get should be zero.

If your concern is some kind of calibration to know what "not turning" looks like, I don't think you have to worry much, just read the value in that first microsecond. If the value happens to be read before that - such as when you snap the power on when setting the robot onto the field - then it's a bonus.

The sensor is very well-behaved in our experience - zero means zero, it did not really drift or move enough to worry about. In our 2007 'bot, we never looked for an initial value, we just used whatever the reading came back as and never saw any issues

We're thinking that we'll be using the gyro to help with those 180 degree left turns.

Good luck,
Don

[Edit: Maybe this needs to be tried. Our experience may be different from yours]

I thought the gyro once initialized had to sit still for a second before being moved, not a micro second?

artdutra04 06-01-2008 15:31

Re: Reading gyro before Autonomous mode
 
Quote:

Originally Posted by Doug Leppard (Post 669860)
So you did the initialize routine before start of automode? If so that is good.

Yes.
Quote:

Originally Posted by Doug Leppard (Post 669862)
I thought the gyro once initialized had to sit still for a second before being moved, not a micro second?

While the gyro is initializing, you cannot move it. Once it is initialized, then it's all right to move it as much as you want, so long as you don't exceed the maximum degrees/second of the gyro. (If this occurs, you won't break the sensor, you'll just get saturated readings.)

If the KoP gyro has the same specs as last year, they can only sense a maximum of 90o per second. So we used the KoP gyro on our arm, and purchased a 300o per second gyro from SparkFun Electronics to use for drive-train related things on our 2007 robot.

kaszeta 06-01-2008 15:38

Re: Reading gyro before Autonomous mode
 
Quote:

Originally Posted by Don Rotolo (Post 669846)
Before Hybrid Mode starts, you really can't read anything, since the robot is 'disabled'

At the beginning of the match, the robot is disabled, but auto mode is not yet set. It's worth noting that the bot is reading inputs, it's just not setting any outputs.

Team 95 has used this for years to set autonomous strategies, reset our gyros, and other initialization stuff in the minutes between the bot being turned on and autonomous mode starting.

EricS-Team180 06-01-2008 18:37

Re: Reading gyro before Autonomous mode
 
Quote:

Originally Posted by kaszeta (Post 669927)
At the beginning of the match, the robot is disabled, but auto mode is not yet set. It's worth noting that the bot is reading inputs, it's just not setting any outputs.

I agree with kaszeta, here. We've used AnalogDevices yaw rate sensors since 2004. While in competition (disabled) mode, we simply read the gyro and average it with the previous reading. When the mode changes, the final averaged value becomes our neutral point, which we use for the match. In the past many teams have taken several hundred samples during competition mode and created an average neutral point from them. Either way gives you a good 0 yaw rate point to use for the next 2:15 :cool:

Eric

Doug Leppard 06-01-2008 21:02

Re: Reading gyro before Autonomous mode
 
Quote:

Originally Posted by EricS-Team180 (Post 670174)
I agree with kaszeta, here. We've used AnalogDevices yaw rate sensors since 2004. While in competition (disabled) mode, we simply read the gyro and average it with the previous reading. When the mode changes, the final averaged value becomes our neutral point, which we use for the match. In the past many teams have taken several hundred samples during competition mode and created an average neutral point from them. Either way gives you a good 0 yaw rate point to use for the next 2:15 :cool:

Eric

Thanks that was exactly what I hoped for and was thinking must be possible.


All times are GMT -5. The time now is 23:21.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi