Replies: 1 comment 1 reply
-
As the error describes, motors and sensors can currently only be initialized before multitasking starts. Creating a sensor object initializes a few things that may take some time. Since object creation is always synchronous, we require that it is done before multitasking starts to avoid blocking the loop. It might be possible to defer initialization until the sensor is used for the first time, but that would take some work. Or... we could accept the blocking nature in the loop and just allow it. In most cases, (re-)initializing devices on the fly is a user error and this exception helps you find it. But I agree that it can be useful in some cases, like the Port Viewer you're working on. |
Beta Was this translation helpful? Give feedback.
-
In my scenario I would like to create a multitasked program and dynamically create / remove devices.
When using the multitask, run_task tools I receive an error
This can only be called before multitasking starts.
Is my approach of creating PUPDevice dynamically completely wrong?
Code:
Beta Was this translation helpful? Give feedback.
All reactions