Running PrimeHub more than once #2130
-
|
Does anyone know if there are ramifications of running PrimeHub() more than once in a single program. The rationale is the following. Currently to configure top_side and front_side parameters for PrimeHub() you have do that during initialization instead of post initialization. This means we have to know which hub we are connecting to PRIOR to running PrimeHub(). This means we have to pass the hubNumber (it's in an index into an array of configuration objects) when we call our initializeRobot() function. This means we need to know which robot we are configuring. ideally we would like to determine programmatically which hub is connected then run PrimeHub to configure it. currently we run PrimeHub() ideally the top_side and front_side parameters should be moved to a function like axis.orientation(topside=Axis.?, front_size=Axis.?) similar to display.orientation() |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Undefined behavior. Pybricks wasn't designed to do this so it hasn't really been tested and wasn't programmed to support it. In the future, initializing it multiple times may raise an exception. As an alternative, you could make a common file and separate main entry points for each different hub, then have the hub-specific stuff in one file and pass that to the common main function as args. |
Beta Was this translation helpful? Give feedback.
-
|
I like the suggestion to move (or also have) the IMU configuration to a method you can call at any time. |
Beta Was this translation helpful? Give feedback.
I like the suggestion to move (or also have) the IMU configuration to a method you can call at any time.