Go to Post Each team is different, your mileage may vary. What works for your team does NOT necessarily mean it will work for others. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2012, 18:01
jesusrambo jesusrambo is offline
Self-Proclaimed Programmer Messiah
AKA: JD Russo
FRC #2035 (Robo Rockin' Bots)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Carmel, CA
Posts: 114
jesusrambo is an unknown quantity at this point
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);
to declare the Encoder and the Counter.

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();
}
What I've tried to do with that is make it only count when it increments up, just for testing. And I'm printing the output of getHorRotations() to see what the values are.

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.
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2012, 18:25
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,042
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Analog Encoder Troubles

Quote:
Originally Posted by jesusrambo View Post
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

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
shaft position. Analog output is only available in 10-bit resolution.

PWM output provides a pulse width duty cycle that is proportional to the absolute
shaft position.


Last edited by Ether : 18-02-2012 at 18:29.
Reply With Quote
  #3   Spotlight this post!  
Unread 18-02-2012, 18:29
jesusrambo jesusrambo is offline
Self-Proclaimed Programmer Messiah
AKA: JD Russo
FRC #2035 (Robo Rockin' Bots)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Carmel, CA
Posts: 114
jesusrambo is an unknown quantity at this point
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 19-02-2012, 14:47
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
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.
Attached Thumbnails
Click image for larger version

Name:	ContPotOpen.png
Views:	28
Size:	34.7 KB
ID:	11994  
Reply With Quote
  #5   Spotlight this post!  
Unread 19-02-2012, 14:56
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,042
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Analog Encoder Troubles

Quote:
Originally Posted by Joe Ross View Post
We did this a few years ago in LabVIEW. Here's how we opened everything. Maybe it will help getting it working in Java.
Clever !


Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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