Module: vizInterface

Executive Summary

This module provides an interface to package up Basilisk messages and pass them onto the Vizard application. This allows for the Basilisk simulation data to be recorded to a file for play-back, or for live streaming of the simulation data. It is possible to record the simulation data of a single spacecraft or a multitude of spacecraft.

Module Assumptions and Limitations

The module is only able to read Basilisk simulation state messages that are accessable from the task group that is calling vizInterface.

Message Connection Descriptions

The following messages are set directly within vizInterface. Additional messages are set within the VizSpacecraftData data structures for each spacecraft.

Module I/O Messages

Parameter

Default

Description

opnavImageOutMsgs

CameraImageMsgPayload

(optional) vector of Image output messages, the corresponding camera configuration input message is setup through vizInterface.addCamMsgToModule(msg)

epochInMsg

EpochMsgPayload

(optional) simulation epoch date/time input msg

spiceInMsgs

SpicePlanetStateMsgPayload

(optional) vector of input messages of planet Spice data

The VizSpacecraftData structure, defined in Module: vizStructures, contains a range of input messages for each spacecraft added.

VizSpacecraftData input messages per spacecraft

Parameter

Default

Description

scStateInMsg

SCStatesMsgPayload

msg of incoming spacecraft state data

rwInMsgs

RWConfigLogMsgPayload

(optional) Vector of incoming RW state messages

thrInMsgs

THROutputMsgPayload

(optional) vector of thruster input messages

cssInMsgs

CSSConfigLogMsgPayload

(optional) Vector of CSS config log messages

User Guide

The vizInterface module can be directly configured, or setup using the helper methods in vizSupport. More information can be found in BSK Scripting Settings page. The scenarioFormationBasic illustrates and discusses how to configure vizInterface for use with multiple satellites.


Defines

VIZ_MAX_SIZE
class VizInterface : public SysModel
#include <vizInterface.h>

Defines a data structure for the spacecraft state messages and ID’s.

Public Functions

VizInterface()

VizInterface Constructor

~VizInterface()

VizInterface Destructor

void Reset(uint64_t CurrentSimNanos)

A Reset method to put the module back into a clean state

Parameters:

CurrentSimNanos – The current sim time in nanoseconds

void UpdateState(uint64_t CurrentSimNanos)

Update this module at the task rate

Parameters:

CurrentSimNanos – The current sim time

void ReadBSKMessages()

A method in which the module reads the content of all available bsk messages

void WriteProtobuffer(uint64_t CurrentSimNanos)

The method in which the vizInterface writes a protobuffer with the information from the simulation.

Parameters:

CurrentSimNanos – The current sim time in nanoseconds

void addCamMsgToModule(Message<CameraConfigMsgPayload> *tmpMsg)

Method to add a Vizard instrument camera module to vizInterface

Parameters:

tmpMsg – Camera configuration msg

Public Members

std::vector<VizSpacecraftData> scData

vector of spacecraft data containers

std::vector<ReadFunctor<SpicePlanetStateMsgPayload>> spiceInMsgs

vector of input messages of planet Spice data

std::vector<LocationPbMsg*> locations

vector of ground or spacecraft locations

std::vector<GravBodyInfo> gravBodyInformation

vector of gravitational body info

std::vector<Message<CameraImageMsgPayload>*> opnavImageOutMsgs

vector of vizard instrument camera output messages

int opNavMode

[int] Set non-zero positive value if Unity/Viz couple in direct communication. (1 - regular opNav, 2 - performance opNav)

bool saveFile

[Bool] Set True if Vizard should save a file of the data.

bool liveStream

[Bool] Set True if Vizard should receive a live stream of BSK data.

bool broadcastStream

[Bool] Set True if messages should be broadcast for listener Vizards to pick up.

bool noDisplay

[Bool] Set True if Vizard should run performance opNav (no Vizard display)

std::vector<void*> bskImagePtrs

[RUN] vector of permanent pointers for the images to be used in BSK without relying on ZMQ because ZMQ will free it (whenever, who knows)

std::vector<ReadFunctor<CameraConfigMsgPayload>> cameraConfInMsgs

vector of incoming camera data messages

std::vector<MsgCurrStatus> cameraConfMsgStatus

vector of msg status of incoming camera data

std::vector<CameraConfigMsgPayload> cameraConfigBuffers

vector of Camera config buffers

int64_t FrameNumber

Number of frames that have been updated for TimeStamp message.

std::string protoFilename

Filename for where to save the protobuff message.

VizSettings settings

container for the Viz settings that can be specified from BSK

LiveVizSettings liveSettings

container for Viz settings that are updated on each time step

std::vector<VizEventDialog*> vizEventDialogs = {}

vector of dialog boxes to show

std::string reqComProtocol

Communication protocol to use when connecting to 2-way Vizard.

std::string reqComAddress

Communication address to use when connecting to 2-way Vizard.

std::string reqPortNumber

Communication port number to use when connecting to 2-way Vizard.

std::string pubComProtocol

Communication protocol to use when connecting to broadcast Vizard.

std::string pubComAddress

Communication address to use when connecting to broadcast Vizard.

std::string pubPortNumber

Communication port number to use when connecting to broadcast Vizard.

double broadcastSettingsSendDelay

Real-time delay between sending Viz settings to broadcast socket.

ReadFunctor<EpochMsgPayload> epochInMsg

simulation epoch date/time input msg

MsgCurrStatus epochMsgStatus

ID of the epoch msg.

EpochMsgPayload epochMsgBuffer

epoch msg data

Message<VizUserInputMsgPayload> userInputMsg

User input from Vizard.

BSKLogger bskLogger

BSK Logging object.

Private Functions

void receiveUserInput(uint64_t CurrentSimNanos)

request user input from Vizard, save as

During liveStream mode, ask Vizard for any user inputs recorded since the last timestep. Parse and package into VizUserInputMsgPayload for handling in Python.

Parameters:

CurrentSimNanos – The current sim time

void requestImage(size_t camCounter, uint64_t CurrentSimNanos)

request image from Vizard and store it in output img msg

Requests an image from Vizard and stores it in the image output message

Private Members

void *requester_context

2-way context pointer (container for socket management)

void *requester_socket

2-way socket pointer (ZMQ_REQ)

void *publisher_context

Broadcast context pointer (container for socket management)

void *publisher_socket

Broadcast socket pointer (ZMQ_PUB)

int firstPass

Flag to intialize the viz at first timestep.

std::vector<MsgCurrStatus> spiceInMsgStatus

status of the incoming planets’ spice data messages

std::vector<SpicePlanetStateMsgPayload> spiceMessage

Spice message copies.

std::ofstream *outputStream

Output file stream opened in reset.

int64_t now

Current system time stamp.

int64_t lastSettingsSendTime

System time stamp when settings message was last sent to broadcast socket.