terrain_estimator
ModelBaseAnalysis.hpp
Go to the documentation of this file.
1 #ifndef MODEL_BASE_ANALYSIS_H
2 #define MODEL_BASE_ANALYSIS_H
3 
4 #include <Eigen/Core>
5 #include <Eigen/Geometry>
6 
7 #include "TerrainConfiguration.hpp"
8 #include <iostream>
9 #include <vector>
10 #include <deque>
11 using namespace Eigen;
12 
13 
15 {
16 
28  public:
29 
36  SVMTerrainClassification(std::vector<TerrainType> terrain_types, int min_number_of_votes);
37 
41  void addSVMClassifier(SVMConfiguration svm_function);
42 
46  void addSVMClassifier(std::vector<SVMConfiguration> svm_functions){ this->svm_functions = svm_functions; }
47 
53  TerrainType getTerrainClassification(std::vector<double> histogram);
54 
59  double getProbability(TerrainType type);
60 
61  private:
62 
66  void calculateSVMValue();
67 
68  int getIndexType(TerrainType type);
69 
70  std::vector < SVMConfiguration > svm_functions;
71 
72  std::vector<TerrainType> terrain_types;
73 
74  int min_number_of_votes;
75 
76  std::vector<double> probability;
77 
78  double svm_value;
79 
80  };
81 
93  public:
94 
98  HistogramTerrainClassification(uint number_histograms);
99 
107  bool addHistogram(std::vector<double> histogram, std::vector<double> histogram_angular_velocity, std::vector<double> histogram_linear_velocity );
108 
112  std::vector<double> getCombinedHistogram();
113 
114 
115  private:
116  std::deque < std::vector<double> > histogram_list;
117 
118  std::vector<double> combined_histogram;
119 
120  uint number_histograms;
121  };
122 
124  struct Step{
126  std::vector<double> traction;
128  std::vector<double> angular_velocity;
130  std::vector<double> linear_velocity;
132  double max_traction;
134  double min_traction;
136  double min_angle;
138  double max_angle;
140  double id;
142  double last_encoder;
143  };
144 
159 
160  public:
161  TractionForceGroupedIntoStep(double angle_between_legs);
162 
170  void addTraction(double traction, double encoder);
171 
177  void addRobotVelocities(double angular_velocity, double linear_velocity);
178 
182  double getCompletedStepId();
183 
187  Step getCompletedStep();
188 
192  double getMaximalTractionEitherStep();
193 
197  double getMinimalTractionEitherStep();
198 
199  private:
200 
202  Step completed_step;
203 
205  Step current_step;
206 
213  bool isCurrentStepCompleted();
214 
219  double getStepId(double encoder);
220 
224  void initCurrentStep();
225 
230  double getLegAngle( double encoder );
231 
232  double angle_between_legs;
233 
234  };
235 
248  class Histogram {
249  public:
260  Histogram(int numb_bins, double min_value, double max_value);
261 
265  void addValue( double value );
266 
270  void clearHistogram();
271 
275  std::vector<double> getHistogram();
276 
280  double getNumberPoints(){ return number_points; }
281 
282  private:
283 
285  double max_value;
286 
288  double min_value;
289 
291  int numb_bins;
292 
294  std::vector<double> histogram;
295 
297  double number_points;
298 
300  double bin_size;
301  };
302 
327  public:
328  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
329 
337  SlipDetectionModelBased(double axis_rotation, uint fl, uint fr, uint rl, uint rr);
338 
339  ~SlipDetectionModelBased();
340 
349  bool slipDetection(Vector4d translation, double delta_heading_measured, double slip_threashold);
350 
354  double getWheelSlipSingleCase();
355 
359  bool hasWheelSingleSliped(int wheel);
360 
364  bool hasWheelSliped(int wheel);
365 
369  bool hasWheelConsecutivelySliped(int wheel);
370 
374  void analyzeConsecutiveSlips();
375 
378 
381 
383  Eigen::Vector4d total_slip;
384 
386  Vector4d slip_votes;
387 
390  private:
394  bool hasSingleWheelSliped();
395 
399  Eigen::Vector4d slipValue(Vector4d translation, double right_translation, double left_translation);
400 
401  double axis_rotation;
402  uint fl;
403  uint fr;
404  uint rl;
405  uint rr;
406 
407 
408 
409  };
410 
425 
426  public:
427  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
428 
429  LegWheelOdometry(double angle_between_legs, double radius){this->angle_between_legs = angle_between_legs; this->radius = radius; }
430 
431 
432  void setInitialEncoder(Vector4d encoder){ this->init_encoder = encoder; }
433 
437  Vector4d translationAxes(Vector4d encoder);
438 
442  double translationAxis(double encoder, double initial_encoder);
443 
444  private:
449  double numberOfCycles(double encoder);
450 
454  double getLegPos(double external_encoder_value);
455 
456  Vector4d init_encoder;
457 
458  private:
459  //Asguard Model Parameters
460  double angle_between_legs;
461  double radius;
462 
463  };
464 
465 
466 
467 }
468 
469 #endif
A list of the last N histograms of traction values are combined into a single histogram.
Definition: ModelBaseAnalysis.hpp:92
Definition: ModelBaseAnalysis.hpp:124
double delta_theta_model
Definition: ModelBaseAnalysis.hpp:377
Using asguard model it calculates the translation of each axis in the plane paralel to the ground Thi...
Definition: ModelBaseAnalysis.hpp:424
Groups traction force measurement into a vector corresponding to a step A step is caracterize by the ...
Definition: ModelBaseAnalysis.hpp:158
double getNumberPoints()
Definition: ModelBaseAnalysis.hpp:280
Estimates slip using the vehicle model constrains.
Definition: ModelBaseAnalysis.hpp:326
Eigen::Vector4d total_slip
Definition: ModelBaseAnalysis.hpp:383
Creates a Histogram for measured values All value beneath min value are grouped in the first bin All ...
Definition: ModelBaseAnalysis.hpp:248
A batch of SVM function is used to classify the histogram.
Definition: ModelBaseAnalysis.hpp:27
double max_traction
Definition: ModelBaseAnalysis.hpp:132
Vector4d slip_votes
Definition: ModelBaseAnalysis.hpp:386
Vector4d consectuive_slip_votes
Definition: ModelBaseAnalysis.hpp:389
void addSVMClassifier(std::vector< SVMConfiguration > svm_functions)
Definition: ModelBaseAnalysis.hpp:46
Definition: ModelBaseAnalysis.hpp:14
double delta_theta_measured
Definition: ModelBaseAnalysis.hpp:380
Definition: TerrainConfiguration.hpp:149
std::vector< double > traction
Definition: ModelBaseAnalysis.hpp:126
std::vector< double > angular_velocity
Definition: ModelBaseAnalysis.hpp:128
EIGEN_MAKE_ALIGNED_OPERATOR_NEW LegWheelOdometry(double angle_between_legs, double radius)
Definition: ModelBaseAnalysis.hpp:429
TerrainType
Definition: TerrainConfiguration.hpp:10
double id
Definition: ModelBaseAnalysis.hpp:140
double max_angle
Definition: ModelBaseAnalysis.hpp:138
double min_traction
Definition: ModelBaseAnalysis.hpp:134
double last_encoder
Definition: ModelBaseAnalysis.hpp:142
double min_angle
Definition: ModelBaseAnalysis.hpp:136
void setInitialEncoder(Vector4d encoder)
Definition: ModelBaseAnalysis.hpp:432
std::vector< double > linear_velocity
Definition: ModelBaseAnalysis.hpp:130