VR-Engage  2.3
Loading...
Searching...
No Matches
External Role Management

External applications can assign entities and roles to VR-Engage stations through VR-Forces remote-control interface messages. The Manager panel uses this protocol. See Manager Panel Architecture for its UI, tracking, and persistence layers.

Architecture overview

Stations publish status heartbeats. An external application monitors station identity and assignment, then sends assignment/unassignment interface contents through its configured DIS/HLA transport. Role assignment, joystick control, and simulation ownership transfer are separate operations. Assigning a role does not itself grant every actuator or transfer entity ownership.

Supported operations

Operation Interface content Fields
Assign/change a role DtIfAssignRolePlayer String station ID, typed entity UUID, role name, spectator mode
Unassign a role DtIfUnassignRolePlayer String station ID and typed entity UUID
Observe station status DtIfVreStatus Station ID, entity UUID, role/spectator state, final-status flag, ownship simulation address

Current station identity is a stable string, not an unsigned numeric ID. Use setStationId(const DtString&) / stationId(). Entity UUID access uses DtUUID, not a DtString UUID payload. The status message no longer has separate name()/setName() identity fields. See Station message API changes when updating a 2.2 consumer.

Message protocol

Station status messages

DtSessionStatusConnector bridges local frontend status to DtIfVreStatus and maintains remote station status. It reads local identity from App.vreStatus.local.stationId. The Manager's DtVreStatusListener decodes incoming status and maintains VreAppStatusMap, currently std::map<std::string, VreAppStatus>. Its callback signature is void (*)(const std::string&, void*).

The listener removes final-status stations and times out silent stations according to its configured interval. Register and remove added/changed/removed callbacks symmetrically. Keep the listener and transport alive while callbacks are registered. Do not assume a hardcoded heartbeat or disconnection timeout for every deployment.

Sources: include/vrfExtensions/vreVrfMessages/ifVreStatus.h, include/vrfExtensions/vreManager/vreListener.h, libsrc/vrfExtensions/vreManager/vreListener.cxx, and libsrc/framework/vrePlayerStationConnector/sessionStatusConnector.cxx.

Role assignment messages

Use a known station ID from status and a real entity DtUUID. The message's stationName is the entity role name, not the station's identity string. It must match a role exposed by that entity's .entity definition. DtVreModelSetDb provides role metadata to the Manager GUI.

The actual Manager submit loop sends pending assignments as follows:

// Source: libsrc/vrfExtensions/vreManager/vreManagerWidget.cxx, onSubmit() excerpt
std::vector<DtPendingAssignmentInfo> pendingAssignments = myAssignmentTracker->getPendingAssignments();
for (const auto& pending : pendingAssignments)
{
assignMsg.setStationId(pending.myStationId);
assignMsg.setUUID(pending.myEntityUUID);
assignMsg.setStationName(pending.myRoleName.c_str());
assignMsg.setSpectatorMode(pending.mySpectatorMode);
makVrf::DtGuiThreadVrfRemoteController::instance(myDe).sendMessage(assignMsg, DtSimSendToAll);
}
Interface message for assigning role players to entities.
Definition ifAssignRolePlayer.h:31
virtual void setStationId(const DtString &id)
Sets the identifier of the VREngage application.
virtual void setStationName(const DtString &name)
Sets the station/role name for the player.
virtual void setUUID(const DtUUID &uuid)
Sets the UUID of the entity to be controlled.
virtual void setSpectatorMode(bool mode)
Sets the spectator mode flag.

The source includes the message classes, assignment-tracker header, and GUI remote-controller header. The surrounding function handles conflicts/displacement and clears submitted pending state. Do not equate clearing a pending edit with acknowledgement; updated station status confirms the assignment.

Role unassignment messages

The same function creates a typed unassignment for each displaced station:

// Source: libsrc/vrfExtensions/vreManager/vreManagerWidget.cxx, onSubmit() excerpt
unassignMsg.setStationId(stationId);
unassignMsg.setUUID(myAssignmentTracker->getStationEntityUUID(stationId));
makVrf::DtGuiThreadVrfRemoteController::instance(myDe).sendMessage(unassignMsg, DtSimSendToAll);
Interface message for unassigning role players from entities.
Definition ifUnassignRolePlayer.h:31
virtual void setUUID(const DtUUID &uuid)
Sets the UUID of the entity being unassigned.
virtual void setStationId(const DtString &id)
Sets the identifier of the VREngage application.

stationId is a string from the computed displacement set. The receiving frontend compares the target station ID before processing the request.

Building a standalone application

Use the maintained VR-Forces examples/remoteControl project for connection initialization, licensing order, clock processing, controller ticking, and destruction. Its sources are in the compatible VR-Forces toolkit, not this VR-Engage examples directory. DtVrlinkVrfRemoteController is declared in vrlinkNetworkInterface/vrlinkVrfRemoteController.h.

The checked examples/remoteControl/main.cxx constructs the remote controller before the exercise connection, initializes it with the connection/reflected-list/UUID-discovery arguments, sets the actual session ID, and starts the communication manager. Its loop calls remoteController->tick() without a time argument. It destroys the controller before the exercise connection. Retain the complete example's initializer, parse step, includes, and cleanup. A shortened guide-only tick(0.1) loop is not that API.

Register the VR-Engage interface-content creators with the application's actual interface factory. Keep status callbacks paired with removal and use current string IDs/typed UUIDs. Do not copy the Manager's GUI singleton code into a standalone application without the GUI context.

For linking/include/export settings, combine the maintained VR-Forces remote-control project with the VR-Engage message-library headers and compatible toolkit libraries. This page does not prescribe an invented iosApp build or placeholder include-directory variables.

Message processing flow

DtSessionStatusConnector::processAssignRolePlayerMessage() is the current receiving frontend path. It checks incomingMessage->stationId() against the local station ID, resolves the entity UUID, and creates VreAssignRolePlayerMessage with string station ID, entity ID/UUID, role, spectator state, and reengagement flag. It also coordinates cached pending assignments.

The Player Station state flow applies the assignment through Engaged and Loading Player states. DtChooseRoleState routes engagement into DtEngagedState, which pushes DtLoadingPlayerState. Loading handles ownership policy, station/component creation, and readiness before regular component ticks. An already-engaged station also uses the loading/reengagement flow; it does not bypass initialization. See Player Station Framework.

processUnassignRolePlayerMessage() checks the same station ID, clears cached assignment state, and queues VreUnassignRolePlayerMessage. The Player Station state handlers release the current engagement and return to selection. The removed DtVrfRemoteControlConnector is not the current handler owner.

Required libraries and headers

Header prefix Purpose
vreVrfMessages/ifAssignRolePlayer.h Current assignment content
vreVrfMessages/ifUnassignRolePlayer.h Current unassignment content
vreVrfMessages/ifVreStatus.h Current station status
vreVrfMessages/vreVrfMessageTypes.h Interface-content type constants
vrlinkNetworkInterface/vrlinkVrfRemoteController.h Standalone VR-Forces controller
vrfMsgTransport/vrfMessageInterface.h Interface-content transport/factory/callback access
vreManager/vreListener.h Manager GUI status listener

Use vreVrfMessages for the VR-Engage interface contents. The compatible VR-Forces project supplies its controller and transport libraries. Preserve protocol selection and the toolkit's include roots.

VR-Forces GUI plugin approach

The Manager uses DtGuiThreadVrfRemoteController::instance(de) in the VR-Forces GUI. vreVrfGuiPlugin registers interface-content creators and the page creator. DtVreManagerWidget owns the listener/tracker/model wiring and submits the messages shown above. Its destructor removes callbacks and releases owned objects.

Do not allocate a listener in a temporary init function and lose its owner. GUI sendMessage(content, DtSimSendToAll) is a VR-Forces transport method; it is not the removed DtVreMessageManager::sendMessage() API.

Reference implementation

Component Repository-relative header
Manager widget include/vrfExtensions/vreManager/vreManagerWidget.h
Status listener include/vrfExtensions/vreManager/vreListener.h
Assignment tracker include/vrfExtensions/vreManager/vreAssignmentTracker.h
Model-set database include/vrfExtensions/vreManager/vreModelSetDb.h
GUI plugin include/vrfExtensions/vreVrfGuiPlugin/vreVrfGuiPlugin.h

Implementation sources are in the matching libsrc/vrfExtensions libraries. The source checkout includes them; toolkit distributions expose the supported public headers.

See also