Rev Spark MAXs PID Exit Command

Hi guys, our team seems to be having a little trouble with command groups. We have two PID commands (One for rotating a certain amount of degrees, and one for driving a certain amount of inches). Occasionally, when we put them into a command group sequentially, the rotation command drives with different speeds on different sides of the drivetrain, despite being set with the same value. We wrote a new PID command for rotation from scratch to see if our old rotation command was causing the issue but it is still occurring. Our new hunch is that the PIDDriveInches command is not exiting properly, and the speeds that it generated are still affecting the rotation. We have tried setting our reference value to 0, running the stopMotor method, setting the motor to 0, using pidWrite and setting that to 0, and nothing seems to work. Any solutions?

I’m not sure I’ve ever seen a “PID Command”. I usually leave all of the PID functionality in the subsystem for better separation of concerns.

Can you share some code so we can better understand what you’re doing?

@Fletch1373 This is the current source code we’re having this problem with. We experience the problem when we run PIDDriveInches followed sequentially by either of the PIDDriveRotate commands. 2019-Robot.zip (52.6 MB)

1 Like