Module: groundLocation

Executive Summary

This class is used to represent a point attached to the surface of a planetary body which computes the access of a set of spacecraft. It considers both the relative position of a set of spacecraft to the location and a minimum elevation for the location (set to 10 deg by default).

To use this module, instantiate the class and provide it with a body-fixed location (in either lat/long/altitude, via the specifyLocation method, or in planet-centered planet-fixed coordinates directly via the r_LP_P_Init attribute) and a planet position/attitude message (i.e., an instance of spicePlanetStateSimMsg); to compute access, at least one scPlusStatesSimMsg must be added to the class using the addSpacecraftToModel method, which operates on the message’s name. By default, output messages are named ModelTag_#_access, where ModelTag is the ModelTag associated with that groundLocation instance and # is the index of the spacecraft state message as they were added to the class; the first spacecraft is 0, the second is 1, and so on.

Module Assumptions and Limitations

This module assumes that it is affixed to a spherical body with a constant radius. Elevation constraints are computed assuming a conical field of view around the normal vector fom the body’s surface at the location.

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.

Module I/O Messages

Msg Variable Name

Msg Type

Description

scStateInMsgName

powerNodeUsageSimMsg

Provides inertial position of spacecraft. Set using the addSpacecraftToModel method.

planetInMsgName

powerNodeStatusIntMsg

Provides inertial planet location and orientation.

accessOutMsgNames

accessSimMsg

List of access message names; defaults to modelTag_scNumber_access; created during addSpacecraftToModel calls.

Detailed Module Description

The groundLocation module handles the following behavior:

  1. Body-fixed location representation: a single groundLocation instance represents one body-fixed location on a body, including translation and rotation due to the motion of that body as computed by a module that writes a SPICEPlanetStateSimMsg.

  2. Conversion of latitude, longitude, altitude coordinates to planet-centered, planet-fixed coordinates

  3. Computation of spacecraft visibility (i.e. access) considering range and ground location field-of-view constraints

  4. Support for multiple spacecraft given one groundLocation instance

User Guide

A new instance of groundLocation, alongside necessary user-supplied parameters, can be created by calling:

groundTarget = groundLocation.GroundLocation()
groundTarget.ModelTag = "groundTarget"
groundTarget.planetRadius = orbitalMotion.REQ_EARTH * 1000.
groundTarget.maximumRange = 100e3 # Sets maximum range for visibility in meters
groundTarget.minimumElevation = np.radians(10.) #   Sets necessary minimum elevation for visibility to 10 deg in radians
groundTarget.specifyLocation(np.radians(0.), np.radians(0.), 0.) #  Sets location in latitude, longitude, altitude coordinates
scSim.AddModelToTask(simTaskName, groundTarget)

A groundLocation can be affixed to a specific planet by setting its planetInMsgName attribute:

groundTarget.planetInMsgName = planet_message_name

Spacecraft can be added to the model by calling:

groundTarget.addSpacecraftToModel(sc1_message_name)
groundTarget.addSpacecraftToModel(sc2_message_name)
groundTarget.addSpacecraftToModel(sc3_message_name)

#   Sim code
sc1_access = scSim.pullMessageLogData(groundTarget.accessOutMsgNames[0] + '.hasAccess',range(1))
sc1_slant = scSim.pullMessageLogData(groundTarget.accessOutMsgNames[0] + '.slantRange',range(1))
sc1_elevation =scSim.pullMessageLogData(groundTarget.accessOutMsgNames[0] + '.elevation',range(1))

class GroundLocation : public SysModel
#include <groundLocation.h>

ground location class

Public Functions

GroundLocation()

Creates an instance of the GroundLocation class with a minimum elevation of 10 degrees,.

Return

void

~GroundLocation()

Empty destructor method.

Return

void

void SelfInit()
void CrossInit()
void UpdateState(uint64_t CurrentSimNanos)

update module

Parameters
  • CurrentSimNanos:

void Reset(uint64_t CurrentSimNanos)

Resets the internal position to the specified initial position.

bool ReadMessages()
void WriteMessages(uint64_t CurrentClock)
void addSpacecraftToModel(std::string tmpScMsgName)

Adds a scState message name to the vector of names to be subscribed to. Also creates a corresponding access message output name.

void specifyLocation(double lat, double longitude, double alt)

Specifies the ground location from planet-centered latitude, longitude, altitude position.

Return

Parameters
  • lat:

  • longitude:

  • alt:

Public Members

double planetRadius

[m] Planet radius in meters.

double minimumElevation

[rad] minimum elevation above the local horizon needed to see a spacecraft; defaults to 10 degrees equivalent.

double maximumRange

[m] Maximum slant range to compute access for; defaults to -1, which represents no maximum range.

std::string planetInMsgName

msg name

std::string currentGroundStateOutMsgName

msg name

std::vector<std::string> accessOutMsgNames

msg name

Eigen::Vector3d r_LP_P_Init

[m] Initial position of the location in planet-centric coordinates; can also be set using setGroundLocation.

BSKLogger bskLogger

BSK Logging

Private Functions

void updateInertialPositions()
void computeAccess()

Private Members

uint64_t OutputBufferCount = 2
std::vector<std::string> scStateInMsgNames
std::vector<AccessSimMsg> accessMsgBuffer
std::vector<SCPlusStatesSimMsg> scStates
std::vector<int64_t> scStateInMsgIds
std::vector<int64_t> accessOutMsgIds
int64_t planetInMsgId
int64_t currentGroundStateOutMsgId
SpicePlanetStateSimMsg planetState
GroundStateSimMsg currentGroundStateOutMsg
Eigen::Matrix3d dcm_LP

Rotation matrix from planet-centered, planet-fixed frame P to site-local topographic (SEZ) frame L coordinates.

Eigen::Matrix3d dcm_PN

Rotation matrix from inertial frame N to planet-centered to planet-fixed frame P.

Eigen::Vector3d r_PN_N

[m] Planet to inertial frame origin vector.

Eigen::Vector3d r_LP_P

[m] Ground Location to planet origin vector in planet frame coordinates.

Eigen::Vector3d r_LP_N

[m] Gound Location to planet origin vector in inertial coordinates.

Eigen::Vector3d rhat_LP_N

[-] Surface normal vector from the target location.

Eigen::Vector3d r_LN_N
Eigen::Vector3d r_North_N

[-] Inertial 3rd axis, defined internally as “North”.