Map_test.h
Go to the documentation of this file.
1 #ifndef _MAP_TEST_H
2 #define _MAP_TEST_H
3 
4 #include "../../src/core/maps/grid_map.h"
5 #include "../../src/tiny_slam/tiny_grid_cells.h"
6 
7 class MapParams {
8 public:
9  MapParams (int height = 0, int width = 0, int map_center_x = 0, int map_center_y = 0) :
10  _height(height), _width(width),
11  _map_center_x(map_center_x), _map_center_y(map_center_y) {}
12 
13  friend bool operator==(const MapParams &left, const MapParams &right);
14 
15  int _height;
16  int _width;
19 };
20 
21 bool operator==(const MapParams &left, const MapParams &right) {
22  return (left._height == right._height) && (left._map_center_x == right._map_center_x)
23  &&(left._width == right._width) && (left._map_center_y == right._map_center_y);
24 }
25 
27  bool is_center_x_shifted = (map.map_center_x() == 0),
28  is_center_y_shifted = (map.map_center_y() == 0);
29 
30  int x0 = is_center_x_shifted ? 0 :
31  (map.map_center_x() - 1 - map.width());
32  int y0 = is_center_y_shifted ? 0 :
33  (map.map_center_y() - 1 - map.height());
34  int i = 0, j = 0;
35 
36  for (i = x0; i < map.width(); ++i) {
37  for (j = y0; j < map.height(); ++j) {
38  if (map.cell_value({i, j}) != 0.5) {
39  return false;
40  }
41  }
42  }
43 
44  return true;
45 }
46 
47 #endif
int _height
Definition: Map_test.h:15
double cell_value(const DiscretePoint2D &cell_coord) const
Definition: grid_map.h:90
int width() const
Returns the width of the map.
Definition: grid_map.h:54
int height() const
Returns thr height of the map.
Definition: grid_map.h:57
An occupancy grid implementation.
Definition: grid_map.h:22
MapParams(int height=0, int width=0, int map_center_x=0, int map_center_y=0)
Definition: Map_test.h:9
friend bool operator==(const MapParams &left, const MapParams &right)
Definition: Map_test.h:21
int _map_center_y
Definition: Map_test.h:18
int _map_center_x
Definition: Map_test.h:17
int _width
Definition: Map_test.h:16
bool test_CellValueNotChange(GridMap map)
Definition: Map_test.h:26
int map_center_y() const
Definition: grid_map.h:133
int map_center_x() const
Definition: grid_map.h:129


tiny_slam
Author(s):
autogenerated on Mon Jun 10 2019 15:30:57