Module: planetHeading
Executive Summary
Takes in a spacecraft position message and spice planet message and provides the heading to the planet in the s/c body frame.
Module Assumptions and Limitations
This model needs to be provided spacecraft body frame and planet positions in the inertial frame.
This model captures only a static heading vector, not the rate of said heading vector.
This model is limited to finding the body heading to a planet (not other spacecraft, etc).
Message Connection Descriptions
The following table lists all the module input and output messages. The module msg variable name is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.
Msg Variable Name |
Msg Type |
Description |
---|---|---|
planetPositionInMsg |
planet state input message |
|
spacecraftStateInMsg |
spacecraft state input message |
|
planetHeadingOutMsg |
body heading output message |
Detailed Module Description
Many physical effects and spacecraft controls depend on the heading vector to a planet. Generally, it is useful for this vector to be given in spacecraft body frame components. Examples of such models in Basilisk that can use this data are course sun sensors (sun heading), and various control setups to point to a planet (planet heading). Because this information is so widely useful, it ought to be implemented in a single location to reduce computation and ensure consistency.
Design Philosophy
Overall, this module was created because many other modules need this information.
Equations
The heading is calculated by using the spacecraft and planet positions and spacecraft body frame attitude with respect to the inertial frame.
First the inertial vector to the planet is calculated:
Then, it is converted to the body frame and normalized
User Guide
The user can only instantiate this module and add it to a task.
from Basilisk.simulation import planetHeading
from Basilisk.utilities import SimulationBaseClass()
sim = SimulationBaseClass.SimBaseClass()
proc = sim.CreateNewProcess("proc")
task = sim.CreateNewTask("task", int(1e9))
proc.addTask(task)
ph = planetHeading.PlanetHeading()
ph.planetPositionInMsg.subscribeTo(earthMsg)
ph.spacecraftStateInMsg.subscribeTo(scMsg)
sim.AddModelToTask(task.Name, ph)
dataLog = ph.planetHeadingOutMsg.recorder()
-
class PlanetHeading : public SysModel
- #include <planetHeading.h>
planet heading class
Public Functions
-
PlanetHeading()
Customer constructor just sets the spacecraftSTateInMsg by default
-
inline ~PlanetHeading()
-
void UpdateState(uint64_t CurrentSimNanos) override
This method reads messages, calculates the planet heading, and writes out the heading message
- Returns:
void
-
void Reset(uint64_t CurrentSimNanos) override
This method is used to reset the module. Currently no tasks are required.
- Returns:
void
-
void writeMessages(uint64_t CurrentSimNanos)
This method is used to write out the planet heading message
- Returns:
void
-
void readMessages()
Read input messages and save data to member variables
- Returns:
void
Public Members
-
ReadFunctor<SpicePlanetStateMsgPayload> planetPositionInMsg
planet state input message
-
ReadFunctor<SCStatesMsgPayload> spacecraftStateInMsg
spacecraft state input message
-
Message<BodyHeadingMsgPayload> planetHeadingOutMsg
body heading output message
-
BSKLogger bskLogger
— BSK Logging
-
PlanetHeading()