UCXPublishJointStateNodeBase#
-
template<typename DatabaseT>
class UCXPublishJointStateNodeBase : public isaacsim::ucx::nodes::UcxNode# Templated base class for UCX joint state publishing nodes.
This template provides common functionality for publishing robot joint state data over UCX. Derived classes implement message generation logic via generateMessage().
- Template Parameters:
DatabaseT – The OGN database type for the node
Public Functions
-
inline virtual void reset() override#
Reset the node state.
Releases physics resources and clears cached data.
Public Static Functions
- static inline void initInstance(
- NodeObj const &nodeObj,
- GraphInstanceID instanceId,
Initialize the node instance.
Acquires the physics tensor API interface needed for reading joint data.
- Parameters:
nodeObj – [in] The node object
instanceId – [in] The instance ID
Protected Functions
- inline bool computeImpl(
- DatabaseT &db,
- const GraphContextObj &context,
- uint16_t port,
- uint64_t tag,
- uint32_t timeoutMs,
Common compute logic for joint state publishing nodes.
Handles listener initialization, connection checking, and message publishing. Initializes the articulation view if needed. Extracts data using extractData() and serializes using generateMessage().
- Parameters:
db – [in] Database accessor for node inputs/outputs
context – [in] Graph context for accessing stage
port – [in] Port number for UCX listener
tag – [in] UCX tag for message identification
timeoutMs – [in] Timeout in milliseconds for send request (0 = infinite)
- Returns:
bool True if execution succeeded, false otherwise
- inline virtual bool initializeArticulation(
- DatabaseT &db,
- const GraphContextObj &context,
Initialize the articulation view.
Creates the simulation view and articulation view for the target prim. If the target prim is not an articulation root, searches its children recursively.
- Parameters:
db – [in] Database accessor for node inputs
context – [in] Graph context for accessing stage
- Returns:
bool True if initialization succeeded, false otherwise
- virtual isaacsim::ucx::nodes::JointStateData extractData(
- DatabaseT &db,
Extract joint state data from articulation.
Pure virtual function that derived classes must implement to read joint data from the articulation and return it as JointStateData.
- Parameters:
db – [in] Database accessor for node inputs
- Returns:
JointStateData Extracted joint state data
- virtual std::vector<uint8_t> generateMessage(
- const isaacsim::ucx::nodes::JointStateData &data,
Generate message from joint state data.
Pure virtual function that derived classes must implement to serialize joint state data into the appropriate message format.
- Parameters:
data – [in] Joint state data to serialize
- Returns:
std::vector<uint8_t> Serialized message data
-
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>
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 = infinite)
- Returns:
bool True if send completed successfully, false on error or timeout
Protected Attributes
-
std::vector<float> m_jointPositions#
-
std::vector<float> m_jointVelocities#
-
std::vector<float> m_jointEfforts#
-
double m_unitScale = 1#
-
std::shared_ptr<isaacsim::ucx::core::UCXListener> m_listener = nullptr#
UCX listener instance.
Protected Static Functions
- static inline pxr::UsdPrim findArticulationRoot( )#
Find articulation root under a given prim.
Recursively searches for a prim with ArticulationRootAPI applied. If the given prim has the API, it’s returned. Otherwise, searches children.
- Parameters:
stage – [in] USD stage
startPrim – [in] Prim to start searching from
- Returns:
pxr::UsdPrim The articulation root prim, or invalid prim if not found
- static inline void createTensorDesc(
- omni::physics::tensors::TensorDesc &tensorDesc,
- void *data,
- uint32_t count,
- omni::physics::tensors::TensorDataType type,
Helper to create tensor descriptor.
-
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