Fawkes API  Fawkes Development Version
yaw_calibration.h
1 /***************************************************************************
2  * yaw_calibration.h - Calibrate yaw transform of the back laser
3  *
4  * Created: Tue 18 Jul 2017 16:58:12 CEST 16:58
5  * Copyright 2017 Till Hofmann <hofmann@kbsg.rwth-aachen.de>
6  ****************************************************************************/
7 
8 /* This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Library General Public License for more details.
17  *
18  * Read the full text in the LICENSE.GPL file in the doc directory.
19  */
20 
21 #ifndef YAW_CALIBRATION_H
22 #define YAW_CALIBRATION_H
23 
24 #include "laser_calibration.h"
25 
26 #include <random>
27 
28 class YawCalibration : public LaserCalibration
29 {
30 public:
32  LaserInterface * front_laser,
33  fawkes::tf::Transformer * tf_transformer,
35  std::string config_path);
36  virtual void calibrate();
37 
38 protected:
39  float get_current_cost(float *new_yaw);
40  float get_new_yaw(float current_cost, float last_yaw);
41 
42 protected:
43  /** The laser interface used to read the front laser data from */
45  /** The initial step size */
46  const float init_step_ = 0.02;
47  /** The current step size */
48  float step_;
49  /** Random number generator used to compute the random reset probability */
50  std::mt19937 random_generator_;
51  /** The distribution used to compute the random reset probability */
52  std::uniform_real_distribution<float> random_float_dist_;
53  /** A map of yaw config values to costs */
54  std::map<float, float> costs_;
55  /** The minimal cost */
56  float min_cost_;
57  /** A yaw configuration with the minimal cost */
58  float min_cost_yaw_;
59 };
60 
61 #endif /* !YAW_CALIBRATION_H */
YawCalibration::min_cost_
float min_cost_
The minimal cost.
Definition: yaw_calibration.h:59
YawCalibration::step_
float step_
The current step size.
Definition: yaw_calibration.h:51
YawCalibration::get_current_cost
float get_current_cost(float *new_yaw)
Get the cost of the current configuration.
Definition: yaw_calibration.cpp:112
fawkes::tf::Transformer
Definition: transformer.h:71
YawCalibration::get_new_yaw
float get_new_yaw(float current_cost, float last_yaw)
Compute the new yaw.
Definition: yaw_calibration.cpp:134
LaserCalibration
Definition: laser_calibration.h:65
YawCalibration::YawCalibration
YawCalibration(LaserInterface *laser, LaserInterface *front_laser, fawkes::tf::Transformer *tf_transformer, fawkes::NetworkConfiguration *config, std::string config_path)
Constructor.
Definition: yaw_calibration.cpp:43
YawCalibration::front_laser_
LaserInterface * front_laser_
The laser interface used to read the front laser data from.
Definition: yaw_calibration.h:47
YawCalibration::min_cost_yaw_
float min_cost_yaw_
A yaw configuration with the minimal cost.
Definition: yaw_calibration.h:61
fawkes::NetworkConfiguration
Definition: netconf.h:53
YawCalibration::random_float_dist_
std::uniform_real_distribution< float > random_float_dist_
The distribution used to compute the random reset probability.
Definition: yaw_calibration.h:55
YawCalibration::random_generator_
std::mt19937 random_generator_
Random number generator used to compute the random reset probability.
Definition: yaw_calibration.h:53
YawCalibration
Definition: yaw_calibration.h:27
fawkes::Laser360Interface
Definition: Laser360Interface.h:37
YawCalibration::costs_
std::map< float, float > costs_
A map of yaw config values to costs.
Definition: yaw_calibration.h:57
YawCalibration::init_step_
const float init_step_
The initial step size.
Definition: yaw_calibration.h:49
YawCalibration::calibrate
virtual void calibrate()
The actual calibration.
Definition: yaw_calibration.cpp:62