Go to Post Hearing about the beginnings of 842 was truly inspirational and has really stuck with me through the years. After following you guys for so long it was crazy for me to play with you. Thank you for all that you have done for FIRST in Arizona. - Saberbot [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-02-2012, 19:18
jaysun jaysun is offline
Registered User
no team
 
Join Date: Feb 2012
Rookie Year: 2000
Location: USA
Posts: 17
jaysun is an unknown quantity at this point
Using a magnetic encoder to get speed of a motor

We have a magnetic encoder mounted to a test motor and, using the magnetic encoder example code, we get a nice sawtooth signal that gives us a position. However, we cannot just calculate the speed of the motor using (current_position - last_position)/time because we would calculate an erroneous speed when the position loops from 360 degrees to 0 degrees.

Any ideas on how to work around this to calculate the speed of the motor?
Reply With Quote
  #2   Spotlight this post!  
Unread 28-02-2012, 19:29
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: Using a magnetic encoder to get speed of a motor

Can't you just WPILib's encoder VIs? Encoder Get has an output for rate, which is scaled accordingly to Distance Per Count (which you set when you opened the encoder in Begin.vi). That should do it for you.
Click image for larger version

Name:	Untitled.png
Views:	38
Size:	53.0 KB
ID:	12155

If you can't/don't want to calculate Rate this way, you can do it this way:
Code:
average_rate = delta_position / delta_time
So...
Code:
average_rate = (current_position - previous_position)/(current_time - previous_time)
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #3   Spotlight this post!  
Unread 28-02-2012, 19:44
jaysun jaysun is offline
Registered User
no team
 
Join Date: Feb 2012
Rookie Year: 2000
Location: USA
Posts: 17
jaysun is an unknown quantity at this point
Re: Using a magnetic encoder to get speed of a motor

I believe WPILib's encoder VIs only work for the quadrature optical encoders, not the voltage-based magnetic encoders.

Edit: I guess WPILib's encoder VIs do work with the magnetic encoders. I might see if any of this helps.

Last edited by jaysun : 28-02-2012 at 23:00.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-03-2012, 17:03
jaysun jaysun is offline
Registered User
no team
 
Join Date: Feb 2012
Rookie Year: 2000
Location: USA
Posts: 17
jaysun is an unknown quantity at this point
Re: Using a magnetic encoder to get speed of a motor

For future reference, I would not recommend using a magnetic encoder to get the speed of a motor. While the readings are smooth, there aren't enough voltage changes in a second to differentiate enough between speeds.
Reply With Quote
Reply


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


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

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