Go to Post "The world is not idiot-proof. Pay Attention." - DonRotolo [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 26-01-2006, 22:39
CyberWolf_22's Avatar
CyberWolf_22 CyberWolf_22 is offline
Programming and Electrical Mentor
AKA: Allen Gregory
FRC #2587 (Afrobots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Houston, Texas
Posts: 227
CyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really nice
Velocity Calculation

Does anyone know of a way to get velocity from a simple wheel encoder using WPILib. I know how to do it using timer interrupts but since they are disabled I have not found a simple solution to getting the velocity of a wheel.

Any help would be greatly appreciated.
__________________
  #2   Spotlight this post!  
Unread 27-01-2006, 09:24
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
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: Velocity Calculation

Quote:
Originally Posted by CyberWolf_22
Does anyone know of a way to get velocity from a simple wheel encoder using WPILib. I know how to do it using timer interrupts but since they are disabled I have not found a simple solution to getting the velocity of a wheel.

Any help would be greatly appreciated.
The velocity is basically the number of ticks / time. If you are taking readings over time, you can use deltaTicks / deltaTime. deltaTicks is the number of ticks between readings, and deltaTime is the amount of time between readings.

To get the time there are a few functions, GetMsClock() to return the running time in millisecods. Alternatively you can use StartTimer(), StopTimer(), GetTimer(), and PresetTimer() to return time in milliseconds.

To improve the accuracy, try to make the time between samples as long as you can, since very short sample times will compound the errors in reading the timers and reading the encoders. Longer sample time will have the same errors, but only once over a much longer time. If you only do the velocity calculation every 200ms it should be pretty accurate.

With the timer functions, you can Preset a timer to 0 each time you do the calculation, and wait until it gets to 200 then calculate again.

Does this solve the problem?
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #3   Spotlight this post!  
Unread 27-01-2006, 10:36
CyberWolf_22's Avatar
CyberWolf_22 CyberWolf_22 is offline
Programming and Electrical Mentor
AKA: Allen Gregory
FRC #2587 (Afrobots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Houston, Texas
Posts: 227
CyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really nice
Re: Velocity Calculation

Yes this does help. It is one solution I was thinking of but did not know how to implement it easily but I think I got it know.

Thank you for the advice.
__________________
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
Manual Velocity PID, anyone successful? Chris_Elston Programming 20 31-01-2006 20:51
Measuring Muzzle Velocity Team 614 Rules/Strategy 8 28-01-2006 14:53
Cylinder Force Calculation Arkorobotics Pneumatics 19 20-01-2006 23:43
pneumatic launch velocity Keeler836 Pneumatics 23 16-01-2006 23:23
White Paper Discuss: Ballistic Range Calculation Kevin Sevcik Extra Discussion 0 11-01-2006 07:09


All times are GMT -5. The time now is 01:05.

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