|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Gyro Sensors
How would you program a gyro and a yaw sensor? Also what specifically does a gyro and a yaw sensor return? Finally how do you install this? Thanks
~Fred |
|
#2
|
||||
|
||||
|
Re: Gyro Sensors
the gyro actually is a yaw rate sensor - it tells you how fast the bot is turning on one axis (usually you point the axis up so you can tell how fast your bot is turning on the playfield as it steers).
there has been a lot of discussion and explainations - try the search function up in the orange bar - and search on gyro or yaw - you will probabally find what you need to know faster than I can type it out. |
|
#3
|
|||||
|
|||||
|
Re: Gyro Sensors
Quote:
You would add the output to a variable ("Compass") once a second, like: Code:
Compass = (char)(Compass + (int)(rc_ana_in01 - 127)) Hopefully that gets you started, good luck! |
|
#4
|
||||
|
||||
|
Re: Gyro Sensors
Here's a cool trick for the gyro sensors:
have your code print out a debug value, one per line, of the gyro sensor, and an increasing value before it. So you get this: 1,127 2,127 3,127 etc... Use hyperterm or some other terminal program with a large scrollback buffer, attach a long cable, and drive your robot up a ramp or some object you want to climb while capturing the output. Copy and paste the entire thing into a text file with csv at the end, so foobar.csv or what not. Open the file in excel and graph it. It's great for finding thresholds and understanding what the gyro is trying to tell you at various points along the way. |
|
#5
|
||||
|
||||
|
Re: Gyro Sensors
once a second would not be fast enough - the gyros have a bandwidth of 40 Hz - which means it can change values 40 times a second
so if you only read it once a second, you are only seeing 1 out of 40 possible outputs that it is creating each second. If you want to integrate it to get compass heading, add the value to a integer variable in every pass (loop) of the SW - and make sure you subtract out the zero value (512 if you read it with a 10bit ADC - but you might need to see what the actual 'zero' value is by testing it on your bot). |
|
#6
|
|||||
|
|||||
|
Re: Gyro Sensors
I ment that the units given were mV/degree/second. So you would have to scale or use a finer unit. I don't actually know what happens if you use the straight rate faster than a second (or scaled to).
I think that if you divide by the number of times the interupt occurs per second, it will work. Again, I'd like a confirmation! |
|
#7
|
|||||
|
|||||
|
Re: Gyro Sensors
what type of algorithom would you use to determin your relitive postition from logged yaw rate data? is there something obious that im missing?
|
|
#8
|
|||||
|
|||||
|
Re: Gyro Sensors
If you know your absolute heading and the heading relative to a beacon, you can figure your position. or be less dependent on the value and just use the compass for Red/Blue.
But if your not doing IR, you can use it for, say, Forward(600) TurnTo(3000) Forward(42). |
|
#9
|
||||
|
||||
|
Re: Gyro Sensors
Quote:
and you end up with degrees - compass heading. you would have to calculate the correct constant to get your register into actual degrees, based on the scaling factor of your yaw rate sensor, and how many times a second you add it to the accumulator or you can leave it in whatever units it comes out to be, and use it as a relative number - for example, if you initialize the accumulator to 32000 and turn right 90°, the accumulator might increase to 45,000 or 52,823 (whatever) - you just need to do some testing and see what the units come out to be - then you will know how many counts = 1° |
|
#10
|
|||||
|
|||||
|
Re: Gyro Sensors
You don't need it in degrees; just use robot units!
|
|
#11
|
||||
|
||||
|
Re: Gyro Sensors
°K (degrees Ken)
![]() |
|
#12
|
||||
|
||||
|
Re: Gyro Sensors
hope you're not planning on using it this year -
Yaw/Gyro from last year is not allowed - read the Q&A we played with the idea of using it before the kick off but had to shelve the idea |
|
#13
|
||||
|
||||
|
Re: Gyro Sensors
you can get gyro sensors from the catalogs - analog devices make great ones that you can get on tiny little exal boards - all you need to do is attach +5V, gnd and the signal wire.
search on 'yaw' or 'gyro' and you will find the threads with the parts listed. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ADXRS150 gyro yaw rate sensor | Brian M. | Electrical | 13 | 17-10-2004 02:28 |
| Interrupts and rotation sensors | kor | Programming | 3 | 12-02-2004 11:05 |
| wiring diagram for light sensors??? | pagemauck | Control System | 1 | 21-01-2004 16:32 |
| what type of sensors are good and convenient | magical hands | Programming | 7 | 04-01-2004 23:04 |
| gyro code | odin892 | Programming | 2 | 08-04-2003 14:50 |