![]() |
EasyC Timer and Gyro questions
I can't seem to figure out the answer for two things.
1. EasyC gyro code seems to work well, giving the correct heading when the robot is turned. However we would like to use the actual yaw rate...how can we access this data? 2. We tried to calculate yaw rate ourselves using one of the EasyC timers, however the timer doesn't seem to change. We start it in the Initialize block but subsequent calls return 0, thus we still can't get yaw rate. We would rather just get yaw rate from the gyro but EasyC doesn't seem to allow this. The reason we want it is so we can use the yaw rate to control our drive better, so that straight stays straight and turns are constant. So if anyone has any ideas on how to do this, we would appreciate the advice! |
Re: EasyC Timer and Gyro questions
Hmmm right after I posted my question I think I may have figured out the solution. We can access the gyro output directly with GetAnalogInput(1) which is, of course, the yaw rate, right? Have to wait til tomorrow to try it though. It just figures that after two hours of head scratching that it would be this easy (get it? EasyC!).
That just leaves me with the question of why the timer isn't timing? In the Intialize block: StartTimer(1) In another function: timer = GetTimer(1); PrintToScreen ("Time is %ld\n", (long)timer); I've tried various permutations of casting but get 0 almost every time. Sometimes, if I'm patient, it will go to 1. Any ideas? I should add all of this is taking place on the 2005 RC. |
Re: EasyC Timer and Gyro questions
Quote:
Your not using it somewhere else are you? In your "other function" is it in the "loop". A While Loop? Your code looks ok to me. We haven't had any timer problems. Try timer 6 for kicks and giggles.... |
Re: EasyC Timer and Gyro questions
Quote:
Yeah it is only being used once...I even tried it in the simple gyrotest code and still got nuthin. I guess I will try another one... since your no. 6 timer works, I will try it. |
Re: EasyC Timer and Gyro questions
Quote:
Quote:
|
Re: EasyC Timer and Gyro questions
Quote:
|
Re: EasyC Timer and Gyro questions
Quote:
So for the gyro yaw rate, we are using a 300 deg/sec gyro, so 5 mv/deg/sec. However, the ADC still returns 0-1024 right? It's just a matter of scaling (which we've implemented for heading conversion). |
Re: EasyC Timer and Gyro questions
Quote:
You are correct, if you use a different gyro, then just look at the gyro spec. And the ADC will return a 10 bit value between 0-1023 (1024 possible values). |
Re: EasyC Timer and Gyro questions
My team is interested in using a slightly more accurate gyro than the one in the KoP...80deg/sec probably wont be enough to do what we want it to do. Can anyone give me an idea of where to start with the code needed in easy C to do this? We plan on using one from the same manufacturer, can I still drag and drop or do I need to write an original function? What is the relationship between yaw rate (the 0-1024 number, I assume?), and degrees rotation?
Thanks, Dillon |
Re: EasyC Timer and Gyro questions
Quote:
|
Re: EasyC Timer and Gyro questions
does the gyro function in easyc return the angle in radians or degrees?
This is my first time using a gyro. |
Re: EasyC Timer and Gyro questions
Quote:
|
| All times are GMT -5. The time now is 01:01. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi