kauailabs / allwpilib

Fork of Official Repository of WPILibJ and WPILibC, which contain in addition a HAL for the KauaiLabs VMX-pi.
Other
1 stars 3 forks source link

Unclean Status Exception #21

Closed kauailabs closed 5 years ago

kauailabs commented 5 years ago

Every once in a while, an Unclean Status Exception is generated during reading of encoders. As a result, the Robot base class scheduler aborts the robot program.

From Driver station log. Reported by James Taylor on 8/26/2019.

VMX HAL: SPI Aux Channel 2 opened with baudrate of 4000000. VMX HAL: Established communication with VMX-pi model 0x32, hardware rev 60, firmware version 3.0.410 VMX HAL: Acquired navX-Sensor configuration. VMX HAL: Library version 1.1.202 Set VMX CAN Mode to NORMAL. Server Running... ** Robot program starting ** Succesfully loaded vmxHaljni library. Received AHRS Configuration Data: 18 bytes. navX-Sensor startup initialization and startup calibration complete. navX-Sensor onboard startup calibration complete. navX-Sensor Yaw angle auto-reset to 0.0 due to startup calibration. TalonSRX (CAN DEVICE 11) has firmware 1046 TalonSRX (CAN DEVICE 10) has firmware 1046 TalonSRX (CAN DEVICE 13) has firmware 1046 TalonSRX (CAN DEVICE 12) has firmware 1046 Left Encoder Dist: 0.0 Right Encoder Dist: -0.0 Yaw Angle: 2.044067786911787 NT: server: client CONNECTED: 10.12.41.13 port 52717 Warning 0 [phoenix] Initialization is complete.
[phoenix] Initialization is complete. ERROR 1 Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException: Code: -20018. Board Communication Error frc.robot.Main.main(Main.java:27) Error at frc.robot.Main.main(Main.java:27): Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException: Code: -20018. Board Communication Error at edu.wpi.first.hal.EncoderJNI.getEncoderDistance(Native Method) at edu.wpi.first.wpilibj.Encoder.getDistance(Encoder.java:404) at edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl.lambda$addDoubleProperty$3(SendableBuilderImpl.java:242) at edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl.updateTable(SendableBuilderImpl.java:95) at edu.wpi.first.wpilibj.livewindow.LiveWindow.updateValues(LiveWindow.java:290) at edu.wpi.first.wpilibj.IterativeRobotBase.loopFunc(IterativeRobotBase.java:263) at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:81) at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:263) at frc.robot.Main.main(Main.java:27)

Warning 1 Robots should not quit, but yours did! edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:274) Warning at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:274): Robots should not quit, but yours did! ERROR 1 The startCompetition() method (or methods called by it) should have handled the exception above. edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:276) Error at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:276): The startCompetition() method (or methods called by it) should have handled the exception above. NOTICE: Driver Station Requested Code Restart. VMX HAL: Shutdown Handler invoked. MAU HAL: Error expiring IO Watchdog. Warning 44004 FRC: The Driver Station has lost communication with the robot. Driver Station

kauailabs commented 5 years ago

Root cause: This condition only occur in java. A CRC Error occurred during reading of the encoder value (communication error w/VMX-pi board). The java jni layer detects the non-zero status code generated in this case and throws a "UncleanStatusException". Because no handler for this exception is provided, the unhandled exception causes the robot app to abort.

kauailabs commented 5 years ago

This issue is greatly improved in VMX-pi 2019.4.1 Beta Release 13. However in theory this issue can still occur if situations like the VMX-pi board being reset (which would lead to an extended period of communication loss) occurs.