Ros2Node#

Fully qualified name: isaacsim::ros2::bridge::Ros2Node

class Ros2Node : public BaseResetNode#

Base class for ROS 2 bridge nodes.

This class handles the lifetime of the internal ROS 2 node handle automatically.

Public Functions

inline Ros2Node()#

Constructor.

During the construction of the object, the carb interfaces and the ROS 2 factory will be retrieved to be used by the derived classes.

inline ~Ros2Node()#

Destructor.

inline virtual void reset()#

Reset the Ros2NodeHandle handler.

This method should be called by derived classes after they reset any publishers/subscribers attached to the node.

inline bool initializeNodeHandle(
const std::string &nodeName,
const std::string &namespaceName,
uint64_t contextHandleAddr,
)#

Do node work to initialize the node handler once.

This function should be called before doing any work with any OmniGraph node. Changes to the node name are only handled if Stop and Play are pressed.

Parameters:
  • nodeName – Name of the node.

  • namespaceName – Namespace of the node.

  • contextHandleAddr – Context handler’s memory address.

Returns:

Whether the node handler has been initialized.

inline bool isInitialized() const#

Get whether the ROS 2 node has been initialized.

Returns:

True if the node handle has been initialized, False otherwise.

Public Static Functions

static inline std::string addTopicPrefix(
const std::string &prefix,
const std::string &topicName,
)#

Add the specified prefix to the given topic name.

This method will insert the separator character (/) between the prefix and the topic name.

Parameters:
  • prefix – Prefix to add to the topic.

  • topicName – Name of the topic.

Returns:

Name of the topic prefixed with the specified prefix.

static inline std::string collectNamespace(
const std::string &namespaceInput,
const PXR_NS::UsdPrim &startPrim,
const bool tfNode = false,
)#

Collect namespaces defined for parent prims in a stage and automatically form a node namespace.

This method performs a reverse search up a USD stage and for each parent prim containing isaac:namespace attribute, it will continue prepending the each namespace value. It will insert the separator character (/) between each namespace value.

Parameters:
  • namespaceInput – Node Namespace. If not empty, it will be returned as it is and no search will be performed.

  • startPrim – USD Prim to start the reverse search.

  • tfNode – Set to true if collecting namespace for a TF ROS 2 node

Returns:

Name of the topic prefixed with the specified prefix.

Protected Attributes

isaacsim::ros2::bridge::Ros2Bridge *m_ros2Bridge = nullptr#

Ros2Bridge (carb) interface.

std::shared_ptr<Ros2NodeHandle> m_nodeHandle = nullptr#

Node handler.

carb::settings::ISettings *m_settings = nullptr#

Settings (carb) interface.

bool m_publishWithoutVerification#

Whether to publish in a topic even if there are no subscription to it.

std::shared_ptr<Ros2ContextHandle> *m_contextHandle#

Context handler.

isaacsim::core::nodes::CoreNodes *m_coreNodeFramework#

CoreNodes (carb) interface.

Ros2Factory *m_factory = nullptr#

Factory instance for creating ROS 2 related objects according to the sourced ROS 2 distribution.

std::string m_namespaceName#

Namespace name.