Go to Post Build a robot that isn't 119.999999 lbs - Peyton Yeung [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 02-21-2006, 02:12 PM
gnirts gnirts is offline
Suspicious pointer conversion
AKA: Robinson Levin
FRC #1648 (The Gearbox Gangstaz)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: ATL
Posts: 116
gnirts will become famous soon enough
How can you figure out robot speed?!?!

Our robot has the camera, two Hall-Effect (GTS) sensors, the gyro, and (maybe) the accelerometer. It is driven by two small CIM motors. I have not gotten the accelerometer to work, and I desperately need to know the speed of the robot (accurately if possible).

Any suggestions?

Thanks in advance,
Robinson
__________________
'... who are you, then?'
'I am part of that power which eternally
wills evil and eternally works good.'
Goethe, Faust
  #2   Spotlight this post!  
Unread 02-21-2006, 02:29 PM
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: How can you figure out robot speed?!?!

figure out how many counts per rotation for the GTS..

Put the robot up on blocks..

Run the robot at max speed for 5 seconds..

record the final count of the GTS..

rough_speed = GTS / counts_per_rotation_of_robot_wheel * robot_wheel_diameter * PI / 12 / seconds_robot_drove_for

that a number in feet/sec

If you want a live speed, then you can take the current GTS count and subtract from it the GTS count at the last cycle, then apply to that number the following formula:

rough_speed = delta_GTS * robot_wheel_diameter * PI * 38.1 / counts_per_rotation_of_robot_wheel

that's a number in in/sec, for a bit better resolution.

BTW, everything other than GTS and delta_GTS can be calculated and combined before hand. That is, they are constant.
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003

Last edited by Joel J : 02-21-2006 at 02:32 PM.
  #3   Spotlight this post!  
Unread 02-21-2006, 07:21 PM
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: How can you figure out robot speed?!?!

if you need live speed a simple way to do it is like this:
Code:
 int time;
int gearteeth;
int speed;
if(time<38)
{
 gearteeth+=// put code in for gear tooth counter
time++;
}
else
{
speed = time;
time=0;
}
this will give you the amount of gear teeths over the given time since the default routine runs at roughly 38Hz that should give you a number fairly close to gear teeth count /sec
__________________
Team 701
  #4   Spotlight this post!  
Unread 02-21-2006, 07:23 PM
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: How can you figure out robot speed?!?!

Don't assume that the default routine runs at any speed. It can vary from 26.2ms at the minimum up to nearly half a second (before you trigger the Blinking Red Light of Death). Instead, use one of the four available PIC timer modules. Look around for information on how to use them to tell time...
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #5   Spotlight this post!  
Unread 02-22-2006, 11:07 AM
jzampier's Avatar
jzampier jzampier is offline
Finger Lakes Regional Staff
AKA: Jeffrey Zampieron
no team (-)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Rochester
Posts: 74
jzampier is on a distinguished road
Send a message via AIM to jzampier
Re: How can you figure out robot speed?!?!

Knowing speed is actually harder than any one has made it out to be.

Shaft encoders are limited by the slip of the wheels. (They tell you how fast you SHOULD be going, not how fast you are going)

Accelerometers are limited by the huge amounts of noise they generate. If you want a cheap accelerometer... Analog devices makes some 5v ones that will plug right into an analog input on the RC.
ADI iMems Sensor

Keep in mind that an accelerometer isn't at all useful if you hit something. Additionally you have to integrate them to get velocity.

What you really need is an external reference. Something like using the camera on an orthogonal plane to your plane of motion to compute differences in the images and compute distance based on the shift.

In general this is a very nontrivial problem and is something I'm working on as a Master's Thesis in Computer Engineering.
That doesn't mean you can't fudge it a little bit.

Hope that helps.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour.
Sit with a pretty girl for an hour,
and it seems like a minute. THAT'S relativity." -Einstein

----
First Resume: (If I can remember)
2001 NJ Regional
2001 Championship
2002 NYC Regional
2003 OH Regional
2003 Championship
2004 OH Regional
2005 Finger Lakes Regional
2006 Finger Lakes Regional (yes!)
  #6   Spotlight this post!  
Unread 03-31-2006, 12:33 AM
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: How can you figure out robot speed?!?!

Quote:
Originally Posted by jzampier
Knowing speed is actually harder than any one has made it out to be.

Shaft encoders are limited by the slip of the wheels. (They tell you how fast you SHOULD be going, not how fast you are going)
...
Accelerometers are limited by the huge amounts of noise they generate. If you want a cheap accelerometer... Analog devices makes some 5v ones that will plug right into an analog input on the RC.
...
To eliminate wheel slip as a factor, put the shaft encoders on a non-driven wheel.
  #7   Spotlight this post!  
Unread 03-31-2006, 10:16 AM
lukevanoort lukevanoort is offline
in between teams
AKA: Luke Van Oort
no team
 
Join Date: Oct 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 1,873
lukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond repute
Send a message via AIM to lukevanoort
Re: How can you figure out robot speed?!?!

Quote:
Originally Posted by mluckham
To eliminate wheel slip as a factor, put the shaft encoders on a non-driven wheel.
We did this last year and they worked great. Unfortunately at the Championship we had to remove one because of a weight problem. We used 4 inch skyway solid wheels and an IR quadrature encoder. The only problem I ever saw with them was wheelies (which we did a lot of), but if you just want a top speed they'd be great.
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain
  #8   Spotlight this post!  
Unread 04-01-2006, 01:05 PM
Goldeye Goldeye is offline
Registered User
AKA: Josh Hecht
FRC #0694 (Stuypulse)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: New York
Posts: 145
Goldeye has a spectacular aura aboutGoldeye has a spectacular aura aboutGoldeye has a spectacular aura about
Send a message via AIM to Goldeye
Re: How can you figure out robot speed?!?!

To get a very accurate reading of speed from encoders requires interrupts, as you're very likely to be recieving more than one click per 26.
You could count the number of clicks per a known time period, or time period per click. In both cases, you need to have an interrupt fire when the encoder sends a signal. Kevin Watson's interrupts package at kevin.org gives an amazing example of how to do this.
Once you know clicks/time or time/click, you can make a ratio of distance/click (d = 2 pi * wheel_radius / clicks_per_rotation) and compute it.

If you want to do clicks/time, the simplest way is have an interrupt increment a counter for each side, and then use the default loop for timing. The default loop runs approximately every 26.2 ms, so the speed for each side would be counter/.026 in clicks/second. (You probably want to use milliseconds to avoid decimals.) However, that 26.2 milliseconds is not always accurate, so you may instead want to use a timer that is guaranteed to run at a certain rate. See Kevin Watson's interrupts example for how to use timers. Using a timer, you can instead take readings over some arbitrary time period, say, 25ms, and be almost guaranteed of the 25ms.

This year, we chose to do it a bit differently, we only had about 4 clicks per 26.2ms loop, giving us an awful precision. We considered computing every 2-4 loops, but instead settled on measuring the time between clicks. To do this, set up a timer considerably faster than your encoder will send values. (We chose .5ms or 1ms, I believe) and incremement a "clock" for each encoder every time the timer fires. Then, when the encoder sends a value, save that time to an array. 1/that time is the clicks/time, which again derives to the velocity.
However, this method has some problems. Firstly, if you don't get a reading for a long time, you're stuck with your old ones. To avoid this, simply assume that you're going at least as slow as 1/clock if the clock is considerably bigger than the past few readings. Also, this method can give somewhat inaccurate, noisy readings. We found it necessary to average a few readings, and discard ones that are very far off from the last one. In the end, it all worked out and we ended up with a solid PID controller functioning off of this velocity reading. (However, this controller was not set up to go backwards. To drive backwards, we just switched the sides of the sensors and outputs.
__________________
Team 694

2005 Championship - Galileo Semifinalist
2005 New York - Regional Chairmans Award
2005 New York - Semifinalist (Thanks 1257,1340)
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
VCU NASA Regional Collmandoman Regional Competitions 83 03-10-2005 01:20 PM
2005 FRC Team Update 14 Jeffrafa General Forum 43 03-01-2005 03:52 PM
Best Robot Ever(again) Corey Balint General Forum 26 08-04-2004 11:03 PM
Maximum Speed of a Moving Robot Part UlTiMaTeP General Forum 1 01-12-2004 05:57 AM
WASH Palm scouting at the Championship Mike Soukup Scouting 2 04-19-2002 03:14 PM


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

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