1 #ifndef __RVIZ_GRID_VIEWER_H 2 #define __RVIZ_GRID_VIEWER_H 8 #include <nav_msgs/OccupancyGrid.h> 10 #include "../core/state_data.h" 11 #include "../core/maps/grid_map.h" 25 std::string frame_odom, std::string frame_robot_pose) :
54 nav_msgs::OccupancyGrid map_msg;
56 map_msg.info.width = map.
width();
57 map_msg.info.height = map.
height();
58 map_msg.info.resolution = map.
scale();
60 nav_msgs::MapMetaData &info = map_msg.info;
61 info.origin.position.x = -info.resolution * map.
map_center_x();
62 info.origin.position.y = -info.resolution * map.
map_center_y();
63 info.origin.position.z = 0;
65 for (
const auto &row : map.
cells()) {
66 for (
const auto &cell : row) {
67 int cell_value = cell->value() == -1 ? -1 : cell->value() * 100;
68 map_msg.data.push_back(cell_value);
The class publishes information about robot's map and location in ROS-compatible format so it can be ...
void publish(const boost::shared_ptr< M > &message) const
tf::TransformBroadcaster _tf_brcst
int width() const
Returns the width of the map.
void show_robot_pose(const RobotState &r)
int height() const
Returns thr height of the map.
const double map_publishing_rate
An occupancy grid implementation.
double theta
The position of robot.
void setRPY(const tfScalar &roll, const tfScalar &pitch, const tfScalar &yaw)
Defines a robot position in cartesian coordinates and an angle of rotation.
double scale() const
Returns the scale.
void show_map(const GridMap &map)
std::string _frame_robot_pose
RvizGridViewer(ros::Publisher pub, const double show_map_rate, std::string frame_odom, std::string frame_robot_pose)
const std::vector< std::vector< Cell > > cells() const
Returns map's cells.