Python Module: jointThrAllocation
Executive Summary
This module allocates commanded translational force and body torque across thrusters mounted on articulated arms. It solves for joint angle commands and thruster force commands using the arm configuration message and spacecraft state messages.
The optimizer uses SciPy. Importing the module from
Basilisk.fswAlgorithms does not require SciPy, but executing
JointThrAllocation.UpdateState does.
Message Connection Descriptions
The following diagram and table list the module input and output messages.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
armConfigInMsg |
Input articulated thruster-arm configuration message. |
|
CoMStatesInMsg |
Input spacecraft center-of-mass state message. |
|
hubStatesInMsg |
Input spacecraft hub state message. |
|
transForceInMsg |
Input inertial-frame commanded force message. |
|
rotTorqueInMsg |
Input body-frame commanded torque message. |
|
thrForceOutMsg |
Output thruster force command message. |
|
desJointAnglesOutMsg |
Output desired joint angle command message. |
Module Assumptions and Limitations
The implementation assumes serial arm chains packed in arm order, one spacecraft tree, and one thruster per arm. The thruster parent joint is assumed to be the configured joint index on that arm.
User Guide
The module is imported through the standard flight-software package:
from Basilisk.fswAlgorithms import jointThrAllocation
allocation = jointThrAllocation.JointThrAllocation()
allocation.ModelTag = "jointThrAllocation"
The thrust upper bound can be provided as either a scalar or a per-thruster vector:
allocation.setThrForceMax(2.5)
The wrench tracking weights can be provided as a scalar, a length-six vector, or a 6-by-6 matrix:
allocation.setWc(1.0)
The thrust weighting term can be provided as either a scalar or a per-thruster vector:
allocation.setWf(1.0e-6)
- class jointThrAllocation.JointThrAllocation(*args, **kwargs)[source]
Bases:
SysModelAllocate thruster forces and joint angles for thrusters mounted on arms.
This implementation is intentionally example-oriented with explicit assumptions:
Arms are serial chains packed in arm order.
Arm geometry/config comes from
THRArmConfigMsgPayload.One spacecraft tree is supported (all arms in same kinematic tree).
Exactly one thruster per arm (configurable check).
Thruster parent joint is the last joint in each arm (configurable check).
- jointPoseFromTheta(theta: ndarray)[source]
Return joint frame poses in body-frame coordinates.
- Parameters:
theta – Joint angle vector.
- Returns:
Direction cosine matrices and joint-frame origins in body-frame coordinates.
- setThrForceMax(thrForceMaxIn)[source]
Set thrust upper bounds.
Accepted inputs are:
scalar: same upper bound for all thrusters
vector length
nThr: per-thruster upper bounds
- jointThrAllocation.mapMatrix(rVec_B: ndarray, fHatVec_B: ndarray, r_ComB_B: ndarray) ndarray[source]
Build the thruster force-to-wrench map.
- Parameters:
rVec_B – Thruster locations in body-frame coordinates.
fHatVec_B – Thruster unit force directions in body-frame coordinates.
r_ComB_B – Center-of-mass location relative to the hub origin in body-frame coordinates.
- Returns:
Matrix mapping thruster magnitudes to stacked force and torque.