-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplanner.h
More file actions
97 lines (80 loc) · 3.03 KB
/
planner.h
File metadata and controls
97 lines (80 loc) · 3.03 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* @file planner.h
*
* Declaration of superclass for all planners.
*
* @author Adrien Perkins <adrienp@stanford.edu>
*/
#ifndef _PLANNER_H_
#define _PLANNER_H_
#include <vector>
using std::vector;
/**
* @class Planner
*
* This is the superclass for any of the planners.
* Sets all of the observable information and is a passthrough for the action functions.
*
* Any subclass must implement and initialize() and action() functions.
*
*/
class Planner {
public:
/**
* constructor
*/
Planner();
/**
* destructor
*/
~Planner();
/**
* reset the current observation values. Not necessarily needed, but good to make sure.
*/
void reset_observations();
/**
* determine max signal strength from a set of measurements.
* @param rssi_values vector of the set of measurements
* @return integer value of the maximum signal strength
*/
int get_max_rssi(const vector<double> rssi_values);
/**
* update a single observation. A single observations is just a heading and signal strength.
* @param heading heading of the antenna for this measurement
* @param dir_gain signal strength value from the directional antenna
* @param omni_gain signal strength value from the omni directional atenna
*/
void update_observation(const double &heading, const double &dir_gain, const double &omni_gain);
/**
* update a set of observations. For example after a rotation.
* @param headings vector of headings for the signal strength measurements
* @param dir_gains vector of measured signal strength values from the directional antenna
* @param omni_gains vector of measured signal strength values from the omnidirectional antenna
* @param bearing_cc calculated cross correlation bearing
* @param bearing_max calculated max bearing
* @param bearing_max3 calculated max3 bearing
*/
void update_observations(const vector<double> headings, const vector<double> dir_gains, const vector<double> omni_gains, const vector<int> norm_gains,
const double &bearing_cc, const double &bearing_max, const double &bearing_max3);
/**
* initialize the current planner. To be implemented by each individual planner.
* @return -1 if initialization fails
*/
virtual int initialize() {};
/**
* calculates what the next action should be. This is to be each individual planner.
* @return action as a vector, defined as <dNorth, dEast, dYaw, alt>
*/
virtual vector<float> action() {};
protected:
/* constants that will be available to all the subclasses */
vector<double> _angles; // the heading associated with the gains
vector<double> _gains; // the gains measured from the main sensor (e.g. directional antenna)
vector<double> _omni_gains; // the gains measured from the second sensor (e.g. omni antenna)
vector<int> _norm_gains; // the normalized gains
double _bearing_cc; // the cross correlation bearing
double _bearing_max; // the max method bearing
double _bearing_max3; // the max3 method bearing
double _max_rssi; // the max signal strength in this set
};
#endif /* _PLANNER_H_ */