Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Encoder Question (http://www.chiefdelphi.com/forums/showthread.php?t=154451)

tomy 29-01-2017 22:35

Encoder Question
 
My team wants to use an encoder to keep track of their shooter. We are using command based java this year. If we are using a gear tooth counter on a digital input, how would we calculate the DistancePerPulse? We are using a 40 tooth gear. There is no gear reduction. All help appreciated.

GeeTwo 30-01-2017 00:03

Re: Encoder Question
 
Sorry, but I'm not at all sure what you're trying to ask here. In the first place, why are you using a gear if there's no gear reduction? (I can think of one reason, but it's not likely as the question is phrased.) Or do you mean that you are measuring teeth on the bull gear (that is, the output gear of the shooter)?

You are trying to calculate "distance per pulse". There are no lengths in your question, so whatever you're asking, there is not enough info. What is the effective moment arm/radius of your shooter?

---------------------------------------------------------------------------------------

OK, trying to put together something reasonable: You are counting teeth on the last (output end) gear in your shooter, which is rotating at the same speed as a wheel X inches in diameter. The circumference of that wheel is πX inches. The distance that the edge of the wheel moves per pulse (assuming one pulse per tooth) is πX/40. If there are p pulses per tooth, that becomes πX/40p.

If my assumptions aren't right, please post the corrections so we can help out.

tomy 30-01-2017 06:55

Re: Encoder Question
 
Sorry for being vague. Yes we are planning on using a 40 tooth bull gear on the output shaft of the shooter. The wheels of the shooter are 4 inch diameter. We need to calculate the rpm. We haven't used encoders before. We are also wondering what would change if we used a 20 tooth gear vs a 40 tooth gear.

YairZiv 30-01-2017 07:10

Re: Encoder Question
 
Quote:

Originally Posted by tomy (Post 1638018)
Sorry for being vague. Yes we are planning on using a 40 tooth bull gear on the output shaft of the shooter. The wheels of the shooter are 4 inch diameter. We need to calculate the rpm. We haven't used encoders before. We are also wondering what would change if we used a 20 tooth gear vs a 40 tooth gear.

Well, the simplest way to check your distance per pulse is finding out how many pulses you get in one rotation (using the encoder to print how many pulses you've passed through in the SmartDashboard or something like that). Then use 1 / theNumberYouGot as the distance per pulse.

EmileH 30-01-2017 07:27

Re: Encoder Question
 
What type of Motor Controller are you using? If you're wiring your encoder into the Talon SRX, you can call YOUR_TALON_OBJECT.getSpeed() to get the RPM of the sensor.

tomy 30-01-2017 07:55

Re: Encoder Question
 
Quote:

Originally Posted by YairZiv (Post 1638021)
Well, the simplest way to check your distance per pulse is finding out how many pulses you get in one rotation (using the encoder to print how many pulses you've passed through in the SmartDashboard or something like that). Then use 1 / theNumberYouGot as the distance per pulse.

Ok that makes sense but how we figure that into rpm? We would have pulses per rotation.

Quote:

Originally Posted by EmileH (Post 1638026)
What type of Motor Controller are you using? If you're wiring your encoder into the Talon SRX, you can call YOUR_TALON_OBJECT.getSpeed() to get the RPM of the sensor.

We are using a talon srx but we are not using an encoder. We are using a gear tooth sensor.

GeeTwo 30-01-2017 08:10

Re: Encoder Question
 
Quote:

Originally Posted by tomy (Post 1638028)
Ok that makes sense but how we figure that into rpm? We would have pulses per rotation.

Figure out how many pulses per minute (ppm), and divide by the number of pulses per rotation (ppr) to get rotations per minute (rpm). For example, if you get 160 ppr, and count 40 pulses in 10 ms, then you would have 60 (sec/min) * 100 (10 ms/sec) *40 (pulses/10 ms) =240,000 ppm and 240,000 ppm / 160 ppr = 1500 rpm.

Quote:

Originally Posted by tomy (Post 1638028)
We are using a talon srx but we are not using an encoder. We are using a gear tooth sensor.

If it's counting gears as they rotate, it's an encoder. Encoders can be magnetic, optical, proximity, mechanical, or any other consistent means of detecting a fractional rotation or motion.

tomy 30-01-2017 08:12

Re: Encoder Question
 
Quote:

Originally Posted by GeeTwo (Post 1638029)
Figure out how many pulses per minute (ppm), and divide by the number of pulses per rotation (ppr) to get rotations per minute (rpm). For example, if you get 160 ppr, and count 40 pulses in 10 ms, then you would have 60 (sec/min) * 100 (10 ms/sec) *40 (pulses/10 ms) =240,000 ppm and 240,000 ppm / 160 ppr = 1500 rpm.



If it's counting gears as they rotate, it's an encoder. Encoders can be magnetic, optical, proximity, mechanical, or any other consistent means of detecting a fractional rotation or motion.

Thanks for the info. Would we have to use the talon SRx in cAN mode or in pwm mode if we hook it up that way. Also would we still have to set the distance per pulse.

GeeTwo 30-01-2017 08:18

Re: Encoder Question
 
Quote:

Originally Posted by tomy (Post 1638032)
Thanks for the info. Would we have to use the talon SRx in cAN mode or in pwm mode if we hook it up that way. Also would we still have to set the distance per pulse.

If you connect the encoder to the Talon SRX inputs, you will need to use CAN. If you connect the encoder to roboRIO inputs, you can use either PWM or CAN.

I have not done any coding using the SRX internals, sorry.

ozrien 30-01-2017 13:02

Re: Encoder Question
 
Gear tooth sensors are supported.

See Section 17.1.4. EncRise (a.k.a. Rising Counter) in the Talon SRX Software Reference Manual for reference to gear-tooth sensor.

See Talon SRX User's Manual for wiring.


All times are GMT -5. The time now is 09:46.

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