1 #ifndef SLAM_CTOR_CORE_WORLD_H_INCLUDED 2 #define SLAM_CTOR_CORE_WORLD_H_INCLUDED 8 template <
typename SensorData>
18 virtual void on_pose_update(
const RobotPose &rs) = 0;
23 template<
typename MapType>
26 virtual void on_map_update(
const MapType &map) = 0;
31 template<
typename MapType>
35 _world_map_observers.push_back(obs);
39 _world_pose_observers.push_back(obs);
44 #define NOTIFY_EACH_WOBSERVER(var) \ 45 for (auto &raw_obs : _world_##var##_observers) { \ 46 auto obs_ptr = raw_obs.lock(); \ 48 obs_ptr->on_##var##_update(var); \ 60 #undef NOTIFY_EACH_WOBSERVER 68 template <
typename ObservationType,
typename MapT>
82 virtual const MapType& map()
const = 0;
91 virtual void handle_observation(ObservationType&) = 0;
92 virtual ~
World() =
default;
#define NOTIFY_EACH_WOBSERVER(var)
virtual const RobotPose & pose() const
void subscribe_map(std::shared_ptr< WorldMapObserver< MapType >> obs)
void subscribe_pose(std::shared_ptr< WorldPoseObserver > obs)
virtual void handle_sensor_data(SensorData &)=0
void notify_with_map(const MapType &map)
std::vector< std::weak_ptr< WorldMapObserver< MapType > > > _world_map_observers
virtual const World< ObservationType, MapType > & world() const
std::vector< std::weak_ptr< WorldPoseObserver > > _world_pose_observers
void notify_with_pose(const RobotPose &pose)
virtual void update_robot_pose(const RobotPoseDelta &delta)