I've increased the number of AOs in my model from 8 to 17 and now Q_onAssert fires with a codes 100 and 410. What do I do? I'm relatively inexperienced, so please be verbose.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
QP-nano supports up to 8 active objects, that's why it asserts when you try 17.
Please note that you can have any number of hierarchical state machines, but used as components of active objects (see the "Orthogonal Component" design pattern).
--MMS
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Currently, there are no plans to "beef up" the little QP-nano. It is intentionally small and for low-end 8-bitters (like AVRmega in Arduino). The 8 priority levels correspond to the 8-bit word size of these machines and this is optimal for quick scheduling. And 8-levels of priority are really plenty, even for bigger applications...
But as I recommended before, please take a look at the "Orthogonal Component" design pattern. Most often than not, this is exactly what's needed when people run into active object limit. For example, this pattern applies when you have a group of identical "channels", or other components.
--MMS
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I started my application using the the DPP example. When I expand the number of Philosophers I run into the limit. How do I change the Philosopher AO array elements to Orthogonal Components using QM?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The "Orthogonal Component" example for QP-nano is provided in the standard QP-nano distribution. You need to download it and install on your machine. The example is located in the directory:
qpn\examples\win32-qv\comp
There is also another example, the "Fly 'n' Shoot" game, where the exploding "mines" are implemented as "Orthogonal Components" of the Tunnel active object. That example is located in the directory:
qpn\examples\arm-cm\game_efm32-slstk3401a
--MMS
Last edit: Quantum Leaps 2017-09-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to copy the tunnel and mine1 objects into my dpp project to create the orthogonal components I need. There are many unfamilliar moving parts. Could you describe how to use the Free Attribute "AO_Tunnel", the Free Operations "Mine1_ctor", and "Tunnel_ctor"?
How do these attributes relate to the way these objects are created in dpp?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It only took four hours to figure this out. Before QHSM_INIT runs, the: QHsm_ctor(&me->super, Q_STATE_CAST(&Mine1_initial));
must run. I copied a set of free operations "Mine1_ctor" and "Tunnel_ctor" from the game example that were to do the ctor. They in turn must be run from the setup(). I had origionally modified from dpp example: QActive_ctor(&AO_Tunnel.super, Q_STATE_CAST(&Tunnel_initial));
This didn't run the free operation. Replacing it with the function call below worked: Tunnel_ctor();
I didn't see that I needed to do this because in the Shoot and Fly game example, the QM file doesn't list the main.c file where this is found. I haven't discovered how to make the Shoot N Fly QM model list the main.c file in the .directory folder.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've increased the number of AOs in my model from 8 to 17 and now Q_onAssert fires with a codes 100 and 410. What do I do? I'm relatively inexperienced, so please be verbose.
QP-nano supports up to 8 active objects, that's why it asserts when you try 17.
Please note that you can have any number of hierarchical state machines, but used as components of active objects (see the "Orthogonal Component" design pattern).
--MMS
Thanks for the quick reply. Would you consider upgrading QP nano arduino to handle more AOs?
Currently, there are no plans to "beef up" the little QP-nano. It is intentionally small and for low-end 8-bitters (like AVRmega in Arduino). The 8 priority levels correspond to the 8-bit word size of these machines and this is optimal for quick scheduling. And 8-levels of priority are really plenty, even for bigger applications...
But as I recommended before, please take a look at the "Orthogonal Component" design pattern. Most often than not, this is exactly what's needed when people run into active object limit. For example, this pattern applies when you have a group of identical "channels", or other components.
--MMS
I started my application using the the DPP example. When I expand the number of Philosophers I run into the limit. How do I change the Philosopher AO array elements to Orthogonal Components using QM?
The "Orthogonal Component" example for QP-nano is provided in the standard QP-nano distribution. You need to download it and install on your machine. The example is located in the directory:
qpn\examples\win32-qv\compThere is also another example, the "Fly 'n' Shoot" game, where the exploding "mines" are implemented as "Orthogonal Components" of the Tunnel active object. That example is located in the directory:
qpn\examples\arm-cm\game_efm32-slstk3401a--MMS
Last edit: Quantum Leaps 2017-09-13
Thanks Miro,
For anyone following along, in the Fly n Shoot example, the mines are described on page 29.
I'm trying to copy the tunnel and mine1 objects into my dpp project to create the orthogonal components I need. There are many unfamilliar moving parts. Could you describe how to use the Free Attribute "AO_Tunnel", the Free Operations "Mine1_ctor", and "Tunnel_ctor"?
How do these attributes relate to the way these objects are created in dpp?
When the following QHSM_INIT code from the game runs, my sketch restarts. Commenting it out allows the other AOs to work. Any ideas why?
Last edit: Coder 2017-09-14
It only took four hours to figure this out. Before QHSM_INIT runs, the:
QHsm_ctor(&me->super, Q_STATE_CAST(&Mine1_initial));must run. I copied a set of free operations "Mine1_ctor" and "Tunnel_ctor" from the game example that were to do the ctor. They in turn must be run from the setup(). I had origionally modified from dpp example:
QActive_ctor(&AO_Tunnel.super, Q_STATE_CAST(&Tunnel_initial));This didn't run the free operation. Replacing it with the function call below worked:
Tunnel_ctor();I didn't see that I needed to do this because in the Shoot and Fly game example, the QM file doesn't list the main.c file where this is found. I haven't discovered how to make the Shoot N Fly QM model list the main.c file in the .directory folder.