Everything has previously worked, but we reprogrammed and rewired the robot
The issue:
When we are driving the robot it moves VERY slowly forward and turning left, but turning right and reverse work full speed. I have done some debugging and here’s what I know.
The joystick is outputting the correct information from the right and left stick
The entire system has been updated to the most recent firmware (as of earlier today)
The Spark Max controllers all function properly when going in reverse or turning right
When turning left, or going forward the Spark Max controllers do not light up correctly (all 4 status lights remain purple) and the right side motors move very slowly while the left side move quicker, but no where near full speed.
I have tracked down all CAN wires and verified they are properly connected and are not grounding out.
We are not getting any errors on the driver station, and our battery is fully charged.
I plan on diving in deep tomorrow afternoon, but was hoping someone could point me in a starting direction as what to look for that could be causing this issue.
The isFinished() method will return true when both axis are below threshold (0.2).
I believe this will end your command when, RightJoystickX and LeftJoystickY are both negative or one is negative and the other neutral (0).
Since Forwards is negative, and left is negative this matches the robot driving slowly forwards and turning left.
As to why it is slow and not just stopped, the end() method calls Robot.driveSubsystem.stop(); which in turn commands the motors to stop.
However, since Drive is the default command, it will be immediately re-scheduled every time it is stopped, meaning the robot is constantly switching between driving and stopping, causing weird slow movement.
Since in your execute() method you are deadbanding the joystick axis with if(Math.abs(xAxis) < threshold)It looks like you just forgot Math.abs() in your isFinished() method.
In my team’s code, we don’t end the command when our joystick is neutral, we rely on the deadband in the motor controller to remove any jitter and just constantly drive it at ~0% with a neutral joystick. ie we don’t call stopMotor().