Prevent color sensor calls when not needed. #95
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This small change means the color sensor will only be called when the code asks instead of always.
The code happens to always call the color sensor UNLESS the switch closest to the shooter is pressed.
Hopefully this break in color sensor calls can fix the issue described below.
In match 105 at DCMP, ColorSensorSubsystem.periodic() was reported at taking 0.35s.
Here is my detailed notes on what I found reading the driverstation logs:
Loop overrun message, displays time of each subsystem/command:
Match 68 -> All ColorSensorSubsystem.periodic were below 0.0025s
Match 95 -> All ColorSensorSubsystem.periodic were below 0.0025s
Match 105 Auto Period -> All ColorSensorSubsystem.periodic were below 0.0025s
Match 105 Tele Period -> ALL ColorSensorSubsystem.periodic were ABOVE 0.35s
The moment teleoperated started, ColorSensorSubsystem.periodic() was taking way too long to run.
Motor safety was saying "hey, I haven't gotten a new percent output for the drivetrain motors in awhile I'm going to stop the motors from moving." (I believe it is likely that motor safety was causing the lapses in control. Likely being the key word, I can not confirm it since we seem to always get motor safety messages)
Battery Voltage reported from the driver station, voltage was a flat line for over 20 seconds :
Beginning of the match = 12.7 V
End of the match = 12.3 V
Number of reported brownouts = 7
Match 105 has the lowest number of recorded brownouts. (Match 105 = 7 brownouts, match 98 = 9 brownouts, match 25 = 10 brownouts, all other matches were >21 brownouts, match 68 has the highest number with 71 brownouts)