VEX Robotics Wiki

Covering VEX IQ, VEX EDR, and VEX Pro

User Tools

Site Tools


programming:controls_algorithms:tbh

Take-Back Half

Theory

Take Back Half is essentially an Integrator (the I portion of a PID Controller), but every time that the error crosses zero, the output is cut. This makes it a good option for use in velocity control, and it gained popularity in the 2015-16 Nothing But Net season of VRC.

A more in depth look at Take Back Half can be found in this forum thread: Flywheel Velocity Control

Advantages

  • Only one gain constant to tune - easier than PID
  • Fast Response Time
  • Decent stability except with exceedingly high gain

Disadvantages

  • Can only be used in velocity control applications

Example

After initializing the tbh, initial output, and gain parameters:

error = goal - currentSpeed;                // calculate the error;
output += gain * error;                     // integrate the output;
if (signbit(error)!= signbit(prev_error)) { // if zero crossing,
  output = 0.5 * (output + tbh);            // then Take Back Half
  tbh = output;                             // update Take Back Half variable
  prev_error = error;                       // and save the previous error
}

RobotC Example

programming/controls_algorithms/tbh.txt · Last modified: 2017/05/27 17:35 by 127.0.0.1