Skip to content

raisin::tcp_viewer::RemoteScene ​

class · #include <rayrai/RaisimTcpCommon.hpp>

Client-side representation of a remote raisim scene.

Owns the state updated through TCP messages and exposes helper queries for selection, bounds, and visual lists.

Constructors & destructor ​

RemoteScene ​

cpp
explicit RemoteScene(const std::shared_ptr<raisin::RayraiWindow> &viewer)

Construct a remote scene bound to a viewer instance.

Parameters

ParameterDescription
viewerShared RayraiWindow used for rendering.
cpp
RemoteScene(RemoteScene &&) noexcept

Move constructor.

cpp
RemoteScene(const RemoteScene &) = delete

~RemoteScene ​

cpp
~RemoteScene()

Public member functions ​

operator= ​

cpp
RemoteScene &operator=(RemoteScene &&) noexcept

Move assignment.

cpp
RemoteScene &operator=(const RemoteScene &) = delete

setVerbose ​

cpp
void setVerbose(bool verbose)

Enable or disable verbose logging.

Parameters

ParameterDescription
verboseTrue to enable verbose logs.

setSelectionTag ​

cpp
void setSelectionTag(uint32_t tag)

Set the object whose detailed state is reported in getSelectedInfo().

Parameters

ParameterDescription
tagObject tag.

getSelectedInfo ​

cpp
const SelectedObjectInfo &getSelectedInfo() const

Get the current selection info.

Returns Selection info struct.

getServerWorldTime ​

cpp
double getServerWorldTime() const

Get the latest server world time.

Returns World time value.

hasServerWorldTime ​

cpp
bool hasServerWorldTime() const

Check if server world time is available.

Returns True if a time value has been received.

setShowCollisionBodies ​

cpp
void setShowCollisionBodies(bool show)

Toggle collision body rendering.

Parameters

ParameterDescription
showTrue to render collision shapes.

setForceTransparent ​

cpp
void setForceTransparent(bool enabled)

Force all visuals to render as transparent.

Parameters

ParameterDescription
enabledTrue to force transparency.

addSearchPath ​

cpp
void addSearchPath(const std::string &path)

Add a search path for mesh resources.

Parameters

ParameterDescription
pathDirectory path.

setResourceSearchPaths ​

cpp
void setResourceSearchPaths(const std::vector<std::string> &paths)

Replace the resource directories configured in the viewer settings.

Parameters

ParameterDescription
pathsDirectories searched when resolving mesh files.

getObjectName ​

cpp
std::string getObjectName(uint32_t tag) const

Get object name by tag.

Parameters

ParameterDescription
tagObject tag.

Returns Name string or empty if not found.

getSensorsForTag ​

cpp
std::vector<SensorInfo> getSensorsForTag(uint32_t tag) const

Return the sensors declared by the object identified by tag.

Parameters

ParameterDescription
tagObject tag.

Returns Sensor list (empty if the object has none).

shutdown ​

cpp
void shutdown()

Clear the scene and release the viewer reference.

clear ​

cpp
void clear()

Clear all cached remote scene data.

getVisualInfo ​

cpp
bool getVisualInfo(
    const raisin::Visuals *visual,
    uint32_t &tag,
    int &index,
    const VisualEntry *&entry) const

Look up a visual by pointer and return its metadata.

Parameters

ParameterDescription
visualVisual pointer to look up.
tagOutput object tag.
indexOutput body index within the object.
entryOutput entry pointer.

Returns True if found.

getVisualEntries ​

cpp
std::vector<VisualEntrySnapshot> getVisualEntries() const

Copy every visual entry with its tag and body index.

Returns Snapshot of all entries.

getBodyFrames ​

cpp
std::vector<BodyFramePose> getBodyFrames() const

One pose per body, sorted by tag/body index. Articulated/compound frames require negotiated body offsets; ground/terrain/deformables are omitted.

getSelectableObjects ​

cpp
std::vector<ObjectListItem> getSelectableObjects() const

Get a list of selectable objects.

Returns Vector of object list items.

selectableObjectCount ​

cpp
size_t selectableObjectCount() const

Count of selectable objects.

Returns Selectable object count.

visualCount ​

cpp
size_t visualCount() const

Count of visual objects.

Returns Visual count.

instancedCount ​

cpp
size_t instancedCount() const

Count of instanced visual sets.

Returns Instanced visual count.

tcpMeshBatchCount ​

cpp
size_t tcpMeshBatchCount() const

Count of TCP mesh batches synthesized from repeated articulated meshes.

Returns Batch count.

tcpMeshBatchMeshColorCount ​

cpp
size_t tcpMeshBatchMeshColorCount() const

Count of TCP mesh batches using mesh-authored colors.

Returns Batch count.

tcpMeshBatchRegroupCount ​

cpp
size_t tcpMeshBatchRegroupCount() const

Number of full TCP mesh-batch membership rebuilds since the last clear().

Returns Regroup count (diagnostics).

pointCloudCount ​

cpp
size_t pointCloudCount() const

Count of remote point clouds.

Returns Point cloud count.

unresolvedAssetCount ​

cpp
size_t unresolvedAssetCount() const

Count mesh entries whose referenced asset could not be resolved.

Returns Unresolved entry count.

contactCount ​

cpp
size_t contactCount() const

Count of parsed remote contact samples.

Returns Contact sample count.

contactCountForTag ​

cpp
size_t contactCountForTag(uint32_t tag) const

Count contacts in which the object with tag participates.

Parameters

ParameterDescription
tagObject tag.

Returns Contact count (0 unless serverSupportsContactObjectTags()).

serverSupportsContactObjectTags ​

cpp
bool serverSupportsContactObjectTags() const

Whether contact samples contain object ownership tags.

Returns True if the server advertised kProtocolFeatureContactObjectTags.

computeSceneBounds ​

cpp
bool computeSceneBounds(glm::vec3 &outMin, glm::vec3 &outMax) const

Compute scene bounds from current visuals.

Parameters

ParameterDescription
outMinOutput AABB minimum.
outMaxOutput AABB maximum.

Returns True if bounds were computed.

applyResponse ​

cpp
bool applyResponse(
    BufferReader &reader,
    std::vector<PendingSensorUpdate> &pending)

Apply a response message to the scene state.

Parameters

ParameterDescription
readerBuffer reader positioned at the response payload.
pendingOutput list of pending sensor updates.

Returns True if the response was parsed successfully.

consumeDisconnectRequested ​

cpp
bool consumeDisconnectRequested()

Check and consume a pending disconnect request.

Returns True if a disconnect was requested.

takeViewerCommands ​

cpp
std::vector<ViewerCommand> takeViewerCommands()

Move pending server-originated capture/window commands to the caller.

Returns Commands in arrival order; the internal queue is left empty.

updateContactVisuals ​

cpp
void updateContactVisuals(
    bool showPoints,
    float pointSize,
    bool showForces,
    float forceSize,
    bool absoluteScale=false)

Update contact point/force visuals.

Parameters

ParameterDescription
showPointsWhether to draw contact points.
pointSizePoint size.
showForcesWhether to draw force vectors.
forceSizeForce vector scaling.
absoluteScaleIf true, arrow length = magnitude * forceSize (m per N). If false (default), arrows are normalized to the strongest contact each frame.

serverSupportsSimControl ​

cpp
bool serverSupportsSimControl() const

Whether the server speaks the SIM_CONTROL feature bit. The viewer uses this to grey out the pause / step buttons against legacy servers.

Returns True if the server advertised kProtocolFeatureSimControl.

takeSceneFileBlock ​

cpp
SceneFileBlock takeSceneFileBlock()

Take the scene-file block of the last response (see SceneSync).

Returns The block; present is false when the server did not negotiate scene files.

setServerPathMap ​

cpp
void setServerPathMap(std::vector<std::pair<std::string, std::string>> map)

Local copies of the server's scene files, for the mesh paths the server streams.

Parameters

ParameterDescription
mapSorted (normalizeServerPath(server path), local path) pairs, see SceneSync::pathMap().

RaiSim — physics for robotics and AI.