UCXSubscribeJointCommandNodeBase#

Fully qualified name: isaacsim::ucx::nodes::UCXSubscribeJointCommandNodeBase

template<typename DatabaseT>
class UCXSubscribeJointCommandNodeBase : public isaacsim::ucx::nodes::UcxNode#

Base class template for UCX joint state subscriber nodes.

Provides common functionality for receiving joint command data via UCX. Derived classes implement message parsing via parseMessage(). The base class handles setting outputs via setOutputs().

Template Parameters:

DatabaseT – The OmniGraph database type for the derived node

Public Types

using NodeObj = omni::graph::core::NodeObj#

Alias for the OmniGraph node object type.

using GraphInstanceID = omni::graph::core::GraphInstanceID#

Alias for the OmniGraph instance ID type.

Public Functions

inline virtual ~UCXSubscribeJointCommandNodeBase()#

Destroys the node, retiring every outstanding receive before its buffer is freed.

inline virtual void reset() override#

Reset the node state.

Cancels any in-flight receive request and resets the connection.

Public Static Functions

static inline void initInstance(
NodeObj const &nodeObj,
GraphInstanceID instanceId,
)#

Initialize the node instance.

Default implementation - derived classes should override to initialize state.

Parameters:
  • nodeObj – [in] The node object

  • instanceId – [in] The instance ID

Protected Functions

inline bool computeImpl(
DatabaseT &db,
uint16_t port,
uint64_t tag,
uint32_t timeoutMs,
)#

Compute implementation for joint state subscription.

Advances the deferred receive by one step and outputs any message that has arrived. Never blocks.

Parameters:
  • db – [inout] Database accessor for node inputs/outputs

  • port – [in] Port number for UCX communication

  • tag – [in] UCX tag for message identification

  • timeoutMs – [in] Time a posted receive may stay outstanding before it is cancelled and re-posted, in milliseconds (0 = no deadline)

Returns:

bool True if execution succeeded, false otherwise

inline void discardReceiveOnConfigChange(uint16_t port, uint64_t tag)#

Discard an outstanding receive when the node’s port or tag has changed.

Runs on the update thread, so the request is abandoned rather than drained. Abandoning retires the buffer too, so a message received under the old configuration is never published.

Parameters:
  • port – [in] Port currently configured on the node

  • tag – [in] UCX tag currently configured on the node

inline void _clearReceiveWarningLatches()#

Re-arms the warning categories the receive path reports.

inline bool pollReceive(
DatabaseT &db,
uint16_t port,
uint64_t tag,
uint32_t timeoutMs,
)#

Advance the deferred receive by one step, without blocking.

Posts a receive request if none is outstanding, then polls it. On completion the message is parsed with parseMessage() and published with setOutputs().

Parameters:
  • db – [inout] Database accessor for node inputs/outputs

  • port – [in] Port the request is posted against

  • tag – [in] UCX tag for message identification

  • timeoutMs – [in] Deadline for the posted request, in milliseconds (0 = none)

Returns:

bool True if the node executed successfully, false on an unexpected error

inline bool postReceive(
DatabaseT &db,
uint16_t port,
uint64_t tag,
uint32_t timeoutMs,
)#

Post a receive request into the receive buffer.

Parameters:
  • db – [inout] Database accessor for logging

  • port – [in] Port the request is posted against

  • tag – [in] UCX tag for message identification

  • timeoutMs – [in] Deadline for the posted request, in milliseconds (0 = none)

Returns:

bool True if a request is now outstanding, false otherwise

Pre:

No request is outstanding, so sizing the buffer cannot touch a live request.

inline void enforceReceiveDeadline(
DatabaseT &db,
uint16_t port,
uint64_t tag,
uint32_t timeoutMs,
)#

Cancel and re-post the outstanding receive once its deadline has passed.

Parameters:
  • db – [inout] Database accessor for logging

  • port – [in] Port the replacement request is posted against

  • tag – [in] UCX tag for message identification

  • timeoutMs – [in] Deadline for the replacement request, in milliseconds

virtual JointCommandData parseMessage(
const std::vector<uint8_t> &buffer,
) = 0#

Parse joint command message from raw bytes.

Pure virtual function that derived classes must implement to parse the raw message buffer into a JointCommandData structure.

Parameters:

buffer – [in] Raw message buffer

Returns:

JointCommandData Parsed joint command data with valid flag set

inline void setOutputs(DatabaseT &db, const JointCommandData &data)#

Set node outputs from joint command data.

Sets the database outputs from the parsed joint command data structure.

Parameters:
  • db – [inout] Database accessor for node outputs

  • data – [in] Joint command data to output

inline bool initializeListener(uint16_t port)#

Gets or creates a listener for the specified port.

Returns an existing listener if one is already registered for the port, otherwise creates a new listener on the specified port.

The port is validated before attempting to create a listener. Invalid ports (0-1023) are rejected.

Parameters:

port – [in] Port number for the listener (must be >= 1024)

Returns:

bool True if listener was successfully obtained or created, false otherwise.

inline bool isInitialized() const#

Checks if the node has a valid listener.

Verifies if the listener has been properly created and initialized.

Returns:

bool True if the listener exists, false otherwise.

template<typename DatabaseT>
inline bool ensureListenerReady(
DatabaseT &db,
uint16_t port,
)#

Ensures the listener is initialized and started.

Initializes the listener if not already done or if the port has changed, and starts the progress thread. Validates the port number before initialization.

Template Parameters:

DatabaseT – The database type for logging

Parameters:
  • db – [in] Database accessor for logging

  • port – [in] Port number for the listener (must be >= 1024)

Returns:

bool True if listener is ready, false on error

inline bool waitForConnection()#

Waits for a client connection.

Checks if a connection exists, and if not, performs a non-blocking wait. Returns true if connected and ready to communicate, false if not yet connected.

Returns:

bool True if connected, false if no connection available

template<typename DatabaseT, typename ...Args>
inline void _logWarningOnce(
DatabaseT &db,
UcxWarningCategory category,
const char *format,
Args&&... args,
)#

Emits a warning the first time its category reports a problem.

The category stays latched until _clearWarningLatch() or _clearWarningLatches() re-arms it.

Template Parameters:
  • DatabaseT – The database type for logging

  • Args – Format argument types

Parameters:
  • db – [inout] Database accessor for logging

  • category – [in] Warning category to latch

  • format – [in] printf-style format string

  • args – [in] Format arguments

inline void _clearWarningLatch(UcxWarningCategory category)#

Re-arms a single warning category.

Parameters:

category – [in] Warning category to clear

inline void _clearWarningLatches()#

Re-arms every warning category.

template<typename DatabaseT>
inline bool publishMessage(
DatabaseT &db,
const std::vector<uint8_t> &messageData,
uint64_t tag,
uint32_t timeoutMs,
)#

Publishes a message over UCX with validation and timeout.

Validates that message data is not empty, then sends using UCX tagged send. Wrapper for UCXListener::tagSend() that adds logging for OmniGraph nodes.

Template Parameters:

DatabaseT – The database type for logging

Parameters:
  • db – [in] Database accessor for logging

  • messageData – [in] Serialized message data to send

  • tag – [in] UCX tag for message identification

  • timeoutMs – [in] Timeout in milliseconds for send request (0 is clamped to s_kDefaultSendTimeoutMs, see below)

Returns:

bool True if send completed successfully, false on error or timeout

Protected Attributes

UcxPendingRequest m_receive#

Deferred receive request and the buffer it writes into.

std::chrono::steady_clock::time_point m_receivePostedAt = {}#

When the outstanding request was posted.

uint64_t m_postedTag = 0#

Tag the outstanding request was posted against.

uint16_t m_postedPort = 0#

Port the outstanding request was posted against.

std::shared_ptr<isaacsim::ucx::core::UCXListener> m_listener = nullptr#

UCX listener instance. One latch per UcxWarningCategory; true once that category has been reported.

std::array<bool, static_cast<size_t>(UcxWarningCategory::eCount)> m_warningLatched = {}#

Protected Static Functions

static inline bool isValidPort(uint16_t port)#

Validates port number is in acceptable range for OmniGraph nodes.

Ports 0-1023 are system reserved and should not be used by OmniGraph nodes. Port 0 (auto-assign) is also not allowed to ensure deterministic behavior.

Parameters:

port – [in] Port number to validate

Returns:

bool True if port is valid (>= 1024), false otherwise

static inline bool isValidTag(uint64_t tag)#

Validates UCX tag value.

UCX uses the full 64-bit tag space. This function can be extended to restrict tag ranges if needed for application-specific protocols.

Parameters:

tag – [in] Tag value to validate

Returns:

bool True if tag is valid, false otherwise

Protected Static Attributes

static constexpr size_t s_kReceiveBufferSize = 65536#

Size of the receive buffer, in bytes.

static constexpr uint32_t s_kDefaultSendTimeoutMs = 100#

Send timeout substituted when a node is configured with an unbounded (0) timeout.