tiny_fascade.h
Go to the documentation of this file.
1 #ifndef __TINY_SLAM_FASCADE_H
2 #define __TINY_SLAM_FASCADE_H
3 
4 #include <memory>
5 
6 #include "../ros/laser_scan_observer.h"
7 #include "../ros/rviz_grid_viewer.h"
8 #include "../core/maps/grid_cell_strategy.h"
9 
10 #include "tiny_world.h"
11 
22 private:
23  using ScanMatcherObsPtr = std::shared_ptr<GridScanMatcherObserver>;
24 public: // methods
25  // TODO: copy ctor, move ctor, dtor
34  TinySlamFascade(std::shared_ptr<GridCellStrategy> gcs,
35  const TinyWorldParams &params,
36  const GridMapParams &init_map_params,
37  bool skip_max_vals):
38  LaserScanObserver(skip_max_vals),
39  _world(new TinyWorld(gcs, params, init_map_params)) {}
40 
45  void set_viewer(std::shared_ptr<RvizGridViewer> viewer) {
46  _viewer = viewer;
47  }
48 
56  _world->update_robot_pose(scan.d_x, scan.d_y, scan.d_yaw);
57  _world->handle_observation(scan);
58 
59  if (_viewer) {
60  _viewer->show_robot_pose(_world->pose());
61  _viewer->show_map(_world->map());
62  }
63  }
64 
70  _world->scan_matcher()->subscribe(obs);
71  }
72 
78  _world->scan_matcher()->unsubscribe(obs);
79  }
80 
81 private:
82  // Position by IMU, used to calculate delta
83  std::unique_ptr<TinyWorld> _world;
84  std::shared_ptr<RvizGridViewer> _viewer;
85 };
86 
87 #endif
TinySlamFascade(std::shared_ptr< GridCellStrategy > gcs, const TinyWorldParams &params, const GridMapParams &init_map_params, bool skip_max_vals)
Definition: tiny_fascade.h:34
std::shared_ptr< RvizGridViewer > _viewer
Definition: tiny_fascade.h:84
virtual void handle_laser_scan(TransformedLaserScan &scan)
Definition: tiny_fascade.h:55
Class responsibilities: observes laser scans and odometry; converts ROS structures to internal repres...
std::unique_ptr< TinyWorld > _world
Definition: tiny_fascade.h:83
void remove_scan_matcher_observer(ScanMatcherObsPtr obs)
Definition: tiny_fascade.h:77
A container for the following tinySLAM parameters: TODO: params description.
Definition: tiny_world.h:20
void add_scan_matcher_observer(ScanMatcherObsPtr obs)
Definition: tiny_fascade.h:69
The class implements the tinySLAM-specific map update logic.
Definition: tiny_world.h:40
void set_viewer(std::shared_ptr< RvizGridViewer > viewer)
Definition: tiny_fascade.h:45
The TinySLAM access point. SLAM users are supposed to work with it.
Definition: tiny_fascade.h:21
std::shared_ptr< GridScanMatcherObserver > ScanMatcherObsPtr
Definition: tiny_fascade.h:23
Framework internal representation of a laser scan.
Definition: sensor_data.h:33
double d_yaw
The odometry delta.
Definition: sensor_data.h:34


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