View Single Post
  #19   Spotlight this post!  
Unread 19-05-2014, 22:36
randantor randantor is offline
Registered User
AKA: James Y
FRC #0624 (CRyptonite)
Team Role: Alumni
 
Join Date: Jun 2013
Rookie Year: 2012
Location: Katy, TX
Posts: 48
randantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of light
Re: What's your favorite programming/control system magic this year?

Quote:
Originally Posted by Tom Bottiglieri View Post
The wheel controller which followed the trajectory basically looked like this (one running for each wheel, using the given wheel's path data:
Code:
double update() {
  Segment step = follower.getNextSegment();
  double motor = 0;
  motor = (step.vel * K_vel) + (step.acc * K_acc) + (step.jerk * K_jerk);
  motor += ((step.pos - getWheelPos()) * K_p);
  return motor;
}
Very cool! Your last second change in the Einstein finals was exciting to watch, and the controlled s-curve was very impressive.

What I can gather from this code is that the motor speed for each side is first calculated with a feedforward term from the velocity, acceleration, and jerk, and then additionally a proportional feedback term is added using feedback from the actual encoder position. Is this correct?

If I'm reading it correctly, is there a reason why the feedforward velocity (the velocity, acceleration, and jerk sum) is calculated on the robot using the curve values rather than calculated beforehand and output as motor velocity values?