|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Encoder setDistancePerPulse()
So I hooked up our encoder and tried out both counter and encoder
all i essentially did was this: Code:
roboInti{
sensor.start();
}
teleopPeriodic{
System.out.println(senser.getCount());
or
System.out.println(senser.getRate());
}
If I used the getRate(), I get NaN I'm assuming that I need to use setDistancePerPulse I have the E4P, so what should I set as the distance per pulse? |
|
#2
|
|||
|
|||
|
Re: Encoder setDistancePerPulse()
Quote:
|
|
#3
|
|||
|
|||
|
Re: Encoder setDistancePerPulse()
We had this same problem too. The quick fix appears to be to construct the Encoder with a 2x encoding type, i.e.
Code:
//Assuming Encoder is connected to DIO 1 and 2 and not reversed Encoder sensor = new Encoder(1,2,false,CounterBase.EncodingType.k2x) Hope that helps! ![]() |
|
#4
|
||||||
|
||||||
|
Re: Encoder setDistancePerPulse()
Quote:
|
|
#5
|
|||
|
|||
|
Re: Encoder setDistancePerPulse()
Quote:
Any idea what it means? UPDATE nvm, I did a powercycle and i got better numbers what are the units the encoder returns? Last edited by kinganu123 : 31-01-2011 at 12:32. |
|
#6
|
|||
|
|||
|
Re: Encoder setDistancePerPulse()
The encoder returns distance per second. The exact units depend on what units you used in distancePerPulse(). I think you will have to divide the rate by 2 because of the 2x Encoding type.
Hope that helps ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|