![]() |
Example gyro code released.
I've written example gyro interface code and posted it here: http://kevin.org/frc. This code has been substantially revised since the version released earlier with the PID and scripting code. A substantial amount of documentation has also been written to support this code. As the programming interface has changed, this code will not work with the current version of robot.c. An updated version of robot.c will be released soon.
Here's the readme.txt: Code:
The source code in gyro.c/.h contains a driver and supporting |
Re: Example gyro code released.
:yikes:
Thanks a lot! That's all I can say! :yikes: |
Re: Example gyro code released.
Nice! good thing we already ordered our gyro :D
Once again thankyou for the great code :D |
Re: Example gyro code released.
How could I use this with the accelerometer?
Does anyone know the sample rate for it? |
Re: Example gyro code released.
Has anyone tried this code yet? I'd like to get a sense of how (if) it's working for teams.
-Kevin |
Re: Example gyro code released.
Quote:
First of all, thank you for your undying effort keeping this huge event on track. I just started this year as a programming mentor and do not know the ins and outs of what has happened over the last few years with the code. The programming student on the team is new, and he is a little anxious with everything. He first saw "C" just a few weeks ago and is feeling a little overwhelmed. I am guiding him through how to layout the functionality he needs to meet the required game rules and translate all of that into working code. In one of your previous posts, you stated you were working on a new robot.c (and I hope a new robot.h). Do you have any idea when we would see that? Having that will help immensely since my role is to help and not perform the actual work instead of the student doing it himself. Respectfully, Gary D. |
Re: Example gyro code released.
Kevin,
Is this the same as the edubot guro code you have on your site? |
Re: Example gyro code released.
Quote:
1) Because I now return angular units expressed in milliradians instead of degrees, line 198 needs to be changed from: heading = Gyro_Angle()*PI_MRAD/180L; to: heading = Get_Gyro_Angle(); 2) The programming interface was expanded and many functions were renamed. To fix this, I would just drop the new version of gyro.c/.h into your build directory and let the compiler find the deltas for you (there will only be a few). -Kevin |
Re: Example gyro code released.
Quote:
:-) Gary |
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Kevin, the gyro code has worked fine for us. We are able to track heading, and stick to a heading. We arent using the scripting, for lack of need.
As soon as we get our encoders in, I will post how the PID works out. |
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
For now, we are using the BEI gyrochip provided in the 2003 kit. This is for testing purposes, seeing as they are illegal for robot use. We are getting gyro bias at startup, with the Calc_Gyro_Bias() function (we plan to poll it more, but we have only done basic tests, seeing how we are learning this as we go). Our gyro use code hasnt really been developed, since we are waiting for our encoder delivery, and we are planning to tackle the PID system all at once. But in our initial tests, we were seeing a bit of drift; The heading would waver about +- 17 milliradians every 8 seconds. (I dont believe we had the scale factor set the right way, seeing as one rotation was giving us a heading of about 10000 mRads.)
In order to keep costs down, I was hoping to use the provided accelerometer in place of a yaw gyro for the bot. Im guesing this would work with the gyro driver you wrote, but is there anything I need to change? (yanno.. something that I would probably never be able to figure out on my own.) As for the drift, we have explored 2 options. One was to mount the gyro to a piece of foam tape or rubber, hoping it would cut out motor/compressor vibrations. I think the gyro bias is being set incorrectly due to the vibrations, and since for now we are only polling for bias once, it may have ill effect on our code. Any tips? Thanks. |
Re: Example gyro code released.
Quote:
Quote:
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
Quote:
|
Re: Example gyro code released.
Quote:
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
I don't believe that the BEI gyro's are legal because the lowest price I have been able to find them for is approximately $350 which over the $200 price limit for additional electronics. If anyone has seen a gyro for sale cheaper then that, that would follow the vendor requirements that FIRST has laid out please post a link because I have 3 of them sitting in the shop that I would love to use on this years robot.
|
Re: Example gyro code released.
Quote:
Thanks |
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
Edit: Actually, on second thought, does anyone know for sure if the fact that FIRST gave it to us in previous years makes a difference? |
Re: Example gyro code released.
Quote:
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
|
Re: Example gyro code released.
Quote:
Can you tell us what you were seeing for drift over time? I just wasn't sure what to expect for results and so we tried these modifications. Also, I have a question. You're locking the A/D onto Channel 1 to presumably eliminate that acquisition time when switching channels. How much time does actually take (for teams that want more than one analog input)? And do you know what the conversion time is once the channel is switched? Thanks again for posting the code. Brad |
Re: Example gyro code released.
Quote:
Quote:
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Kevin
I am a member of team 335 and one of 2 programmers. I have only been programming for a year and hardly know C(only know what i have read in Books). I was wondering how to use the cmu camera and the gyro together for locating and directing a robot during the 15s. here is the desired algorithm field [1/2 field length][1/2 field width] Initilize camera Track_color(green) move_to_green() Map_position_to_array |
Re: Example gyro code released.
I had a question similar to Tom's in that by using another gyro not to measure heading, but instead use it as tip sensor. Also I would like to use the accelerometer(instead of quadrature encoders) in autonomous mode which with the locking of the ADC I can't do that.
|
Re: Example gyro code released.
Quote:
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Wait.... You are going to make it so we can use that scripting stuff to control the robot with the camera? If so then that is absolutely the best news I have ever heard :yikes: :ahh: :D :) . I wish the default camera code was designed more for autonomous operation, rather than with a joystick and such. It would have saved me a lot of trouble.
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
When I said using the accelerometer instead of quadrature encoders I meant to that it would be used along side the gear tooth sensors so that my team does not have to pay for the quadrature encoders they can use what is given in the kit. The accelerometer would only be used to integrate to velocity not position so that the teams could use only the sensors provided in the kit and have a little more knowledge of where there robot was going on the field.
|
Re: Example gyro code released.
I am having a bit of a problem with the gyro code at least I think I am... just to test out the gyro (a BEI Gyrochip ARQS-00075) I plugged it in and downloaded the code (edit: the newest frc_gyro code), and in the Terminal window for the Gyro Angle's output the value just keeps increasing infinitely. When I unplug the gyro while this is running it starts to decrease infinitely. To make sure the gyro was working I just tried doing an output of the analog value and it seemed to be fine. Any ideas? (sorry I don't have more exact information, I don't have all the hardware at my house!)
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Is the BEI gyro really illegal to use? I am a rookie engineer this year and see that Kevin Watson has included configuration for it in his navigation code. Our team coach handed me the sensor, from last year's kit, and I have begun wiring it in. IF illegal, why? I saw that the BEI gyro can be purchased on the web. Wouldn't a team just
count it's price in the electronics price of it's parts or is there some rule about past electronics parts. It seems awfully silly to have to not be able to reuse last year's electronic parts. |
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
Quote:
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
-dave |
Re: Example gyro code released.
Quote:
How is it that you never seem to sleep, yet function as a (pretty) normal person who manages to keep the entire FIRST manual in your head <grin>? Here's R19: "<R19> Individual COMPONENTS retrieved from previous robots and used on 2005 robots must have their undepreciated cost included in the 2005 robot cost accounting, and applied to the overall cost limits." Two things come to mind: 1) There are lots of BEI gyros around that have not been "retrieved from previous robots" and 2) Who knows what the undepreciated value of the BEI gyros is? FIRST certainly didn't pay >$200 for each one. If you can establish a value by purchasing one "used", I don't see a problem. Here's Q&A #1318: Q:From ID 1118: The Gyros from previous year's kits appears to cost $300USD and therefore exceeding <R44> limit of $200USD for electronic components. (http://fastascent.com/Projects/Attit...te_gyro_s.html) A:If that is the price, clearly R44 excludes them from being used. Find a used BEI gyro or find a cheaper gyro of another brand. Here, the FIRST folks are clearly giving the okay to use one that is "used". -Kevin |
Re: Example gyro code released.
Kevin, even if it is donated, it must be accounted for at the fair market value (section 5.3.4.4). Also, the person you purchase it from must meet the qualifications of a VENDOR (section 5.2), meaning they must have a federal tax id and must make their products availible to all FIRST teams.
I don't beleive your scenario meets any of these qualifications. When FIRST says it's ok to get it used, I beleive you still have to get it per the other rules. Question 1352 will hopefully clarify this. Quote:
|
Re: Example gyro code released.
Quote:
-Kevin |
RE: Hall effect sensors
Kevin
Is there any reason why the edubot encoder code from your website won't work with the Hall effect sensors? Jon |
Re: Example gyro code released.
Quote:
I have tried the ADXRS300EB and the BEI gyrochip AQRS-0075-xxx (two different units) with some problems. I have measured a nominal 2.5 volts for both sensors and when physically swinging both gryo's in opposite directions see the voltage swing up/down as expected. So, from a gross standpoint, gyro's are operational. The software outputs a gyro bias of 4144? When, I swing the gryo 180 degrees in one direction, slowly, and return to zero I cannot get the gyro to indicate zero. Have set #define to ADXRS300EB setting and #define to AQRS0075 and played with scaling factor without success. Turned out long term Bias calculation - close to short term bias. After powering up and gyro reading 0 degrees for 4 or 5 samples, I swing the gryo 180 degrees slowly and return to zero. Any suggestions, Kevin. BTW, I really believe the ADXRS300 EB scaling is not 5 mv /degree/sec but 7.5 mV/degree/sec. Plus/minus 300 degrees over 4.5 volt range, is 300 degrees over 2.25 volt range (2.5 to 4.75 or 2.5 to 0.25 volts). or 2250 mV/300 degrees which is 7.5 mV/deg. Scaling for Plus/Minus 75 degrees/ second is 30 mV/deg/sec Scaling for Plus/Minus 150 degrees/second is 15 mV/deg/sec scaling for plus/minus 300 degrees/second is 7.5 mV/deg/sec |
Re: Example gyro code released.
Quote:
Quote:
Quote:
Code:
static unsigned char old_io3_state = 1;Quote:
-Kevin |
Re: FRC/Kevin 01/30/05 Gyro code Operational - Team 1286
Quote:
32768(2.5 volts) -32282(Bias)=486. 486/64 = 7.59 a/d counts * 5 mV/count = 38 mV above 2.50. Null bias should equal 2.538 volts. Verfied with DVM. Hooray! Sampling rate was 1600 Hz, samples per update rate set to 64, ADXRS300EB utilized, #define TENTHS__OF_A_DEGREE. #define GYRO_CAL_FACTOR = 1000/1000 (no change). Simple 180 degree spin test executed. Learn bias at 0 degrees, verify for 4/5 readings on terminal that angle = 0 degrees. Next, spun gyro 180 degrees - reading about 900 counts (90 degrees * 10 counts/degree). Return to 0 degree position - read 0 counts (plus/minus 30 - remember, very coarse test). Next, tried the GEI GYROCHIP AQRS_00075. Changed the #define GYROCHIP_75 at top of gyro.h. Same spin test gave similiar results. Spun 360 degrees and back - similiar results. Sampling rate 1600 Hz, samples per update rate equal 64, #define TENTHS_OF_A_DEGREE, #define GYRO_CAL_FACTOR = 1000/1000 (no change). Quote:
Did you work some new magic in the new 01/30/05 software release, or do you think the 1600 Hz, samples = 64 is what made this work? I did not have time last night to experiment with various settings. I tried the 01/22/05 software and found my head bloody from beating it against the wall to make it work. BTW, thanks for responding to previous e-mail and publishing 01/30/05 release. |
Re: FRC/Kevin 01/30/05 Gyro code Operational - Team 1286
Quote:
Quote:
-Kevin |
Re: Example gyro code released.
Hi, I just wanted to let you know we implemented your code with the ADXRS300EB last weekend and it has been performing *perfectly* all week. Thanks for the excellent work :). Now the camera is another story....
|
Re: Example gyro code released.
Quote:
Quote:
-Kevin |
Re: Example gyro code released.
Quote:
|
Re: Example gyro code released.
Quote:
-Kevin |
Re: Example gyro code released.
Hi,
i used your gyro code with a ADXRS300. The user_routines.c executes pretty good, the gyro bias is mostly stable there is almost no change in angle. But the autonomous mode is giving us a lot of trouble. I am trying to accomplish two tasks, one give robot an angle and have to turn, like turn(90) and it should turn 90 degree, The other thing is being able to go in a straight line with out drifting. But after about 2-3 seconds in the autonomous i encounter an runtime error( the program state starts blinking red). Here is my user_routines_fast.c please take a look and help me out. :) Quote:
|
Re: Gyro problems - again - Team 1286
Kevin,
I tried working last night with all three gyros and none worked like the last time. So, first time was bad. Second time was like a good dream. Third time was bad again. Gryo angle had drift and bias reported unusual numbers. Voltmeter on output agreed with gyro angle drift output. I can't remember the number right now (like 3.0 volts). At one point I measured a solid 4.98 volts powering one of the gyro's over the PWM cable. Same laptop. software, gyros, FRC controller -- the works. Has there been any reported FRC_Board sensitivity to electical noise like issues? Should I be extra careful with noise sources? Should I get away from using A/d channel 01? I didn't have any caps to place on output to see if that would help to stabilize the gyro output. Will all three gyros flaky performance, however, I am leaning away from viewing the gyro's as the problem but the FRC controller. Have you tried same software on multiple platforms yourself and/or seen strange problems like this on FRC controllers? I hope some of the high school student's end up reading this thread so that they can see how difficult it can be to make what seems to be something simple work properly. |
Re: Gyro problems - again - Team 1286
Follow up to previous message.
I went home to try the gyro software on a new controller. So, same software, gyro, different FRC controller. Gyro operational again. Rotate 180 degrees and get 1800 on display. Return slowly to 0 degrees, get 0 on display. No gyro drift. I suspect some funny issues with the FRC controller that we are using in our old robot. When I get a chance, I will power up the 2005 FRC controller and see what happens with the gyro. I will continue to explore different angles as to the reason for the differing results and update this message accordingly. |
Re: Gyro problems - again - Team 1286
This may seem like a weird question, but oh well... How do you wire the BEI AQRS-0075-FIRST gyrochip?
I read the readme but it only gives instructions for wiring other gyros. I suppose you need to wire the white cable to rate out pin1, the ground black wire to common pin2, and the red wire to +5 VDC input pin3. I think that is how it goes, but i just want to make sure is right before i blow something out. Any quick reply will be greatly appreciated. Thanks. |
| All times are GMT -5. The time now is 05:29. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi