I’ve been trying to call two drive straight functions with addSequential. The first one executes fine,but the second either is skipped over or the command seems to hang on waiting for it to finish. Any ideas?
Are the drive commands requiring more than they need to?
It would help if you could link to a github or a gist.
https://github.com/thecoopster20/2017RobotCode/tree/feature/develop?files=1
The drive straight command has the goodies.
Disclaimer: I regularly need my students to explain some of the structure to me. I am not an expert.
I think that the probelm is
|| !Robot.gearHolder.getCaptureSwitchState()
in the isFinished method. since you are using the command for driving forward and driving backward, is the state of this switch either not stable or it changes?
That switch is only ever active when the gear peg is hitting it
To work off of engunneer’s idea maybe add !invert to the check switch to only look at it in the forward direction
|| (!Robot.gearHolder.getCaptureSwitchState() && !invert)
Are you sure the encoders are returning positive distance value? Since robot can drive in both directions you’ll get different sign depending which way it is moving. You may want to wrap the values in isFinished with Math.abs. Or fix the conditional to add a check for negative distance.
The encoders return an averaged absolute value.