-
Notifications
You must be signed in to change notification settings - Fork 1k
NullPointerException with bulk caching #232
Comments
It appears there is a bug in the implementation here. I haven't tested this, but I believe the issue can be fixed by doing the following: OpenFTC/Extracted-RC@db88b6f |
This also happens for encoder readings from the expansion hub. Please fix this issue ASAP... |
@ToiletCommander Judging from the release schedule as of late, it will probably be a while before this is fixed. As a workaround, you could turn bulk caching off and instead directly interpret the return values from |
@FROGbots-4634 Thank you for your advice, we have a state tournament next weekend and I have just recently changed our library to do MANUAL Bulk Read(with a data refresh every cycle my library does a cycle), which in theory should boost the performance of everything (especially trajectory follow responsiveness). |
I was able to find a way to work around it...And this is for MANUAL MODE ONLY Before: for(LynxModule i : allExtensionHubs){
i.clearBulkCache();
} After: for(LynxModule i : allExtensionHubs){
i.clearBulkCache();
try {
Class<LynxModule> LynxModuleClass = LynxModule.class;
Field lynxModuleField = LynxModuleClass.getDeclaredField("lastBulkData");
lynxModuleField.setAccessible(true);
lynxModuleField.set(i,i.getBulkData());
}catch(NoSuchFieldException|IllegalAccessException e){
e.printStackTrace();
}
} As clearBulkCache() function sets the |
Fixing it to just use the last bulk data would be good, but I would like to also see a .didLastReadFail method and the ability to easily stop an opmode with a custom message (you might not want to continue auto if it dc'd). stopping with a custom message could also be a good debugging tool to serve the same function as exceptions while being more user friendly. api could just be requestOpModeStop("insert some message here") |
This was closed because it's fixed in version 5.5. |
When using
BulkCachingMode.AUTO
, OpModes crash with the errorjava.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.qualcomm.hardware.lynx.LynxModule$BulkData.getDigitalChannelState(int)' on a null object reference
when reading from digital channels.
The text was updated successfully, but these errors were encountered: