Ros2ContextHandle#

Fully qualified name: isaacsim::ros2::bridge::Ros2ContextHandle

class Ros2ContextHandle#

Base class that encapsulates a non-global state of an ROS init/shutdown cycle (rcl_context_t) instance used in the creation of ROS 2 nodes and other entities.

Public Functions

virtual void *getContext() = 0#

Get the pointer to the ROS 2 context rcl_context_t struct.

Returns:

Pointer to the context.

virtual void init(
int argc,
char const *const *argv,
bool setDomainId = false,
size_t domainId = 0,
) = 0#

Initialize rcl and the context.

Parameters:
  • argc – Number of strings in argv.

  • argv – Command line arguments.

  • setDomainId – Whether to set the ROS domain ID. If true, the specified value will override the ROS_DOMAIN_ID environment variable.

  • domainId – ROS domain ID.

virtual bool isValid() = 0#

Check whether the object holds a valid ROS 2 context instance.

Returns:

Whether the object holds a valid ROS 2 context instance.

virtual bool shutdown(const char *shutdownReason = nullptr) = 0#

Shutdown the rcl context.

Parameters:

shutdownReason – An optional human-readable string that documents the shutdown reason.

Returns:

True if the shutdown was completed successfully, false otherwise.