Go to Post Like his father, John V-Neun will soon have the advantage of his head resembling a game object. - Eric O [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-02-2006, 21:39
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
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!
  #2   Spotlight this post!  
Unread 01-02-2006, 22:05
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
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.
  #3   Spotlight this post!  
Unread 01-02-2006, 23:16
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 746
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by TubaMorg
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);

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....
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #4   Spotlight this post!  
Unread 02-02-2006, 00:20
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by chakorules
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....

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.
  #5   Spotlight this post!  
Unread 02-02-2006, 07:31
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by TubaMorg
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?
As you said in your other post, you can retrieve the raw yaw rate just polling the gyro analog port directly. It returns 12.5mv/deg/sec of rotation. The analog to digital converter returns a value from 0-1024 for the range of 0-5000mv. So by doing some arithmetic, you can create a function that returns the actual rate of rotation directly.

Quote:
Originally Posted by TubaMorg
I can't seem to figure out the answer for two things.
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.
Can you try putting in a print statement when the timer is started and another when you are reading the timer just to verify that it is being started? Also, are you doing a Preset operation on the timer anywhere in your code that might be getting unintentionally executed repeatedly?
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #6   Spotlight this post!  
Unread 02-02-2006, 09:17
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by BradAMiller
As you said in your other post, you can retrieve the raw yaw rate just polling the gyro analog port directly. It returns 12.5mv/deg/sec of rotation. The analog to digital converter returns a value from 0-1024 for the range of 0-5000mv. So by doing some arithmetic, you can create a function that returns the actual rate of rotation directly.


Can you try putting in a print statement when the timer is started and another when you are reading the timer just to verify that it is being started? Also, are you doing a Preset operation on the timer anywhere in your code that might be getting unintentionally executed repeatedly?
I will add a print statement for when the timer is started. I assume you mean to use a GetTimer right after initialization? Also there is no PresetTimer call in the code anywhere.
  #7   Spotlight this post!  
Unread 02-02-2006, 09:40
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by BradAMiller
As you said in your other post, you can retrieve the raw yaw rate just polling the gyro analog port directly. It returns 12.5mv/deg/sec of rotation. The analog to digital converter returns a value from 0-1024 for the range of 0-5000mv. So by doing some arithmetic, you can create a function that returns the actual rate of rotation directly.


Can you try putting in a print statement when the timer is started and another when you are reading the timer just to verify that it is being started? Also, are you doing a Preset operation on the timer anywhere in your code that might be getting unintentionally executed repeatedly?

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).
  #8   Spotlight this post!  
Unread 02-02-2006, 10:54
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by TubaMorg
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).
Sorry about that... I was assuming you were using the kit gyro.

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).
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #9   Spotlight this post!  
Unread 04-02-2006, 00:33
Dillon Compton Dillon Compton is offline
Jack-Of-All-Trades
FRC #1391 (Metal Moose)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Malvern, PA
Posts: 186
Dillon Compton has much to be proud ofDillon Compton has much to be proud ofDillon Compton has much to be proud ofDillon Compton has much to be proud ofDillon Compton has much to be proud ofDillon Compton has much to be proud ofDillon Compton has much to be proud ofDillon Compton has much to be proud of
Send a message via AIM to Dillon Compton
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
__________________
www.metalmoose.com
  #10   Spotlight this post!  
Unread 04-02-2006, 17:52
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by Dillon Compton
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
It turns out you can use the existing block and just scale the output. Check out this thread (down at the bottom).
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #11   Spotlight this post!  
Unread 09-02-2006, 19:43
MarkVH's Avatar
MarkVH MarkVH is offline
Registered User
AKA: Mark VanHaitsma
FRC #0288 (RoboDawgs)
Team Role: College Student
 
Join Date: Dec 2004
Rookie Year: 2003
Location: Grandville
Posts: 30
MarkVH is on a distinguished road
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.
  #12   Spotlight this post!  
Unread 09-02-2006, 21:19
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: EasyC Timer and Gyro questions

Quote:
Originally Posted by MarkVH
does the gyro function in easyc return the angle in radians or degrees?
This is my first time using a gyro.
The EasyC call GetGyroAngle(port number) returns the heading in tenths of a degree. Check out the Help section in EasyC. It does a good job of explaining how each of the EasyC functions work.

Last edited by TubaMorg : 09-02-2006 at 21:21.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accelerometer code ImmortalAres Programming 28 04-06-2005 01:02
Updated: Example Gyro Interface Code Kevin Watson Programming 2 28-03-2005 04:36
Example gyro code released. Kevin Watson Programming 60 17-03-2005 18:32
Gyro Calibration roboticsjenkins Programming 11 21-02-2005 20:39
Using gyro with other analog sensors...again demerski Programming 0 19-02-2005 08:23


All times are GMT -5. The time now is 13:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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