Function navmap_ros::to_msg(const navmap::NavMap&, const std::string&)

Function Documentation

navmap_ros_interfaces::msg::NavMapLayer navmap_ros::to_msg(const navmap::NavMap &nm, const std::string &layer)

Convert a single layer from a NavMap into a ROS message.

  • The returned message contains the layer name, type tag, and exactly one populated data array whose length equals the number of NavCels in nm.

  • The function performs a type-safe extraction (U8/F32/F64).

Parameters:
  • nm[in] Input NavMap.

  • layer[in] Name of the layer to export.

Returns:

A NavMapLayer message containing the layer values and metadata.

Throws:

std::runtime_error – If the layer does not exist or has an unsupported type.