Fawkes API  Fawkes Development Version
escape_drive_mode.h
1 
2 /***************************************************************************
3  * escape_drive_mode.h - Implementation of drive-mode "escape"
4  *
5  * Created: Fri Oct 18 15:16:23 2013
6  * Copyright 2002 Stefan Jacobs
7  * 2013-2014 Bahram Maleki-Fard
8  * 2014 Tobias Neumann
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #ifndef _PLUGINS_COLLI_ESCAPE_DRIVE_MODE_H_
25 #define _PLUGINS_COLLI_ESCAPE_DRIVE_MODE_H_
26 
27 #include "abstract_drive_mode.h"
28 
29 #include <utils/math/types.h>
30 
31 #include <memory>
32 #include <vector>
33 
34 namespace fawkes {
35 
36 class RoboShapeColli;
37 
39 {
40 public:
41  EscapeDriveModule(Logger *logger, Configuration *config);
43 
44  virtual void update();
45 
46  void set_laser_data(std::vector<polar_coord_2d_t> &laser_points);
47 
48 private:
49  std::vector<polar_coord_2d_t> laser_points_;
50 
51  std::unique_ptr<RoboShapeColli> robo_shape_;
52 
53  /// Readings without robolength in it
54  std::vector<float> readings_normalized_;
55  std::vector<float> readings_front_, readings_back_;
56  std::vector<float> readings_left_front_, readings_left_back_;
57  std::vector<float> readings_right_front_, readings_right_back_;
58 
59  void fill_normalized_readings();
60  void sort_normalized_readings();
61 
62  bool check_danger(std::vector<float> readings);
63  bool turn_left_allowed();
64  bool turn_right_allowed();
65 };
66 
67 } // end namespace fawkes
68 
69 #endif
void set_laser_data(std::vector< polar_coord_2d_t > &laser_points)
This function sets the laser points for one escape round.
Fawkes library namespace.
virtual void update()
Calculate here your desired settings.
Class Escape-Drive-Module.
This is the base class which calculates drive modes.
Interface for configuration handling.
Definition: config.h:64
EscapeDriveModule(Logger *logger, Configuration *config)
Constructor.
Interface for logging.
Definition: logger.h:41