There are two improvements that need to be made that both intertwine with each other.
The problem with this code is the opposite side of the drive can potentially move during the swing, leading to inconsistencies.
if (current_swing == LEFT_SWING)
private_drive_set(swing_out, 0);
else if (current_swing == RIGHT_SWING)
private_drive_set(0, -swing_out);
Instead we should run PID on that side of the drive to stop it from moving.
But with this, we should also have an option to set that side to some power to allow for wider swing turns. This should be some constant power that scales with the powered side. This was implemented in EZ-Template before it was released and somewhere got removed. This can also allow for smaller swings by setting the opposite side to a negative number.
The opposite side should be set to opposite side power * (swing_out / max_speed)
There are two improvements that need to be made that both intertwine with each other.
The problem with this code is the opposite side of the drive can potentially move during the swing, leading to inconsistencies.
Instead we should run PID on that side of the drive to stop it from moving.
But with this, we should also have an option to set that side to some power to allow for wider swing turns. This should be some constant power that scales with the powered side. This was implemented in EZ-Template before it was released and somewhere got removed. This can also allow for smaller swings by setting the opposite side to a negative number.
The opposite side should be set to
opposite side power * (swing_out / max_speed)