Template Function cppToPyMsg

Function Documentation

template<typename ROSMsgType>
nb::object cppToPyMsg(const ROSMsgType &cpp_msg, nb::object py_msg_class)

Template for converting C++ ROS 2 message types to their python equivalents.

Conversion is done using rclcpp’s serialization utility, which converts messages to raw bytes and back.

Parameters:
  • cpp_msg – The C++ ROS 2 message.

  • py_msg_class – The Python class/type to deserialize into

Returns:

An equivalent python ROS 2 message.