Ros2ImageMessage#

Fully qualified name: isaacsim::ros2::bridge::Ros2ImageMessage

class Ros2ImageMessage : public isaacsim::ros2::bridge::Ros2Message#

Class implementing a sensor_msgs/msg/Image message.

Public Functions

virtual void writeHeader(
const double timeStamp,
const std::string &frameId,
) = 0#

Write the message header.

Parameters:
  • timeStamp – Time (seconds).

  • frameId – Transform frame with which this data is associated.

virtual void generateBuffer(
const uint32_t height,
const uint32_t width,
const std::string &encoding,
) = 0#

Generate the buffer (matrix data) according to the image metadata.

It allocates memory for the data field, and computes and fills in the values of the other message fields.

Parameters:
  • height – Image height.

  • width – Image width.

  • encoding – Encoding of pixels.

inline void *getBufferPtr()#

Get the pointer to the buffer (matrix data).

Returns:

Pointer to the buffer.

inline size_t getTotalBytes()#

Get the total size (step * height) of the buffer, in bytes.

Returns:

Buffer size.

inline void *getPtr()#

Get the message pointer.

Returns:

The pointer to the message if it has been created and initialized properly, otherwise nullptr.

virtual const void *getTypeSupportHandle() = 0#

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.

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.

Protected Attributes

std::vector<uint8_t> m_buffer#

Buffer (matrix data).

size_t m_totalBytes = 0#

Buffer size.

void *m_msg = nullptr#

Message pointer.