|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Analog Encoder Troubles
We're trying to use an analog encoder (http://www.usdigital.com/products/mae3) to measure rotations off of a motor shaft. I'm trying to use the Counter class for this, but the measurements are very erratic. It'll halt measuring at all for a few seconds, then the number will increment by 4 or 5, and then it will start regularly updating but by increments of 2 for a while, then normally by increments of 1, etc etc. The motor shaft is turning at a constant speed.
Right now in the subsystem that's executing the counter code I have Code:
private static AnalogTrigger horRotEncoder = new AnalogTrigger(RobotMap.horRotEncoderPos); private static Counter horRotCounter = new Counter(horRotEncoder, true, true); Then I have Code:
protected void initDefaultCommand() {
horRotCounter.setUpSource(horRotEncoder, AnalogTriggerOutput.Type.kRisingPulse);
horRotCounter.setUpSourceEdge(true,false);
horRotCounter.reset();
horRotCounter.start();
}
public double getHorRotations(){
return horRotCounter.get();
}
We have an oscilloscope hooked up to the encoder, so we can see it's getting the right values, so I suspect the problem is in the Counter class. |
|
#2
|
||||
|
||||
|
Re: Analog Encoder Troubles
Quote:
I thought the Counter class was for counting pulses. The device you linked to provides only analog or PWM output of absolute angular position. from the datasheet: Analog output provides an analog voltage that is proportional to the absolute Last edited by Ether : 18-02-2012 at 18:29. |
|
#3
|
|||
|
|||
|
Re: Analog Encoder Troubles
We were trying to use Counter with an analog input created from the Encoder. I thought the analog output of the encoder might be acceptable to it, and it seems to work, just very sporadically.
EDIT: To be more clear, horRotEncoder is an AnalogTrigger, which takes the AnalogInput from the encoder, and should essentially convert that to a digital signal triggered by the analog input's shifts from 5v to 0v and vice versa. Last edited by jesusrambo : 18-02-2012 at 18:38. |
|
#4
|
||||||
|
||||||
|
Re: Analog Encoder Troubles
We did this a few years ago in LabVIEW. Here's how we opened everything. Maybe it will help getting it working in Java.
|
|
#5
|
||||
|
||||
|
Re: Analog Encoder Troubles
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|