FalconX-Robotics / frc2018

Code for our FRC 2018 robot.
MIT License
2 stars 5 forks source link

Autoshifting Drivetrain #4

Open moreheadm opened 6 years ago

moreheadm commented 6 years ago

Discussion about drivetrain auto-shifting can go here. My basic scheme last year is below. I will reference some variables.

MAX_LOW_GEAR - max speed in low gear MAX_HIGH_GEAR - max speed in high gear UPSHIFT_THRESH - speed to up shift at, should be slightly less than MAX_LOW_GEAR DOWNSHIFT_THRESH - speed to down shift at, should be slight greater than MAX_HIGH_GEAR

  1. Get the current speed of the robot (avg between left and right speeds worked last year).
  2. Calculate the target speed of the robot, how fast the controller says to go. For example, if you are using tank drive and both sticks are push forward, targetSpeed = MAX_HIGH GEAR (this is tricky, discuss below)
  3. If our actual speed is above the UPSHIFT_THRESH and targetSpeed above the DOWNSHIFT_THRESH, shift to high gear.
  4. If our actual speed is below the DOWNSHIFT_THRESH and targetSpeed below MAX_LOW_SPEED, shift low.

In general, the drivetrain subsystem should have code to enable shifting to high gear, shifting to low gear, and running the motors with a particular power. Could someone below write out the methods we need to accomplish this in this issue.