Go to Post FIRST is nothing short of a community. - karinka13 [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 24-01-2012, 08:06
hsekhon27 hsekhon27 is offline
Registered User
FRC #0280 (TNT)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2011
Location: Taylor, MI
Posts: 23
hsekhon27 is an unknown quantity at this point
Setting RPMs on motors

To get an accurate trajectory on the ball, I wanna preset the RPMs on the shooting motor. I know you can just put in integer values like 1 for the motor speed, but what do these numbers mean? 1 meaning 1000 RPM?
  #2   Spotlight this post!  
Unread 24-01-2012, 08:19
404'd's Avatar
404'd 404'd is offline
Lead contributor of sweg
AKA: Josh
FRC #0967 (Iron Lions (9-sits-7))
Team Role: Alumni
 
Join Date: Mar 2011
Rookie Year: 2009
Location: Marion, Iowa
Posts: 86
404'd is a name known to all404'd is a name known to all404'd is a name known to all404'd is a name known to all404'd is a name known to all404'd is a name known to all
Re: Setting RPMs on motors

The output 0-1 is just a power value, 0 being stopped 1 being full power. To do RPM control you need some type of feedback, like an encoder.
__________________
Driving "Career":
2012 GKC: Quarterfinals w/ 6th seeded alliance | Wisconsin: Quarterfinals - 3rd seeded alliance captains
2013 GKC: Quarterfinals w/ 5th seeded alliance | North Star: Regional winners, 2nd seeded alliance captains
2013 CMP: Curie Semis w/ 2056 + 3990
  #3   Spotlight this post!  
Unread 24-01-2012, 08:21
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: Setting RPMs on motors

The numbers -1 to 1 only refer to the battery voltage as it is at the moment.
It won't give you a specific RPM and will vary as you syphon power off to other motors (like your drivetrain), and as your battery gradually depletes itself during a match.

To get a consistent RPM you will need a feedback sensor and what's called a PID software loop to maintain a set RPM.
For feedback you can use an encoder (some come in the Kit of Parts), or a light sensor that counts the passing of a marker on your spinning shooter wheel, or various other types of measuring sensors/devices.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #4   Spotlight this post!  
Unread 24-01-2012, 12:22
carrillo694's Avatar
carrillo694 carrillo694 is offline
Alex Carrillo
FRC #0694 (Stuypulse)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: New York, NY
Posts: 66
carrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the rough
Re: Setting RPMs on motors

If you are using CAN with Jaguars, then you can easily set speeds using their built-in control feedback loop system and plugging your encoder into your Jaguar. For Java, see the CANJaguar javadocs, and note the "control mode" variable, which you can set to kSpeed, setPID(), and set() method. You will have to tell it how many encoder codes your encoder will report per revolution as well.

If you want to see an example of making your own feedback loops for Victors, you can check out a (Java) class we wrote last year to do this here.
  #5   Spotlight this post!  
Unread 24-01-2012, 14:15
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: Setting RPMs on motors

Quote:
Originally Posted by carrillo694 View Post
If you are using CAN with Jaguars, then you can easily set speeds using their built-in control feedback loop system and plugging your encoder into your Jaguar
Have you successfully done this?

  #6   Spotlight this post!  
Unread 24-01-2012, 16:04
billbo911's Avatar
billbo911 billbo911 is online now
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,384
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Setting RPMs on motors

Here is a picture of periodic task that we have run on our test platform. It seems to perform quite well for maintaining desired RPM. YMMV.

The simple explanation is that we are using this like the "I" function in PID. This runs 100 times per second.

The 250 multiplier/divisor is found by reading your maximum rate count without feedback at full speed.
Attached Thumbnails
Click image for larger version

Name:	Rate control.JPG
Views:	676
Size:	50.4 KB
ID:	11550  
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #7   Spotlight this post!  
Unread 24-01-2012, 16:24
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: Setting RPMs on motors

Quote:
Originally Posted by billbo911 View Post
The simple explanation is that we are using this like the "I" function in PID.
Plus feedforward.

  #8   Spotlight this post!  
Unread 24-01-2012, 21:46
hsekhon27 hsekhon27 is offline
Registered User
FRC #0280 (TNT)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2011
Location: Taylor, MI
Posts: 23
hsekhon27 is an unknown quantity at this point
Re: Setting RPMs on motors

Okay I have never programmed an encoder before and I'm confused by the begin vi. Can someone please post a sample code for an encoder to set the desired RPMs? Thanks
  #9   Spotlight this post!  
Unread 24-01-2012, 22:33
bhsrobotics1671's Avatar
bhsrobotics1671 bhsrobotics1671 is offline
Andrew Nabors
AKA: Andrew Nabors
FRC #1671 (Buchanan Bird Brains)
Team Role: Coach
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Clovis, CA
Posts: 284
bhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to behold
Re: Setting RPMs on motors

Quote:
Originally Posted by Ether View Post
Have you successfully done this?

We have!
__________________
Buchanan Bird Brains - FRC Team 1671
2015 FIRST World Champions
118, 1678, 1671, 5012
  #10   Spotlight this post!  
Unread 24-01-2012, 23:21
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: Setting RPMs on motors

Quote:
Originally Posted by bhsrobotics1671 View Post
We have!
With a drivetrain too? Or just a free-spinning wheel?

  #11   Spotlight this post!  
Unread 24-01-2012, 23:32
pfreivald's Avatar
pfreivald pfreivald is offline
Registered User
AKA: Patrick Freivald
FRC #1551 (The Grapes of Wrath)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2001
Location: Naples, NY
Posts: 2,304
pfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond repute
Re: Setting RPMs on motors

Our plan is to use the kit encoders direct-mounted to our flywheel shafts. Does anyone know if the manufacturer claim of up to 10,000 rpm is accurate? We'd rather not add the weight, complexity, and inefficiency of having to gear down an idler for the encoder to take rates.
__________________
Patrick Freivald -- Mentor
Team 1551
"The Grapes of Wrath"
Bausch & Lomb, PTC Corporation, and Naples High School

I write books, too!
  #12   Spotlight this post!  
Unread 24-01-2012, 23:50
hsekhon27 hsekhon27 is offline
Registered User
FRC #0280 (TNT)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2011
Location: Taylor, MI
Posts: 23
hsekhon27 is an unknown quantity at this point
Re: Setting RPMs on motors

Just the wheel
  #13   Spotlight this post!  
Unread 25-01-2012, 00:18
carrillo694's Avatar
carrillo694 carrillo694 is offline
Alex Carrillo
FRC #0694 (Stuypulse)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: New York, NY
Posts: 66
carrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the roughcarrillo694 is a jewel in the rough
Re: Setting RPMs on motors

Quote:
Originally Posted by Ether View Post
Have you successfully done this?

Define "success." We did it on our drivetrain last year, with each wheel being controlled separately, and tuned the values using BDC-COMM. Were we able to control the speed of the wheels comfortably? Yes. But we faced typical Jaguar reliability issues that led us to replace them with Victors + homebrewed speed control code.
  #14   Spotlight this post!  
Unread 25-01-2012, 08:33
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: Setting RPMs on motors

Quote:
Originally Posted by carrillo694 View Post
Define "success."
In this context, I guess I meant:

- did you measure the actual steady-state output speed and confirm that it was indeed equal to the speed you were commanding?

- was it stable?

- was the dynamic response "good"? (I know, define "good". How about a rough estimate of step response compared to voltage mode or %Vbus mode)

- for a given speed command, did the controller hold the same output speed under different loads?

The reason I ask is that if you were successful, the folks at this thread would like to hear about it:
http://www.chiefdelphi.com/forums/sh...d.php?t=100135

  #15   Spotlight this post!  
Unread 25-01-2012, 10:08
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Setting RPMs on motors

You can use a PID Controller and use RPM as the unit.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
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:04.

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