35 #ifndef NAV_GRID_PUB_SUB_NAV_GRID_MESSAGE_UTILS_H 36 #define NAV_GRID_PUB_SUB_NAV_GRID_MESSAGE_UTILS_H 39 #include <nav_2d_msgs/NavGridOfChars.h> 40 #include <nav_2d_msgs/NavGridOfCharsUpdate.h> 41 #include <nav_2d_msgs/NavGridOfDoubles.h> 42 #include <nav_2d_msgs/NavGridOfDoublesUpdate.h> 58 template<
typename ROSMsgType,
typename NumericType>
68 unsigned int data_index = 0;
71 msg.data[data_index++] = grid(index);
81 template<
typename ROSMsgType,
typename NumericType>
90 unsigned int data_index = 0;
94 update.data[data_index++] = grid(index);
102 template<
typename ROSMsgType,
typename NumericType>
107 if (info != current_info)
112 unsigned int data_index = 0;
115 grid.
setValue(index, msg.data[data_index++]);
122 template<
typename ROSMsgType,
typename NumericType>
128 unsigned int data_index = 0;
131 grid.
setValue(index, update.data[data_index++]);
142 return toMsg<nav_2d_msgs::NavGridOfChars>(grid, stamp);
150 return toMsg<nav_2d_msgs::NavGridOfDoubles>(grid, stamp);
158 return toMsg<nav_2d_msgs::NavGridOfDoubles>(grid, stamp);
167 return toUpdate<nav_2d_msgs::NavGridOfCharsUpdate>(grid, bounds, stamp);
176 return toUpdate<nav_2d_msgs::NavGridOfDoublesUpdate>(grid, bounds, stamp);
185 return toUpdate<nav_2d_msgs::NavGridOfDoublesUpdate>(grid, bounds, stamp);
191 #endif // NAV_GRID_PUB_SUB_NAV_GRID_MESSAGE_UTILS_H ROSMsgType toUpdate(const nav_grid::NavGrid< NumericType > &grid, const nav_core2::UIntBounds &bounds, const ros::Time &stamp)
Generic conversion from a portion of a grid of arbitrary type to an update message of arbitrary type...
virtual void setValue(const unsigned int x, const unsigned int y, const T &value)=0
nav_2d_msgs::NavGridInfo toMsg(const nav_grid::NavGridInfo &info)
nav_grid::NavGridInfo fromMsg(const nav_2d_msgs::NavGridInfo &msg)
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
virtual void setInfo(const NavGridInfo &new_info)=0
NavGridInfo getInfo() const
unsigned int getHeight() const
void fromMsg(const ROSMsgType &msg, nav_grid::NavGrid< NumericType > &grid)
Generic conversion from message of arbitrary type to grid of arbitrary type.
unsigned int getWidth() const
ROSMsgType toMsg(const nav_grid::NavGrid< NumericType > &grid, const ros::Time &stamp)
Utilities for converting NavGrid objects to NavGridOfX messages and updates.
nav_core2::UIntBounds fromUpdate(const ROSMsgType &update, nav_grid::NavGrid< NumericType > &grid)
Generic conversion from an update message to a portion of a grid of arbitrary type.