Go to Post Sometimes you have to eat your vegetables, do your homework, and get some sleep. Otherwise you may get sick, have bad grades, and or fall asleep during the championship. - IKE [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-03-2010, 19:34
kgzak's Avatar
kgzak kgzak is offline
Registered User
AKA: Kris
FRC #4392 (Decievers) FRC #2075 (Enigma)
Team Role: College Student
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Grand Rapids, Michigan
Posts: 418
kgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to behold
Closed Loop Speed Control

I want to make a closed loop speed control VI to get a very accurate speed for the motors to run. I know how to calculate the speed using encoders but is there a different way to tell the victor what speed to set the motor to? I feel that the Set Motor Speed VI is not very accurate.

Last edited by kgzak : 28-03-2010 at 20:16.
Reply With Quote
  #2   Spotlight this post!  
Unread 28-03-2010, 20:18
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Closed Loop Speed Control

Presumably, you are using the Motor Set Speed VI, which in spite of its name, sets the percentage of time that the motor is given full current. In order to control the speed of the motor, you'll want to use some form of control to close the loop -- as the topic correctly states.

If you are having trouble getting the basic I/O, there is LV example called Motor with Encoder that you can compare to.

If the control is the difficult part, I'd add a PID VI to the loop and use the measured encoder speed, the target speed, and the PID coefficients to tune the controller.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 28-03-2010, 20:22
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Closed Loop Speed Control

Quote:
Originally Posted by kgzak View Post
I want to make a closed loop speed control VI to get a very accurate speed for the motors to run. I know how to calculate the speed using encoders but is there a different way to tell the victor what speed to set the motor to? I feel that the Se Motor Speed VI is not very accurate.
The Set Motor Speed VI is a mis-nomer. It doesn't set motor speed, it sets motor voltage (via PWM). Under certain idealized conditions motor speed will be proportional to motor voltage, but this is rarely the case with the motorized applications in FIRST. That's why it is not accurate.

If you want closed-loop speed control, you can run the encoder signal to the cRIO and create your own PID control or use a library function. Or, use the Jaguars instead of the Victors. The Jags have built-in closed-loop speed control if you command them via CAN bus and feed the encoder signal directly to them. Which raises the question: has there been a clear ruling from GDC whether or not this is permissible?


~
Reply With Quote
  #4   Spotlight this post!  
Unread 28-03-2010, 20:27
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Closed Loop Speed Control

Quote:
Originally Posted by Ether View Post
The Set Motor Speed VI is a mis-nomer. It doesn't set motor speed, it sets motor voltage (via PWM). Under certain idealized conditions motor speed will be proportional to motor voltage, but this is rarely the case with the motorized applications in FIRST. That's why it is not accurate.

If you want closed-loop speed control, you can run the encoder signal to the cRIO and create your own PID control or use a library function. Or, use the Jaguars instead of the Victors. The Jags have built-in closed-loop speed control if you command them via CAN bus and feed the encoder signal directly to them. Which raises the question: has there been a clear ruling from GDC whether or not this is permissible?


~
Yes, it is legal. The rules are very clear that the Jaguars' CAN functions are very legal this year.

Summarized, the rules are:
1) If you drive a Jaguar with PWM, pretend it is a victor (no fancy inputs).
2) If you drive a Jaguar with CAN, don't plug in PWM, but have fun with everything else.
Reply With Quote
  #5   Spotlight this post!  
Unread 28-03-2010, 20:34
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: Closed Loop Speed Control

Quote:
Originally Posted by Ether View Post
Which raises the question: has there been a clear ruling from GDC whether or not this is permissible?


~
The ruling is directly in the manual, see <R68-H>:

Quote:
<R68> All outputs from sensors, custom circuits and additional electronics shall connect to only
A. other custom circuits, or the following:
B. additional COTS electronics, or
C. input ports on the Digital Sidecar, or
D. input ports on the Analog Breakout, or
E. the RS-232 DB-9 serial port on the cRIO-FRC, or
F. the Ethernet bus connected to Port 2 of the cRIO-FRC, or
G. the CAN-bus if and only if all Jaguar speed controllers on the CAN-bus are wired in full compliance with Rule <R63> and Rule <R64>, or
H. the sensor inputs on the Jaguar speed controller.
Emphasis mine.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #6   Spotlight this post!  
Unread 28-03-2010, 20:58
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,995
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Closed Loop Speed Control

What you want is a PID loop. Search the term here in Chief Delphi, particularly in the White Papers section.

What a PID loop does is look at the motor's speed, compare it to what you have told it you want as the motor's speed, and increases (or decreases) the motor speed so they match.

You wrote "Very Accurate" but what exactly do you mean? +/- 100 RPM? +/1 1 RPM? As you might guess, these are both pretty accurate, but one takes a lot more effort than the other. Also, if your load is fairly constant, it is a lot easier than if your load varies widely.

You can get tighter control of the motor by making your loop run faster. If you run the loop at 100 times per second, you can maintain better control than if you run it once per second, for example.

If you read the papers and still don't understand, just ask. We love explaining PID.
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #7   Spotlight this post!  
Unread 28-03-2010, 22:16
kgzak's Avatar
kgzak kgzak is offline
Registered User
AKA: Kris
FRC #4392 (Decievers) FRC #2075 (Enigma)
Team Role: College Student
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Grand Rapids, Michigan
Posts: 418
kgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to behold
Re: Closed Loop Speed Control

I know what a PID is I have already written code to tell how far the robot should go in autonomous. (If you watch a video of us during Grand Valley you'll see that we move back and fourth because we over shot our specified distance) Thanks for the help though. I understand victors now though.
Reply With Quote
  #8   Spotlight this post!  
Unread 28-03-2010, 22:51
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Closed Loop Speed Control

Quote:
Originally Posted by Don Rotolo View Post
You can get tighter control of the motor by making your loop run faster. If you run the loop at 100 times per second, you can maintain better control than if you run it once per second, for example.
FYI, the Jags run closed-loop at 1000 Hz.

~
Reply With Quote
  #9   Spotlight this post!  
Unread 28-03-2010, 22:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Closed Loop Speed Control

Quote:
Originally Posted by Vikesrock View Post
The ruling is directly in the manual, see <R68-H>:

H. the sensor inputs on the Jaguar speed controller.

Emphasis mine.
Would that include the limit switches as well? Someone suggested in another thread that limit switch inputs to Jags were prohibited if Jags were being controlled via PWM.


~
Reply With Quote
  #10   Spotlight this post!  
Unread 29-03-2010, 15:33
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,795
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: Closed Loop Speed Control

Rule R60-L

Quote:
L. If CAN-bus functionality is used, limit switch jumpers may be removed from a Jaguar speed controller and a custom limit switch circuit may be substituted (so that the cRIO-FRC may read the status of the limit switches).
And Q&A http://forums.usfirst.org/showthread.php?t=14956

Quote:
A: Please see Rule <R60-L>. You may use the limit switch inputs to the Jaguar speed controllers IF you are controlling the Jaguar via a CAN-bus connection. You can not use external limit switch inputs to the Jaguars if you are controlling them via PWM inputs.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 29-03-2010 at 15:35.
Reply With Quote
  #11   Spotlight this post!  
Unread 29-03-2010, 19:26
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Closed Loop Speed Control

Quote:
Originally Posted by Mark McLeod View Post
http://forums.usfirst.org/showthread.php?t=14956 says:

Quote:
You may use the limit switch inputs to the Jaguar speed controllers IF you are controlling the Jaguar via a CAN-bus connection. You can not use external limit switch inputs to the Jaguars if you are controlling them via PWM inputs.
My question is with the wording of the Q&A response. Either the grammar is not correct, or the GDC was trying to be helpful and share a (possibly not correct) limitation of the Jag's capabilities that does not seem to be documented in any of the Jag literature.

"You may use the limit switch inputs to the Jaguar speed controllers IF you are controlling the Jaguar via a CAN-bus connection."

"You can not use external limit switch inputs to the Jaguars if you are controlling them via PWM inputs."

I can find nothing in the Jag literature that says you can not use the limit switch inputs when commanding via PWM.

Did the GDC really mean "can not" or did they intend to communicate "shall not" or "are not permitted to" ?

Does anyone know if the limit switch inputs on the Jags work when the Jag is being commanded via PWM? And if so, has there been a clarification from GDC as to whether they intended to prohibit such use?


~
Reply With Quote
  #12   Spotlight this post!  
Unread 29-03-2010, 19:43
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Closed Loop Speed Control

Quote:
Originally Posted by Ether View Post
http://forums.usfirst.org/showthread.php?t=14956 says:



My question is with the wording of the Q&A response. Either the grammar is not correct, or the GDC was trying to be helpful and share a (possibly not correct) limitation of the Jag's capabilities that does not seem to be documented in any of the Jag literature.

"You may use the limit switch inputs to the Jaguar speed controllers IF you are controlling the Jaguar via a CAN-bus connection."

"You can not use external limit switch inputs to the Jaguars if you are controlling them via PWM inputs."

I can find nothing in the Jag literature that says you can not use the limit switch inputs when commanding via PWM.

Did the GDC really mean "can not" or did they intend to communicate "shall not" or "are not permitted to" ?

Does anyone know if the limit switch inputs on the Jags work when the Jag is being commanded via PWM? And if so, has there been a clarification from GDC as to whether they intended to prohibit such use?


~
They mean "may", not "can".

The limit switches do work with PWM mode, it is simply not allowed.
Reply With Quote
  #13   Spotlight this post!  
Unread 29-03-2010, 19:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
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: Closed Loop Speed Control

Quote:
Originally Posted by EricVanWyk View Post
They mean "may", not "can".

The limit switches do work with PWM mode, it is simply not allowed.
Thank you.

May I ask, without any sense of disrespect whatsoever, how do you know this?

I kind of get the impression that your word on certain matters is authoritative (you seem to be quite knowledgeable about cRIO hardware for example), but being somewhat new around here, I do not know from whence that authority arises.

~
Reply With Quote
  #14   Spotlight this post!  
Unread 29-03-2010, 20:03
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Closed Loop Speed Control

Quote:
Originally Posted by Ether View Post
Thank you.

May I ask, without any sense of disrespect whatsoever, how do you know this?

I kind of get the impression that your word on certain matters is authoritative (you seem to be quite knowledgeable about cRIO hardware for example), but being somewhat new around here, I do not know from whence that authority arises.

~
Sorry! No offense taken, I'll try to tone it down a bit.

I designed the kit of parts electronics that are encased in blue plastic (PD, DSC, and the breakouts) as well as some of the kit sensor boards (2009 and 2010 Gyro and Accelerometer).

I also did a bit of the architectural legwork before the project really kicked off in earnest. This puts me at a disadvantage, because sometimes I know what it was supposed to do 3-4 years ago, and not what it actually does now. Also, I don't touch software.
Reply With Quote
  #15   Spotlight this post!  
Unread 29-03-2010, 20:37
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,795
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: Closed Loop Speed Control

You can test the Jaguar limit inputs for yourself (I did) under PWM control.
Simply pull out the jumpers one at at time test Jaguar motion and replace.

It's one of the fault conditions we have people check for when their Jags don't work in one direction or another.

I have no official standing as does Eric however. I just tinker a lot and visit a bunch of teams who's purpose in life often seems to be to break things in interesting and unique ways...
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 29-03-2010 at 20:40.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
closed-loop torque (current) wheel control for mecanum Ether Programming 3 07-02-2010 00:54
Radio Packet loss + closed loop control system = lunging robot Dave K. Control System 5 20-02-2007 06:09
CPU loop speed Windward Programming 6 07-02-2007 15:22
PID control loops - closed loop feedback KenWittlief Technical Discussion 56 26-04-2004 21:27
How Can You Make A Closed Loop System???? GRR_340 Pneumatics 6 21-03-2002 12:27


All times are GMT -5. The time now is 11: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