-
Notifications
You must be signed in to change notification settings - Fork 4
/
radar.hpp
46 lines (44 loc) · 1.21 KB
/
radar.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef FASTSIM_RADAR_HPP_
#define FASTSIM_RADAR_HPP_
#include <boost/shared_ptr.hpp>
#include "posture.hpp"
#include "map.hpp"
namespace fastsim {
/// a radar detects a given goal in one of the n slices
/// radar SEE TROUGH OBSTACLES
class Radar {
public:
Radar(int color, int nb_slices, bool through_walls = true) :
_color(color), _nb_slices(nb_slices), _inc(2 * M_PI / nb_slices),
_activated_slice(0),
_through_walls(through_walls) {
}
int update(const Posture& pos,
const boost::shared_ptr<Map>& map);
int get_activated_slice() const {
return _activated_slice;
}
int get_nb_slices() const {
return _nb_slices;
}
int get_color() const {
return _color;
}
float get_inc() const {
return _inc;
}
protected:
// the "color" (i.e. goal identifier) detected by this "radar"
int _color;
// the number of pie-slices
int _nb_slices;
// the size of a slice
float _inc;
// the activated slices (-1 if the goal is not visible)
int _activated_slice;
// true if the radar can see trough walls
// get_activated_slices() will return -1 if the goal is not visible
bool _through_walls;
};
}
#endif