35 #include <gtest/gtest.h>
39 #include <costmap_cspace_msgs/MapMetaData3D.h>
50 using Vec3 = CyclicVecInt<3, 2>;
51 using Astar = GridAstar<3, 2>;
53 class DistanceMapTest :
public ::testing::Test
76 const int local_range = 0;
77 omp_set_num_threads(2);
79 costmap_cspace_msgs::MapMetaData3D map_info;
83 map_info.linear_resolution = 1.0;
84 map_info.angular_resolution = M_PI * 2 /
angle_;
95 Astar::Gridmap<char, 0x40> cm;
96 Astar::Gridmap<char, 0x80> cm_hyst;
105 cm_hyst.reset(size3d);
118 .local_range = local_range,
121 .resolution = map_info.linear_resolution,
140 for (
int x = 1; x <
w_ - 1; x++)
151 for (
int y = 0; y <
h_; y++)
153 for (
int x = 0; x <
w_; x++)
161 if (::testing::Test::HasFailure())
178 dm_full_.create(
s, e);
179 dm_fast_.create(
s, e);
180 debugOutput(dm_fast_, cm_rough_,
s, e);
185 dm_full_.create(
s, e);
187 debugOutput(dm_fast_, cm_rough_,
s, e);
191 fprintf(stderr,
"expected:\n");
192 debugOutput(dm_full_, cm_rough_,
s, e);
204 dm_full_.create(
s, e);
205 dm_fast_.create(
s, e);
206 debugOutput(dm_fast_, cm_rough_,
s, e);
217 dm_full_.create(
s, e);
219 debugOutput(dm_fast_, cm_rough_,
s, e);
223 fprintf(stderr,
"expected:\n");
224 debugOutput(dm_full_, cm_rough_,
s, e);
230 dm_full_.create(
s, e);
232 debugOutput(dm_fast_, cm_rough_,
s, e);
236 fprintf(stderr,
"expected:\n");
237 debugOutput(dm_full_, cm_rough_,
s, e);
249 dm_full_.create(
s, e);
251 debugOutput(dm_fast_, cm_rough_,
s, e);
253 if (!
validate(
"obstacle out of range"))
255 fprintf(stderr,
"expected:\n");
256 debugOutput(dm_full_, cm_rough_,
s, e);
263 int main(
int argc,
char** argv)
265 testing::InitGoogleTest(&argc, argv);
267 return RUN_ALL_TESTS();