EZ-Robotics / EZ-Template

Simple plug-and-play PROS template that handles drive base functions for VEX robots.
https://ez-robotics.github.io/EZ-Template/
Mozilla Public License 2.0
69 stars 27 forks source link

Wider/Smaller Swings and PID Locking Opposite Side in Swings #83

Closed ssejrog closed 7 months ago

ssejrog commented 7 months ago

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)