Ros2MessageInterface#

Fully qualified name: isaacsim::ros2::bridge::Ros2MessageInterface

class Ros2MessageInterface#

Base class for ROS 2 message definition/generation via ROS Interface Definition Language (IDL).

Public Functions

inline Ros2MessageInterface(
std::string pkgName,
std::string msgSubfolder,
std::string msgName,
BackendMessageType messageType = BackendMessageType::eMessage,
bool showLoadingError = false,
)#

Constructor.

Parameters:
  • pkgName – Message package name (e.g.: "std_msgs" for std_msgs/msg/Int32).

  • msgSubfolder – Message subfolder name (e.g.: "msg" for std_msgs/msg/Int32).

  • msgName – Message name (e.g.: "Int32" for std_msgs/msg/Int32).

  • messageType – Message type.

  • showLoadingError – Whether to print ROS IDL libraries load errors to the console.

inline void *getTypeSupportHandleDynamic()#

Get the pointer to the struct that contains the ROS IDL message type support data.

The pointer points to a ROS IDL struct if the message if founded. It is resolved by calling the rosidl_typesupport_c type support handle symbol for the given message name.

Message type

ROS IDL struct

Topic (Message)

rosidl_message_type_support_t

Service

rosidl_service_type_support_t

Action

rosidl_action_type_support_t

Returns:

The pointer to the struct, otherwise nullptr.

inline void *getTypeSupportIntrospectionHandleDynamic()#

Get the pointer to the struct that contains the ROS IDL struct used to describe a single interface type.

The pointer points to a ROS IDL struct if the message if founded. It is resolved by calling the rosidl_typesupport_introspection_c type support handle symbol for the given message name and type.

Message type

ROS IDL struct

Topic (Message)

rosidl_message_type_support_t

Service

rosidl_service_type_support_t

Action

rosidl_message_type_support_t

Returns:

The pointer to the struct, otherwise nullptr.

inline void *create()#

Create the ROS 2 message.

This method creates/allocates the memory for the message and initializes it. The pointer is resolved by calling the rosidl_generator_c __create symbol for the given message.

Returns:

The pointer to the created message, otherwise nullptr.

template<typename T>
inline void destroy(T msg)#

Destroy the ROS 2 message.

This method finalizes the message by freeing its allocated memory. The pointer is resolved by calling the rosidl_generator_c __destroy symbol for the given message.

Parameters:

msg – The pointer to the message.

Protected Attributes

std::string m_pkgName#

Message package name.

std::string m_msgSubfolder#

Message subfolder name.

std::string m_msgName#

Message name.

BackendMessageType m_msgType#

Message type.

std::shared_ptr<isaacsim::core::utils::LibraryLoader> m_typesupportIntrospectionLibrary#

ROS IDL type support introspection library.

std::shared_ptr<isaacsim::core::utils::LibraryLoader> m_typesupportLibrary#

ROS IDL type support library.

std::shared_ptr<isaacsim::core::utils::LibraryLoader> m_generatorLibrary#

ROS IDL generator library.