View Single Post
  #12   Spotlight this post!  
Unread 01-03-2013, 19:45
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
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 getRate question

Quote:
Originally Posted by AsianRookie View Post
shooterEncoder = new Encoder(RobotMap.SHOOTER_ENCODER_A, RobotMap.SHOOTER_ENCODER_B, true, CounterBase.EncodingType.k4X);
shooterEncoder.setDistancePerPulse(4/360);//4:1 gear ratio
You do not want to use getRate() with a 360 CPR encoder with 4X decoding at shooter wheel speeds.

See the first attachment


Do this instead:

1) Connect only Channel A of the encoder to the DSC, and use an up/down counter (from the Counter class) set to count up only. Leave Channel B disconnected.

2) Set the FPGA sampling ring buffer size to 120.

3) Use the counter class's getPeriod() to get the period, then calculate rpm = 60/(360*period)

See the second attachment.




Attached Thumbnails
Click image for larger version

Name:	5000rpm 1440CPR 4N.png
Views:	79
Size:	5.8 KB
ID:	14220  Click image for larger version

Name:	5000rpm 360CPR 120N.png
Views:	71
Size:	5.6 KB
ID:	14221  

Last edited by Ether : 01-03-2013 at 20:12.
Reply With Quote