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

Msg Variable Name

Msg Type

Description

opnavImageOutMsgName

cameraImageMsg

If Vizard is used as a camera sensor, this is the the name of the output message of the camera image.

cameraConfInMsgName

cameraConfigMsg

Name of the incoming camera data

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 SelfInit()

Initialization method for subscription to messages. This module does not output messages, but files containing the protobuffers for Vizard

void CrossInit()

Cross initialization. Module subscribes to other messages. In viz interface, many messages are subscribed to in order to extract information from the viz and give it to the visualization tool.

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

Public Members

std::vector<VizSpacecraftData> scData

[-] vector of spacecraft data containers

std::vector<std::string> spiceInMsgName

[-] Name of the incoming Spice data

std::vector<LocationPbMsg> locations

[] vector of ground or spacecraft locations

std::string opnavImageOutMsgName

The name of the Image output message.

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.

void *bskImagePtr

[RUN] Permanent pointer for the image to be used in BSK without relying on ZMQ because ZMQ will free it (whenever, who knows)

std::string cameraConfInMsgName = "camera_config_data"

[-] Name of the incoming camera data

MsgCurrStatus cameraConfMsgId

[-] ID of the incoming camera data

CameraConfigMsg cameraConfigMessage

[-] Camera config

std::vector<std::string> planetNames

Vector of planet names we want to track, read in from python.

uint64_t numOutputBuffers

[-] Number of buffers to request for the output messages

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

std::string comProtocol

Communication protocol to use when connecting to Vizard.

std::string comAddress

Communication address to use when connecting to Vizard.

std::string comPortNumber

Communication port number to use when connecting to Vizard.

std::string epochMsgName

[-] name of the simulation epoch date/time msg

MsgCurrStatus epochMsgID

[-] ID of the epoch msg

EpochSimMsg epochMsg

[-] epoch msg data

BSKLogger bskLogger

[-] BSK Logging object

Private Members

void *context
void *requester_socket
int firstPass

Flag to intialize the viz at first timestep.

int32_t imageOutMsgID

ID for the outgoing Image message.

std::vector<MsgCurrStatus> spiceInMsgID

[-] IDs of the incoming planets’ spice data

std::vector<SpicePlanetStateSimMsg> spiceMessage

[-] Spice messages

std::ofstream *outputStream

[-] Output file stream opened in reset

std::map<uint32_t, SpicePlanetStateSimMsg> planetData

Internal vector of planets