Bratmobile
measurement.h
1 #ifndef MEASUREMENT_H
2 #define MEASUREMENT_H
3 #include "graphTools.h"
4 
5 class Task; //forward decl
11 protected:
12  bool valid =0;
13  float value=0;
14 public:
15  Measurement(){}
16 
17  bool isValid(){
18  return valid;
19  }
20 
21  float get_signed(){
22  return value;
23  }
24 
25  //returns unsigned value
26  float get(){
27  return fabs(value);
28  }
29 
30  void set(float f){
31  value =f;
32  }
33 
34  void setValid(bool b){
35  valid = b;
36  }
37 
41  bool operator>(Measurement &);
45  bool operator<(Measurement &);
49  bool operator<=(Measurement &);
53  bool operator>=(Measurement &);
54 
58  bool operator==(Measurement& m2);
59 
65  float getStandardError(Measurement, float); //relative standard error
66 
67 };
68 
69 
70 
71 class Angle: public Measurement{
72  public:
73  Angle(){}
74  Angle(float f){
75  //value =round(f*1000)/1000;
76  value = f; //no rounding
77  valid =1;}
78 };
79 
80 class Distance: public Measurement{
81  public:
82  Distance(){}
83  Distance(float f)
84  {value = round(f*1000)/1000;
85  valid =1;}
86 };
87 
92 struct EndCriteria{
93  Angle angle;
94  Distance distance; //max distance, ideal
98  float getStandardError(Angle a, Distance d);
99 
103  float getStandardError(Angle a, Distance d, State n);
104  bool hasEnd();
105 
106 
107  void operator=( EndCriteria ec){
108  angle=ec.angle;
109  distance=ec.distance;
110  }
111 
117  void adjust(const b2Transform& delta);
118 
119 
120 };
121 
126 struct EndedResult{
127  bool ended=0;
128  float estimatedCost=0; //dot product of end criteria, heuristic cost
129  float cost=0; //gamma
130 
131  EndedResult() = default;
132 
133 };
134 
135 float SignedVectorLength(b2Vec2);
136 
137 
138 #endif
Definition: measurement.h:71
Definition: measurement.h:80
A class for a single Task execution info measurement.
Definition: measurement.h:10
bool operator<(Measurement &)
Compares absolute values.
Definition: measurement.cpp:14
bool operator==(Measurement &m2)
Compares signed values.
Definition: measurement.cpp:47
bool operator<=(Measurement &)
Compares absolute values.
Definition: measurement.cpp:25
bool operator>(Measurement &)
Compares absolute values.
Definition: measurement.cpp:3
bool operator>=(Measurement &)
Compares absolute values.
Definition: measurement.cpp:36
float getStandardError(Measurement, float)
Gets error between this and another measurement, normalised by the maximum error value error can take...
Definition: measurement.cpp:60
A closed hybrid control loop. It has an initial disturbance representing the continuous state and a d...
Definition: task.h:47
Defines the end criteria for a Task, i.e. when it is considered to be finished.
Definition: measurement.h:92
void adjust(const b2Transform &delta)
Ajusts endcriteria based on the delta transform (2D transform representing how much the robot has tra...
Definition: measurement.cpp:105
float getStandardError(Angle a, Distance d)
Calculates normalised cumulative standard error for the given angle and distance.
Definition: measurement.cpp:73
Provides information on whether a Task has ended and with what heuristic -estimated- cost (chi) and p...
Definition: measurement.h:126
Hybrid states in the transition system.
Definition: graphTools.h:69