garykac / amhs-robotics-4681

Repository for AMHS's FRC (FIRST Robotics Competition) team
3 stars 0 forks source link

Cmarley condensed robot code #26

Closed cmarley3-14 closed 5 years ago

cmarley3-14 commented 5 years ago

Changes Made:

Lifter:
Changed the comparison tests so that it would see if the distance was above the target height or below, and move accordingly, instead of testing if the lifter was at a certain place. Because once the lifter is in transition, it wouldn't have fit any of the cases.

LifterHight: Changed the height variables to public because they now need to be accessed in Lifter.java And then added extra spacing for the brackets and if statements (re-formatting).

Robot: Created AutonomousPeriodic, which is part of the FIRST library. Added the drive controls, suck grab eject, and left climb out.
Moved the code for lifting (The POV and switch statement stuff) out of TeleopPeriodic() and into its own function lifterOperatorCode(), because there's two exact same copies in both auto and teleop. Just to make the code shorter. Changed Climb() to a series of steps which progress by pressing start. This is because with Climb(), one assumes that the robot will move backwards onto the platform in the short amount of time given by the quick succession of steps in such a function. The steps are more like:

raise robot
walk (the robot legs are angled such that the robot falls onto the platform)
retract back legs
drive backward a sufficient distance so the robot won't fall off the platform when...
the front legs are retracted

The driving portion of the steps was not accounted for, so the code was changed to compensate for that.

And that's the summary of the changes!

sprice134 commented 5 years ago

It looks good to me, Id say we just gotta test it on the robot to make sure everything is in order. Only concern is more of a general concern than a specific coding change but making sure that the climbing function is fully completed before moving on, and possibly preventing a driver from moving to phase 2 (or whatever the next phase is) prior to completing the previous one.