Go to Post I would hate for you to get the impression that the Northeast is one big unending snowglobe during the winter months. - Elgin Clock [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 09-02-2003, 14:21
Bruce C.'s Avatar
Bruce C. Bruce C. is offline
Registered User
#0647 (The Cyber Wolf Corps)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Killeen, Texas
Posts: 65
Bruce C. will become famous soon enough
Yaw Rate Sensor to 90 degrees?

OK, I give up. I never claimed to be a programmer (I live in an analog world!) But I've been trying to figure out how to integrate the rotational velocity output of the gyro to degrees of heading information. All I really need to do is determine when I have completed a 90 degree turn, either to the right or the left.

I understand how the how the gyro works, how it interfaces to the analog port, and how the resulting bit count (0-254) relates to rotational velocity. I can even figure out how to sample that each loop cycle time (26 msec.) and accumulate delta_heading changes. What I can't figure out is how to do it WITHOUT FLOATING POINT MATH!

I know there must be a way to scale the gyro output and manipulate it with integer math to figure out when it has rotated 90 degrees, but I just have no experience with integer math.

Please, someone, how about a hint of the pbasic code required. Someone must have done this already?

Thanks,

Bruce C.
  #2   Spotlight this post!  
Unread 09-02-2003, 16:52
Don Reid Don Reid is offline
Registered User
#0997
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Corvallis, Oregon
Posts: 45
Don Reid will become famous soon enough
The first point is that you have to accumulate (integrate) in small enough units that you don't lose precision. Then when you have accumulated enough, you can convert to degrees.

Each unit of sensor input is worth a fraction
of a degree, (~1/53).

Code:
//   27 mV * sec    1V       127    1 (loop)
//   -----------  * --     * ---- * ----
//      degree     1000 mV   2.5V   0.026 sec
So you can accumulate the numbers from the sensor (with 127 meaning zero), then if you have
more than +53, thats 1 degree....

Also multiply by "delta_t + 1" to account for possible added delay.

You could use many other forms of multi-byte math, they are all really doing fixed point math with some scale factor using integers.
__________________
Don Reid

Last edited by Don Reid : 09-02-2003 at 16:58.
  #3   Spotlight this post!  
Unread 09-02-2003, 22:28
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
so you are scaling it down to loops per degree at neutal?

-Kesich
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #4   Spotlight this post!  
Unread 10-02-2003, 01:38
Don Reid Don Reid is offline
Registered User
#0997
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Corvallis, Oregon
Posts: 45
Don Reid will become famous soon enough
No, it is scaled to sensor_counts / degree. Sensor_counts are the values from the analog input. These (and loops) are dimensionless.

If the machine is turning at one degree per sample time, then the analog input will read 127+53 each time it is sampled.

If it is moving slower (I hope it is, that's FAST!), then the number will be smaller. This means that each time thru the loop, the new motion will be less than 1 degree, so you have to accumulate in smaller units. You can accumulate these "sensor_counts" until there is enough to total at least one degree. Then you increment the degree counter, and subtract 53 from the sensor_counts accumulator.

The logic for values less than 127 (turning the other way), is left as an exercise for the reader(s).
__________________
Don Reid
  #5   Spotlight this post!  
Unread 11-02-2003, 00:36
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Unhappy ahhh headache

Headache Headache... ill just forget it, i probably wont use it neways...

thanx though

-Kesich
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
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
Anyone know where to buy a spare yaw rate sensor? Jim Meyer Technical Discussion 11 30-03-2003 21:18
Aux Fuse 3 (Yaw Rate) Josh Hambright Electrical 0 18-02-2003 08:22
Yaw rate sensor (gyro for the layperson) Kris Verdeyen Rules/Strategy 4 14-01-2002 00:41
Yaw Rate Sensors dense Technical Discussion 4 10-01-2002 08:28
Yaw Rate Sensor ImmacGirl_03 Technical Discussion 2 10-12-2001 15:15


All times are GMT -5. The time now is 14:28.

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