# Stabilize robot to drive straight with gyro (software diff lock)
commands2.button.JoystickButton(
self.driverController, self.driveConsts["DiffLock"]
).whileTrue(
commands2.PIDCommand(
wpimath.controller.PIDController(
self.pidConsts["drive"]["kStabilizationP"],
self.pidConsts["drive"]["kStabilizationI"],
self.pidConsts["drive"]["kStabilizationD"],
),
# Close the loop on the turn rate
self.robotDrive.getTurnRate,
# Setpoint is 0xxx
0,
# Pipe the output to the turning controls
lambda output: self.robotDrive.arcadeDrive(
-self.driverController.getLeftY(), output
),
# Require the robot drive
[self.robotDrive],
)
)
Problem description
This issue comes from here: https://github.com/FRC-1721/1721-ChargedUp/issues/10 and was discussed on the robotpy gitter.
When trying to execute the example code, the robot will lockup and produce this error. Not really telling you much about where it comes from.
Operating System
Linux
Installed Python Packages
Reproducible example code
Or here: https://github.com/robotpy/examples/blob/ef7372a3ce4bcc73cd6d868922e67dd6e7a99805/commands-v2/gyro-drive-commands/robotcontainer.py#L74-L94