.. _bskPrinciples-11:
Advanced: Effector Module Branching
===================================
Module branching in Basilisk enables the attachment of compatible dynamic effectors on state
effectors as an alternative to attaching them directly to the hub. For example, a gimballed thruster
can be modeled as a ``thrusterDynamicEffector`` attached to a ``spinningBodyTwoDOFStateEffector``,
or a robotic docking arm can be modeled as a ``constraintDynamicEffector`` attached to a 7-DOF
revolute ``spinningBodyNDOFStateEffector``. Multiple dynamic effectors can be attached to a state
effector as well, for example applying both drag and SRP to a solar panel.
Further details on how to set up new state effectors and dynamic effector modules for branching can
be found in :ref:`effectorBranching`. Integrated testing of effector branching is elaborated on in
:ref:`test_effectorBranching_integrated`.
Allowable Configurations
------------------------
The currently supported configurations of state effectors compatible as "parent" effectors and
dynamic effectors compatible as "child" effectors is summarized in the table below. Green shows
currently supported configurations, yellow shows configurations expected to be supported in the
future, and red shows configurations not planned to be supported. Additionally, blue shows the
special case of prescribed effector branching explained in :ref:`prescribedMotionStateEffector`.
.. raw:: html
Effector Branching Compatibility
|
Children Effectors |
| Thruster Dynamic Effector |
Thruster State Effector |
Constraint Effector |
Drag Effector |
External Force Torque |
SRP Effector |
Fuel Tank Effector |
Gravity Effector |
Spinning Bodies |
Translating Bodies |
Hinged Rigid Bodies |
Prescribed Bodies |
Linear Spring Mass Damper |
Spherical Pendulum |
Reaction Wheel |
VSCMG |
|
Parent Effectors
|
Spinning Bodies 1DOF |
| | | |
| | | |
| | | |
| | | |
| Spinning Bodies 2DOF |
| | | |
| | | |
| | | |
| | | |
| Spinning Bodies NDOF |
| | | |
| | | |
| | | |
| | | |
| Hinged Rigid Bodies |
| | | |
| | | |
| | | |
| | | |
| Dual Hinged Rigid Bodies |
| | | |
| | | |
| | | |
| | | |
| N Hinged Rigid Bodies |
| | | |
| | | |
| | | |
| | | |
| Linear Translating Bodies 1DOF |
| | | |
| | | |
| | | |
| | | |
| Linear Translating Bodies NDOF |
| | | |
| | | |
| | | |
| | | |
| Prescribed Motion |
| | | |
| | | |
| | | |
| | | |
Setup
-----
Attaching a dynamic effector on a state effector is performed the same way as attaching a dynamic
effector to the hub, but instead called with the state effector. Given a setup as::
scSim = SimulationBaseClass.SimBaseClass()
dynProcess = scSim.CreateNewProcess(simProcessName)
dynProcess.addTask(scSim.CreateNewTask(simTaskName, simulationTimeStep))
scObject = spacecraft.Spacecraft()
stateEff = spinningBodyOneDOFStateEffector.SpinningBodyOneDOFStateEffector()
dynEff = extForceTorque.ExtForceTorque()
scObject.addStateEffector(stateEff)
scSim.AddModelToTask(simTaskName, scObject)
scSim.AddModelToTask(simTaskName, stateEff)
scSim.AddModelToTask(simTaskName, dynEff)
By default, effectors attached to the hub using::
scObject.addDynamicEffector(dynEff)
scSim.AddModelToTask(simTaskName, dynEff)
Dynamic effector's can instead be attached to a state effector as::
stateEff.addDynamicEffector(dynEff)
Or in the case of a multi-degree-of-freedom parent effector, additionally specify which segment to
attach the dynamic effector to as::
stateEff = spinningBodyTwoDOFStateEffector.SpinningBodyTwoDOFStateEffector()
segment = 2
stateEff.addDynamicEffector(dynEff, segment)
Where segment is the integer number of the segement to be attached to, with 1 being the segment
attached to the hub, increasing outward from the hub. For example, spinningBodyOneDOFStateEffector
will always attach to segment 1, attaching to the second to last segment of a 7DOF robotic arm would
be segment 6. Note that in either case the dynamic effector is still added to the sim task.
However, some effectors use alternative methods for adding to a spacecraft. For example, the
attachment of a :ref:`thrusterDynamicEffector` set using the :ref:`simIncludeThruster`::
thrusterSet = thrusterDynamicEffector.ThrusterDynamicEffector()
thFactory = simIncludeThruster.thrusterFactory()
thFactory.create('MOOG_Monarc_22_6', [0, 0, 0], [0, -1.5, 0])
thFactory.addToSpacecraft(thrModelTag, thrusterSet, scObject)
Would instead be attached using::
thFactory.addToSpacecraftSubcomponent(thrModelTag, thrusterSet, stateEff, segment)
Additionally, the :ref:`constraintDynamicEffector` requires attachment to two parents. It works with
either a hub attached to the state effector of another vehicle, or the attachment of two different
state effectors to one another.::
scObject2 = spacecraft.Spacecraft()
constraintEffector = constraintDynamicEffector.ConstraintDynamicEffector()
stateEff.addDynamicEffector(constraintEffector)
scObject2.addDynamicEffector(constraintEffector)