Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   RPM calculator (http://www.chiefdelphi.com/forums/showthread.php?t=103825)

cooltext 25-02-2012 19:40

RPM calculator
 
I have the AS5030 rotary encoders and I was trying to find a way to calculate the RPM of our shooter motors with it. Does any one have any idea how to do so? I tried the counter class but I am having trouble selecting the

Code:

  AnalogTriggerOutput.Type triggerType
to use and how to calculate what voltage limits I should use for kTypeState.

Also how could I make it so it had a very small sampling time like .1 of a second?

dbeckwith 27-02-2012 09:31

Re: RPM calculator
 
Try just using the Encoder class. That should have everything you need. Just make sure you use setDistancePerPulse() with the right units and you can get the speed (this class gives speeds in units per second, not minute, but you can always scale it).

Joe Ross 27-02-2012 11:19

Quote:

Originally Posted by dbeckwith (Post 1135527)
Try just using the Encoder class. That should have everything you need.


The AS5030 is not a quaderature encoder. It won't work with the encoder class.

joelg236 27-02-2012 17:02

Re: RPM calculator
 
Quote:

Originally Posted by Joe Ross (Post 1135557)
The AS5030 is not a quaderature encoder. It won't work with the encoder class.

And what would you suggest then? That was not helpful.

Ether 27-02-2012 17:45

Re: RPM calculator
 
Quote:

Originally Posted by joelg236 (Post 1135701)
And what would you suggest then? That was not helpful.

Well, it helped him avoid wasting time going down a rabbit hole.

A bit of advice, if you are open to it: as a newcomer you might want to be a bit more respectful, especially with people like Joe who have helped countless people over the past 10 years.



cooltext 27-02-2012 20:17

Re: RPM calculator
 
Thanks for your replies, but I was just wondering if anyone had any ideas for the RPM issue?

thanks
Dimitir

Ether 28-02-2012 10:37

Re: RPM calculator
 
Quote:

Originally Posted by cooltext (Post 1135806)
Thanks for your replies, but I was just wondering if anyone had any ideas for the RPM issue?

You could try opening the P1 solder bridge and connecting the JP3-1 Cos signal to DIO and use the Counter class. Not sure if that would work. Has anyone tried it?

Or you could use a sensor more suited to your purpose.



ProgrammerMatt 28-02-2012 11:39

Re: RPM calculator
 
The encoder class works with both i belive..
if so
Code:

Encoder myencoder = new Encoder(#);

myencoder.getRate();

the the rate works off ticks per secound you need to scale it down.

dbeckwith 28-02-2012 16:41

Re: RPM calculator
 
Quote:

Originally Posted by ProgrammerMatt (Post 1136123)
The encoder class works with both i belive..
if so
Code:

Encoder myencoder = new Encoder(#);

myencoder.getRate();

the the rate works off ticks per secound you need to scale it down.

No, I think Joe is right. The Encoder class is for quadrature encoders which use two signals, and this encoder the OP is trying to use only has one signal and if I'm not mistaken produces a different type of signal (the way it counts rotation is different). It's unfortunate that there's no built-in FRC class for those encoders though.

Ether 28-02-2012 16:57

Re: RPM calculator
 

According to the operation manual for the AS5030 adapter board, if you open the P1 solder bridge you can access cos&sin quadrature signals at JP3 pins 1&3. Not sure if the WPILib Encoder class will work with those waveforms without some signal conditioning. Has anyone tried and succeeded?


Ether 28-02-2012 20:04

Re: RPM calculator
 
Quote:

Originally Posted by Ether (Post 1136083)
You could try opening the P1 solder bridge and connecting the JP3-1 Cos signal to DIO and use the Counter class. Not sure if that would work. Has anyone tried it?

Apparently someone has tried it, and was successful. See Post#3 in this thread:

https://decibel.ni.com/content/thread/11955



ProgrammerMatt 28-02-2012 23:00

Re: RPM calculator
 
Does it output analog or digital? if its digital try using the Counter class, if its analog then use something like
Code:

int count
if(encoder.getVoltage() >"voltage when ticked") {
count = count + 1; // or count ++;

P.S i would think it is digital but if its not try that /\

mwtidd 28-02-2012 23:09

Re: RPM calculator
 
Get rate is not ideal.

We store a last time variable.

Take counter.getdistance / (current time - last time)

Then reset the counter.

You will get a much stabler speed this way

ProgrammerMatt 01-03-2012 17:30

Re: RPM calculator
 
Quote:

Originally Posted by lineskier (Post 1136556)
Get rate is not ideal.

We store a last time variable.

Take counter.getdistance / (current time - last time)

Then reset the counter.

You will get a much stabler speed this way


this is straight out of the encoder class
Code:

    * Get the current rate of the encoder.
    * Units are distance per second as scaled by the value from setDistancePerPulse().

its practically the same as current time - last time

Ether 01-03-2012 19:34

Re: RPM calculator
 
Quote:

Originally Posted by ProgrammerMatt (Post 1137336)
...its practically the same as current time - last time

GetRate() computes the rate based on the elapsed time of a single encoder pulse (the most recent one).

This is manifestly not the same as the computing the rate using delta counts since the last sample and dividing by the elapsed time since the last sample, for sample periods on the order of 20ms and encoder pulse periods associated with shooter wheel speeds.




All times are GMT -5. The time now is 21:14.

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