6 #include "../core/maps/grid_cell.h" 7 #include "../core/maps/plain_grid_map.h" 13 #include "../core/maps/grid_map_scan_adders.h" 14 #include "../core/maps/const_occupancy_estimator.h" 15 #include "../core/scan_matchers/occupancy_observation_probability.h" 16 #include "../core/scan_matchers/weighted_mean_point_probability_spe.h" 17 #include "../core/scan_matchers/brute_force_scan_matcher.h" 23 std::unique_ptr<GridCell>
clone()
const override {
24 return std::make_unique<LastWriteWinsGridCell>(*this);
36 std::make_shared<UnboundedPlainGridMap>(
37 std::make_shared<LastWriteWinsGridCell>(),
41 std::shared_ptr<GridMap>
map() {
46 double score)
override {
47 auto coord = _map->world_to_cell({pose.
x, pose.
y});
48 auto eff_score = score;
55 _map->update(coord, {
true, {eff_score, 0}, {0, 0}, 1.0});
59 std::shared_ptr<GridMap>
_map;
65 std::cout <<
"[1] Closed Corridor" << std::endl;
78 for (
int x = -20;
x < 0;
x++) {
79 for (
int y = -8;
y < 10;
y++) {
80 map.update({
x,
y}, {
false, {0, 0}, {0, 0}, 1});
90 std::cout <<
"[2] Open Corridor" << std::endl;
98 for (
int y = -8;
y < 10;
y++) {
99 map.update({39,
y}, {
false, {0, 0}, {0, 0}, 1});
120 std::cout <<
"[3] Several Corridors" << std::endl;
134 int main(
int argc,
char **argv) {
145 .set_occupancy_estimator(
146 std::make_shared<ConstOccupancyEstimator>(
Occupancy{1.0, 1.0},
149 scan_adder->append_scan(map, pose, scan, 1.0);
154 auto sssb = std::make_shared<ScanMatcherSearchSpaceBuilder>(resolution);
159 .laser_scan_2D(map, {0.05, 0.05, 0}, 1);
163 std::make_shared<WeightedMeanPointProbabilitySPE>(
164 std::make_shared<ObstacleBasedOccupancyObservationPE>(),
165 std::make_shared<EvenSPW>()
173 auto start_time = std::chrono::high_resolution_clock::now();
174 bfsm.process_scan(tscan,
RobotPose{0.05, 0.05, 0}, map, result);
175 auto end_time = std::chrono::high_resolution_clock::now();
176 auto diff = std::chrono::duration<double>(end_time - start_time);
177 std::cout <<
"BF: " << diff.count() << std::endl;
std::shared_ptr< GridMap > _map
void run_evaluation(const GridMap &map, double resolution)
std::shared_ptr< GridMap > map()
static constexpr auto to_lsp(double max_dist, double fow_deg, unsigned pts_nm)
void subscribe(std::shared_ptr< GridScanMatcherObserver > obs)
LastWriteWinsGridCell(double prob=0.5)
void operator+=(const AreaOccupancyObservation &aoo) override
TFSIMD_FORCE_INLINE const tfScalar & y() const
static WallDistanceBlurringScanAdderBuilder builder()
ScanMatcherSearchSpaceBuilder(double resolution)
void apply_text_raster(MapType &dst_map, std::istream &src_raster, const DiscretePoint2D &dst_offset, int w_zoom=1, int h_zoom=1)
void run_several_corridors_case()
void on_scan_test(const RobotPose &pose, const LaserScan2D &, double score) override
TFSIMD_FORCE_INLINE const tfScalar & x() const
void on_map_update(const GridMapType &map) override
void dump_scan(const LaserScan2D &scan, const RobotPose &pose)
void run_open_corridor_case()
std::unique_ptr< GridCell > clone() const override
int main(int argc, char **argv)
void run_closed_corridor_case()