You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The IO layer pattern is a fairly common solution for splitting real robot code from simulation code. Currently, Epilogue logging only uses the declared types of fields and methods, so data specific to a "real" IO implementation would not be loggable (or the base IO interface would need to expose functions for retrieving all the hardware-specific data). Doing a runtime switch to check for a more specific logger would be ideal
@LoggedinterfaceIO {
voidsetVoltage(Voltagev);
AngularVelocitygetSpeed();
}
@LoggedclassRealIOimplementsIO {
@Logged// Would not be included in logs for an IO object! Only for objects declared as a RealIO!publicCurrentgetStatorCurrent() { ... }
...
}
// Currently would be logged using the logger for the IO interfaceIOio = newRealIO();
// Currently would be logged using the logger for the RealIO classRealIOrealIO = (RealIO) io;
This would be an update to the LoggableHandler class to inject if conditions into the generated code that check the logged object's class against known logger implementations for subtypes of the declared type. If the object's class is a subtype that has an @Logged annotation, then it should be logged using that class's generated logger instead of the generic logger for the element's declared type. Generated code should look something like this:
publicvoidtryUpdate(DataLoggerdataLogger, Fooobject) {
vario = (Foo.IO) $IO.get(object);
if (io.getClass().equals(Foo.RealIO.class)) {
Epilogue.FOO_REAL_IO_LOGGER.tryUpdate(dataLogger.getSubLogger("IO"), (Foo.RealIO) io);
} else {
// Fall back to the generic loggerEpilogue.FOO_IO_LOGGER.tryUpdate(dataLogger.getSubLogger("IO"), io);
}
}
The text was updated successfully, but these errors were encountered:
The IO layer pattern is a fairly common solution for splitting real robot code from simulation code. Currently, Epilogue logging only uses the declared types of fields and methods, so data specific to a "real" IO implementation would not be loggable (or the base IO interface would need to expose functions for retrieving all the hardware-specific data). Doing a runtime switch to check for a more specific logger would be ideal
This would be an update to the
LoggableHandler
class to injectif
conditions into the generated code that check the logged object's class against known logger implementations for subtypes of the declared type. If the object's class is a subtype that has an@Logged
annotation, then it should be logged using that class's generated logger instead of the generic logger for the element's declared type. Generated code should look something like this:The text was updated successfully, but these errors were encountered: