View Single Post
  #1   Spotlight this post!  
Unread 01-02-2014, 15:01
SteveJ4564 SteveJ4564 is offline
Registered User
FRC #4564 (Orange Chaos)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Maine
Posts: 3
SteveJ4564 is an unknown quantity at this point
Hmm...How can I respond quicker to encoder input?

I've been searching the forums to get some insight into this problem, but haven't found a good solution yet.

We have a catapult system that is driven with a couple CIM motors, gearboxes, chains, and there's a rotary encoder on one of the gearboxes. Right now we have Jaguars driving this mechanism, with electronic braking enabled.

The concept is to apply full power to the catapult arm and accelerate the ball up until we reach a predetermined encoder count, which is the desired release point for the toss. A simple bit of Java code just watches the encoder and when the count has reached or exceeded the target count, set the motor speed to zero. By adjusting the target count, we can change the launch angle of the ball. Simple...

What we're finding is that the Java code is not running quick enough to keep up with the rapid arm movement. The control loop is running around 15ms, but at that rate the arm can move several degrees beyond the targeted stop before the code even notices it.

As a possible solution, I'm thinking of running a scheduled timer thread that does nothing more than watch the encoder count and stop the motors as appropriate. Would scheduling that to run once every millisecond be practical in the Java/cRIO environment?

Maybe there's a much smarter way to watch the encoder count and stop the motors. What other approaches might work?

Thanks for your thoughts.

Steve