Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Setting RPMs on motors (http://www.chiefdelphi.com/forums/showthread.php?t=101022)

hsekhon27 24-01-2012 08:06

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?

404'd 24-01-2012 08:19

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.

Mark McLeod 24-01-2012 08:21

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.

carrillo694 24-01-2012 12:22

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.

Ether 24-01-2012 14:15

Re: Setting RPMs on motors
 
Quote:

Originally Posted by carrillo694 (Post 1112632)
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?


billbo911 24-01-2012 16:04

Re: Setting RPMs on motors
 
1 Attachment(s)
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.

Ether 24-01-2012 16:24

Re: Setting RPMs on motors
 
Quote:

Originally Posted by billbo911 (Post 1112728)
The simple explanation is that we are using this like the "I" function in PID.

Plus feedforward.


hsekhon27 24-01-2012 21:46

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

bhsrobotics1671 24-01-2012 22:33

Re: Setting RPMs on motors
 
Quote:

Originally Posted by Ether (Post 1112684)
Have you successfully done this?


We have!

Ether 24-01-2012 23:21

Re: Setting RPMs on motors
 
Quote:

Originally Posted by bhsrobotics1671 (Post 1113003)
We have!

With a drivetrain too? Or just a free-spinning wheel?


pfreivald 24-01-2012 23:32

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.

hsekhon27 24-01-2012 23:50

Re: Setting RPMs on motors
 
Just the wheel

carrillo694 25-01-2012 00:18

Re: Setting RPMs on motors
 
Quote:

Originally Posted by Ether (Post 1112684)
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.

Ether 25-01-2012 08:33

Re: Setting RPMs on motors
 
Quote:

Originally Posted by carrillo694 (Post 1113079)
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


davidthefat 25-01-2012 10:08

Re: Setting RPMs on motors
 
You can use a PID Controller and use RPM as the unit.


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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi