Team2168 / 2015_Main_Robot

Source code for the 2015 season
2 stars 0 forks source link

Prevent Auto Lowering On Bin #102

Open NotInControl opened 9 years ago

NotInControl commented 9 years ago

@jcorcoran , @ExcelledProducts

This is the one thing I did not do in code completely. We already have the sensor mounted so its pretty easy to add.

The IR sensor mounted to the gearbox is used to detect if a BIN is in the intake, in auto if this condition ever happens we want to prevent the lift from lowering.

In the three tote auto, we use the WaitForObjectInIntake() command to wait before the lift can lower. The easiest thing to do would be to modify this line:

https://github.com/Team2168/2015_Main_Robot/blob/master/src/org/team2168/commands/intake/WaitForObjectInIntake.java#L28

to be something like

return (Robot.intake.getAveragedRawToteDistance() > RobotMap.INTAKE_TOTE_STOP_VOLTAGE ) && (Robot.intake.getAveragedRawRCDistance() < RobotMap.INTAKE_RC_PRESENT_VOLTAGE);

You would just need to reconfirm the value, and also make sure the mount is rigit.

Also after completing the above add the following line

addSequential(new WaitForObjectInIntake());

right before this line. This will prevent the last lower from lowering onto a bin: https://github.com/Team2168/2015_Main_Robot/blob/master/src/org/team2168/commands/auto/Auto_ThreeToteStackRollingBins.java#L111

After these changes, the code should prevent auto lowering on a bin