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 <vector>
32 
33 namespace fawkes
34 {
35 #if 0 /* just to make Emacs auto-indent happy */
36 }
37 #endif
38 
39 class RoboShapeColli;
40 
42 {
43  public:
44  EscapeDriveModule( Logger* logger, Configuration* config );
46 
47  virtual void update();
48 
49  void set_laser_data( std::vector<polar_coord_2d_t>& laser_points );
50 
51  private:
52  std::vector<polar_coord_2d_t> laser_points_;
53 
54  RoboShapeColli* robo_shape_;
55 
56  /// Readings without robolength in it
57  std::vector< float > readings_normalized_;
58  std::vector< float > readings_front_, readings_back_;
59  std::vector< float > readings_left_front_, readings_left_back_;
60  std::vector< float > readings_right_front_, readings_right_back_;
61 
62 
63  void fill_normalized_readings();
64  void sort_normalized_readings();
65 
66  bool check_danger( std::vector< float > readings );
67  bool turn_left_allowed();
68  bool turn_right_allowed();
69 };
70 
71 } // end namespace fawkes
72 
73 #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.
This class is mainly the same as the basic class with the difference that all data is precalculated o...
Interface for configuration handling.
Definition: config.h:67
EscapeDriveModule(Logger *logger, Configuration *config)
Constructor.
Interface for logging.
Definition: logger.h:34