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 |
---|---|---|
planetPositionInMsgName |
This message is used to get the planet’s position |
|
spacecraftStateInMsgName |
This message is used to get the spacecraft’s position and attitude MRP |
|
planetHeadingOutMsgName |
This message is used to output the unit heading vector to the planet in the spacecraft’s body |
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, change the i/o names, and add it to a task. The names below are only special in that they are useful defaults. Only the spacecraftStateInMsgName is actually a default.
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.planetPositionInMsgName = "earth_planet_data"
ph.spacecraftStateInMsgName = "inertial_state_output"
ph.planetHeadingOutMsgName = "planet_heading"
sim.AddModelToTask(task.Name, ph)
-
class
PlanetHeading
: public SysModel¶ Public Functions
-
PlanetHeading
()¶ Customer constructor just sets the spacecraftSTateInMsgName by default
-
~PlanetHeading
()¶
-
void
SelfInit
() override¶ This method is used to create the body heading message for the heading to the planet
- Return
void
-
void
CrossInit
() override¶ This method is used to subscribe to planet and spacecraft messages
- Return
void
-
void
UpdateState
(uint64_t CurrentSimNanos) override¶ This method reads messages, calculates the planet heading, and writes out the heading message
- Return
void
-
void
Reset
(uint64_t CurrentSimNanos) override¶ This method is used to reset the module. Currently no tasks are required.
- Return
void
-
void
writeMessages
(uint64_t CurrentSimNanos)¶ This method is used to write out the planet heading message
- Return
void
-
void
readMessages
()¶ Read input messages and save data to member variables
- Return
void
Public Members
-
std::string
planetPositionInMsgName
¶
-
std::string
spacecraftStateInMsgName
¶
-
std::string
planetHeadingOutMsgName
¶
-