Warning
These callbacks are dangerous. Use them with care and only if you are comfortable with real-time, multithread, and precise timing.
The DCM provides a simple way to synchronize to its real time thread.
You can define a callback function called by the DCM just after its sleep (PreProcess), or just before going back to sleep (PostProcess).
onPreProcess is useful because it’s called just before the computation of orders sent to the chestboard (USB). Sending commands at this level means that you have the shortest delay to your command.
onPostProcess is called just after all value are updated in the ALMemory, and so at this time you have the newest values of all sensors.
These two callbacks can’t send/receive information, you still need to use the DCM API to send commands, and read the ALMemory to get sensors values.
Being called by the DCM thread means that your function is now real time. To keep the real time efficient and to avoid delay in the DCM cycle, you must:
Note
You can find an example of callback in the fastgetsetexample folder in the sdk.