FRC2706 / 2019-2706-Robot-Code

The main robot code for the FIRST 2019 challenge: Deep Space
MIT License
2 stars 0 forks source link

Rcvi vision3 #160

Closed robertlucyshyn closed 5 years ago

robertlucyshyn commented 5 years ago

Summary of Changes

Added two features: 1) Two-stage driver assist: Stage 1 positions robot at a large offset (e.g. 3 feet) but in line with the target while Stage 2 moves it to the target. Note that you can go directly to Stage 2 if you want. If you press the Stage 1 button when you are already close to the target so that in theory the robot would have to move backwards, the command will be aborted. 2) Absolute gyro reset: Used to correct absolute gyro drift, when you are aligned with any of the field targets, it will reset the absolute gyro angle to be equal to the angle of the target. This assumes that the gyro has drifted less than +/- 45 degrees for cargo ship or loading bay target and less than +/- 30 degrees for a rocket ship target.

This code has the following key bindings:

LB button: Stage 1 Driver Assist Vision Cargo Ship or Loading Bay Target Left Trigger: Stage 2 Driver Assist Vision Cargo Ship or Loading Bay Target

RB button: Stage 1 Driver Assist Vision Rocket Target Right Trigger: Stage 2 Driver Assist Vision Rocket Target

X button: Absolute Gyro Reset Rocket Target B button: Absolute Gyro Reset Rocket Target

The following fluid constants in Config are relevant to this pull request:

TARGET_OFFSET_DISTANCE_INITIAL: Offset for Stage 1 Assists in feet (all targets)

TARGET_OFFSET_DISTANCE_FINAL_CARGO_AND_LOADING: Offset for Stage 2 Assist in feet (cargo ship and loading bay targets)

TARGET_OFFSET_DISTANCE_FINAL_ROCKET: Offset for Stage 2 Assist in feet (rocket targets)

FINAL_POSITION_ADJUSTMENT_X: Correction factor (in feet) if robot is consistently off in the horizontal direction when it reaches the target. Used only in Stage 2. Positive is to the right when looking from back to front of robot. This value should be equivalent to a few inches at the very most.

Testing Performed

Environment: Practice bot Tested Driver Vision Assist and AbsoluteGyroReset commands on simulated field targets in all possible orientations.

KyleRAnderson commented 5 years ago

@robertlucyshyn I guess we haven't really done a drive practice with this have we? It would be good to practice this in a match-like setting to replicate how it behaves as well as to start getting used to this, but not sure if we have time.

robertlucyshyn commented 5 years ago

Ryan and Eric were testing it for a while at the chili dinner and it looked promising, but I agree that more practice would be needed. (There was also the issue where the robot got stuck in one position at the end of the night. See Ryan for details. There is a possible fix in the pull request but we can't be sure if the issue is gone because the problem was not reproducible---it only happened once in the many uses of driver assist throughout the evening.) You and Erik want to get very familiar with using the four driver assist buttons and the two gyro reset buttons. I think the only remaining time to test would be either tonight (although I hear that the elevator will probably be removed tonight) or during a practice period at competition. Note also that the parameter FINAL_POSITION_ADJUSTMENT_X should be tuned according to the competition robot if you see that you are consistently off in one horizontal direction during practice. If in doubt, just set it to zero.  In the end, you and Erik will have to decide if these features can be used to advantage during a competition. If you are not comfortable, it probably would be best to disable them in OI. Or, during the competition, based on where you are in the standings, you might decide whether you want to play it safe or try a new strategy (i.e. with driver assist). Robert  On Tuesday, April 9, 2019, 12:22:26 p.m. EDT, Kyle Anderson notifications@github.com wrote:

@robertlucyshyn I guess we haven't really done a drive practice with this have we? It would be good to practice this in a match-like setting to replicate how it behaves as well as to start getting used to this, but not sure if we have time.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.