Go to Post Actually, please don't put any limits on your ideas or creativity at this point. Brainstorm, innovate, and contemplate whatever ideas you might like to consider. - dlavery [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 07-02-2016, 00:48
RyanCheng RyanCheng is offline
Registered User
FRC #3482
 
Join Date: Feb 2016
Location: Westmont
Posts: 2
RyanCheng is an unknown quantity at this point
Encoder Information Unknown

Hello,

I'm the lead programmer for FRC team 3482 and we've been having some trouble using the am-2816a encoder from your website. We have successfully hooked it up and it appears to function correctly but we have had some trouble using it. The goal is to have PID absolute position control but we haven't found the settings required. Primarily, we believe we need a codes/counts per revolution number for the encoder but its unclear if that's the same as the pulses per revolution number listed on the product page. Currently, we just have the encoder hooked up to the roboRIO directly but may try hooking it straight into a talon srx (so we can use code that is confirmed to work on the ctr encoders -- https://github.com/CrossTheRoadElec/...ot/Robot.java). Could you clarify what the codes/counts per revolution is and if available provide some sample code for closed loop position control?

Thanks,
Corey Mason
Reply With Quote
  #2   Spotlight this post!  
Unread 07-02-2016, 01:13
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,994
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: Encoder Information Unknown


The am-2816a is listed as 7 "Pulses Per Revolution". Since 7 is an odd number, that must mean 7 cycles per rev, which is 7 rising (or falling) edges per rev per channel, which is 14 rising+falling edges per rev per channel, which is 28 quadrature edges per rev.

So if you decode it at 1x you'll get 7 "counts" per rev, if you decode it at 2x you'll get 14 "counts" per rev, and if you decode it at 4x you'll get 28 "counts" per rev.


Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2016, 20:01
rohinb rohinb is offline
Registered User
FRC #3482
 
Join Date: Jan 2016
Location: Campbell, California
Posts: 3
rohinb is an unknown quantity at this point
Re: Encoder Information Unknown

Hi guys,
I am another programmer from the team who asked this question, We have been using the ratio suggested by Ether (7*50 -- 50 is the gear ratio), and the PID with a value of P=1.0 (we know this isn't a great value) and I and D equal to 0. The PID corrects the position very slowly for some reason and we don't know why. When we were using PID for a VEX Integrated CTR Encoder with which we didn't need to use the codes per revolution (since it was preset, but it was somewhere around 4096 native units), the motor would correct very quickly with just a P=.3. Are we doing something wrong and should the codes per revolution be different?
Thanks,
Rohin
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2016, 09:50
cjcopeland cjcopeland is offline
Registered User
FRC #6133
 
Join Date: Jan 2016
Location: Texas
Posts: 1
cjcopeland is an unknown quantity at this point
Re: Encoder Information Unknown

I am coaching a rookie team and still figuring all this out myself, but I did just successfully program that encoder yesterday.

We have that encoder on the back end of a motor with a 71:1 gear reduction. So with 7 pulses per rev x 71 we get 497 Codes per Rev. Multiplied times 4 for Quadrature is 1988, which I actually verified was the output from one rotation by reading System.out.println(talon.getEncPosition());

So ultimately I used the 497 as the Codes per Rev, but when I used the talon's PID set function for distance, I had to do it a slightly different way:
If I wanted one-half rotation (which is 497 * 1/2 * 4 = 994), then the line of code I would use was
talon.set(994/1998.0)

For some reason, it uses position in terms of rotation as its metric for determining how far to go. Maybe this is normal or maybe there is a way to change that part of it -- we are still learning.

Anyway, I hope that helped!
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 08:13.

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