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 &);
50 
54  bool operator==(Measurement& m2);
55 
61  float getStandardError(Measurement, float); //relative standard error
62 
63 };
64 
65 
66 
67 class Angle: public Measurement{
68  public:
69  Angle(){}
70  Angle(float f){
71  //value =round(f*1000)/1000;
72  value = f; //no rounding
73  valid =1;}
74 };
75 
76 class Distance: public Measurement{
77  public:
78  Distance(){}
79  Distance(float f)
80  {value = round(f*1000)/1000;
81  valid =1;}
82 };
83 
88 struct EndCriteria{
89  Angle angle;
90  Distance distance; //max distance, ideal
94  float getStandardError(Angle a, Distance d);
95 
99  float getStandardError(Angle a, Distance d, State n);
100  bool hasEnd();
101 
102 
103  void operator=( EndCriteria ec){
104  angle=ec.angle;
105  distance=ec.distance;
106  }
107 
113  void adjust(const b2Transform& delta);
114 
115 
116 };
117 
122 struct EndedResult{
123  bool ended=0;
124  float estimatedCost=0; //dot product of end criteria, heuristic cost
125  float cost=0; //gamma
126 
127  EndedResult() = default;
128 
129 };
130 
131 float SignedVectorLength(b2Vec2);
132 
133 
134 #endif
Definition: measurement.h:67
Definition: measurement.h:76
A class for a single Task execution info measurement.
Definition: measurement.h:10
bool operator<(Measurement &)
Compares absolute values.
Definition: measurement.cpp:3
bool operator==(Measurement &m2)
Compares signed values.
Definition: measurement.cpp:36
bool operator<=(Measurement &)
Compares absolute values.
Definition: measurement.cpp:14
bool operator>=(Measurement &)
Compares absolute values.
Definition: measurement.cpp:25
float getStandardError(Measurement, float)
Gets error between this and another measurement, normalised by the maximum error value error can take...
Definition: measurement.cpp:49
A closed hybrid control loop. It has an initial disturbance representing the continuous state and a d...
Definition: task.h:45
Defines the end criteria for a Task, i.e. when it is considered to be finished.
Definition: measurement.h:88
void adjust(const b2Transform &delta)
Ajusts endcriteria based on the delta transform (2D transform representing how much the robot has tra...
Definition: measurement.cpp:94
float getStandardError(Angle a, Distance d)
Calculates normalised cumulative standard error for the given angle and distance.
Definition: measurement.cpp:62
Provides information on whether a Task has ended and with what heuristic -estimated- cost (chi) and p...
Definition: measurement.h:122
Hybrid states in the transition system.
Definition: graphTools.h:69