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






(optional) Image output message



(optional) msg of incoming camera data



(optional) simulation epoch date/time input msg



(optional) vector of input messages of planet Spice data

The VizSpacecraftData structure contains a range of input messages for each spacecraft added.

VizSpacecraftData input messages per spacecraft






msg of incoming spacecraft state data



(optional) Vector of incoming RW state messages



(optional) vector of thruster input messages



(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.


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

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

Public Functions


VizInterface Constructor


VizInterface Destructor

void Reset(uint64_t CurrentSimNanos)

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


CurrentSimNanos – The current sim time in nanoseconds

void UpdateState(uint64_t CurrentSimNanos)

Update this module at the task rate


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.


CurrentSimNanos – The current sim time in nanoseconds

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

Message<CameraImageMsgPayload> opnavImageOutMsg

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)

ReadFunctor<CameraConfigMsgPayload> cameraConfInMsg

[-] msg of incoming camera data

MsgCurrStatus cameraConfMsgStatus

[-] msg status of incoming camera data

CameraConfigMsgPayload cameraConfigBuffer

[-] Camera config buffer

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::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.

ReadFunctor<EpochMsgPayload> epochInMsg

[-] simulation epoch date/time input msg

MsgCurrStatus epochMsgStatus

[-] ID of the epoch msg

EpochMsgPayload epochMsgBuffer

[-] 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.

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