Go to Post The best we can all do for our kids as parents, mentors and world citizens, is to model [Gracious Professionalism] always: not to win an award, but because it is the right thing to do. - chapman1 [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 16-02-2012, 22:38
zero118 zero118 is offline
Registered User
FRC #2410
 
Join Date: Feb 2012
Location: United States
Posts: 5
zero118 is an unknown quantity at this point
Using Proxy Switch to Calculate RPM

Hello,

Our team is currently attempting to calculate the rpm of a wheel by utilizing a proxy switch. We will then use this calculated rpm with a PID loop do acquire a desired rpm; however, I am struggling to calculate the rpm in labVIEW.

I first tried to use the counter VI, a sequence structure, and a timer delay function, but I ran into problems (all these calculations are occurring in the teleop VI)

Here is the program i am using to calculate the rpm



Apparently the wait function I have in there makes the entire robot inactive.

How do I approach this problem?

Thanks!
  #2   Spotlight this post!  
Unread 16-02-2012, 22:47
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Using Proxy Switch to Calculate RPM

The sequence needs to be moved to Periodic Tasks rather than Teleop.

Teleop cannot be delayed more than 20ms, or it will not be able to service the new driver commands that arrive every 20ms.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 16-02-2012 at 23:07.
  #3   Spotlight this post!  
Unread 16-02-2012, 22:55
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,745
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Using Proxy Switch to Calculate RPM

I'd double check the specs on your prox and make sure it's going to react quick enough to actually give you reliable RPM data. Some of them have a switching frequency down to 25Hz, which might be too slow for you.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #4   Spotlight this post!  
Unread 16-02-2012, 22:58
zero118 zero118 is offline
Registered User
FRC #2410
 
Join Date: Feb 2012
Location: United States
Posts: 5
zero118 is an unknown quantity at this point
Re: Using Proxy Switch to Calculate RPM

Thank you for the reply! I will make sure to try that tomorrow.

I did notice that the timed tasks VI is outside the loop that contains the teleop VI. Does that mean that inside the time tasks VI, I should perform the above calculations in a while loop rather than a sequence structure?

Thanks!
  #5   Spotlight this post!  
Unread 16-02-2012, 23:09
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Using Proxy Switch to Calculate RPM

You must have a While loop so that it keeps going all the time.

You only need a sequence structure if there is a series of discrete, timed or event driven steps you wish to make.

You didn't post your code so it's hard to say...
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 16-02-2012 at 23:14.
  #6   Spotlight this post!  
Unread 16-02-2012, 23:19
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Using Proxy Switch to Calculate RPM

Correct me if I'm wrong, but dosen't Counter Get return count time, which can be easily converted to speed with nothing more than a Counter Get and 1/x blocks?
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #7   Spotlight this post!  
Unread 16-02-2012, 23:50
zero118 zero118 is offline
Registered User
FRC #2410
 
Join Date: Feb 2012
Location: United States
Posts: 5
zero118 is an unknown quantity at this point
Re: Using Proxy Switch to Calculate RPM

This is what I have come up with. I have stored the calculated RPM in a variable so I can call it in the teleop VI. I also started the counter in the Begin VI.



Do you think thats a good approach?

And I will make sure to check the accuracy of the proxy switch!

I really appreciate your replies!

Thank you!
  #8   Spotlight this post!  
Unread 16-02-2012, 23:53
zero118 zero118 is offline
Registered User
FRC #2410
 
Join Date: Feb 2012
Location: United States
Posts: 5
zero118 is an unknown quantity at this point
Re: Using Proxy Switch to Calculate RPM

The Counter VI does have a "period" value, which returns the average time between pulses. I never actually contemplated using that. Do you think that would be a better idea?
  #9   Spotlight this post!  
Unread 17-02-2012, 00:23
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Using Proxy Switch to Calculate RPM

You dont actually need the reset. and using the period value would be a much better idea. with your method you would only get 1 reading per second. for the period, run it in a 1/x function then multiply it by 60 to get rpm's
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
  #10   Spotlight this post!  
Unread 17-02-2012, 00:30
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,745
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Using Proxy Switch to Calculate RPM

If you're trying to use this value for closed loop control, then yes you probably want to use the period value instead, and update your value quicker. You'll also get vastly more useful data out of the period with much higher resolution. Counts only come in integer values, so the smallest change in RPM you can detect is 60 RPM. The period is going to be measured in rather smaller increments, so you should get much higher resolution data out of it. Also, you might be able to use the period measurement straight in your teleop loop instead, as long as the function block returns a good value even if it doesn't have a new period value yet.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
  #11   Spotlight this post!  
Unread 17-02-2012, 00:41
zero118 zero118 is offline
Registered User
FRC #2410
 
Join Date: Feb 2012
Location: United States
Posts: 5
zero118 is an unknown quantity at this point
Re: Using Proxy Switch to Calculate RPM

Okay, I'll give the period strategy a shot! Thank you!

Also, i thought I should use the reset function because I wanted to find a relatively instantaneous rpm, which is also the reason I wanted to calculated the rpm every second using the time tasks VI. I thought if i didn't reset the counter, it would give me an average rpm, which would not be very useful. Am I interpreting it wrong?

Thank you again for the replies!
  #12   Spotlight this post!  
Unread 17-02-2012, 00:50
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Using Proxy Switch to Calculate RPM

The period does not look at the number of counts. It looks at the time it takes between 2 pulses, and thats what it outputs. the number of the counter doesnt matter.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
  #13   Spotlight this post!  
Unread 17-02-2012, 09:16
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Using Proxy Switch to Calculate RPM

Quote:
Originally Posted by zero118 View Post
Also, i thought I should use the reset function because I wanted to find a relatively instantaneous rpm, which is also the reason I wanted to calculated the rpm every second using the time tasks VI. I thought if i didn't reset the counter, it would give me an average rpm, which would not be very useful. Am I interpreting it wrong?
You are interpreting it correctly. You need the reset* if you're doing your way. You don't need the reset if you do it the other way (get the elapsed time between counts).



* or instead of reset you could use a feedback node to subtract the previous reading


  #14   Spotlight this post!  
Unread 17-02-2012, 10:22
Hugh Meyer's Avatar
Hugh Meyer Hugh Meyer is offline
Registered User
FRC #1741 (Red Alert Robotics)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Greenwood Indiana
Posts: 158
Hugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud of
Re: Using Proxy Switch to Calculate RPM

Quote:
Originally Posted by Mark McLeod View Post
Teleop cannot be delayed more than 20ms, or it will not be able to service the new driver commands that arrive every 20ms.
Mark,

Would you please reference a document or thread that explains the "new driver commands" and explains the 20 ms period.

Thanks.

Hugh
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


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

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