Fawkes API  Fawkes Development Version
select_drive_mode.h
1 
2 /***************************************************************************
3  * select_drive_mode.h - Class that selects the drive-mode from a collection
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_SELECT_DRIVE_MODE_H_
25 #define __PLUGINS_COLLI_SELECT_DRIVE_MODE_H_
26 
27 #include <vector>
28 
29 namespace fawkes
30 {
31 #if 0 /* just to make Emacs auto-indent happy */
32 }
33 #endif
34 
35 class AbstractDriveMode;
36 class MotorInterface;
37 class NavigatorInterface;
38 class Logger;
39 class Configuration;
40 class LaserOccupancyGrid;
41 
43 {
44 public:
46  NavigatorInterface* colli_target,
47  Logger* logger,
48  Configuration* config,
49  colli_escape_mode_t escape_mode = colli_escape_mode_t::basic);
50  ~SelectDriveMode( );
51 
52  ///\brief Set local target point before update!
53  void set_local_target( float x, float y );
54 
55  ///\brief Set local trajectory point before update!
56  void set_local_trajec( float x, float y );
57 
58  ///\brief Has to be called before the proposed values are called.
59  void update( bool escape = false );
60 
61  ///\brief Returns the proposed translation. After an update.
62  float get_proposed_trans_x();
63 
64  ///\brief Returns the proposed translation. After an update.
65  float get_proposed_trans_y();
66 
67  ///\brief Returns the proposed rotation. After an update.
68  float get_proposed_rot();
69 
70  void set_grid_information( LaserOccupancyGrid* occ_grid, int robo_x, int robo_y );
71 
72  void set_laser_data( std::vector<fawkes::polar_coord_2d_t>& laser_points );
73 
74 private:
75  Logger* logger_;
76  Configuration* config_;
77 
78  // local pointers to interfaces
79  NavigatorInterface* if_colli_target_;
80  MotorInterface* if_motor_;
81 
82  colli_escape_mode_t cfg_escape_mode_;
83 
84  // Vector of drive modes
85  std::vector< AbstractDriveMode * > drive_modes_;
86 
87  // local copies of current local target values
88  cart_coord_2d_t local_target_;
89  cart_coord_2d_t local_trajec_;
90 
91  // local copies of the proposed values
92  colli_trans_rot_t proposed_;
93 
94  // an escape flag
95  int escape_flag_;
96 
97  colli_drive_restriction_t drive_restriction_;
98 
99  /* ************************************************************************ */
100  /* PRIVATE METHODS */
101  /* ************************************************************************ */
102 
103  void load_drive_modes_differential();
104  void load_drive_modes_omnidirectional();
105 };
106 
107 } // namespace fawkes
108 
109 #endif
Cartesian coordinates (2D).
Definition: types.h:59
Fawkes library namespace.
Storing Translation and rotation.
Definition: types.h:60
This OccGrid is derived by the Occupancy Grid originally from Andreas Strack, but modified for speed ...
Definition: og_laser.h:49
This class selects the correct drive mode and calls the appopriate drive component.
colli_drive_restriction_t
Colli drive restrictions.
Definition: types.h:79
colli_escape_mode_t
Colli Escape modes.
Definition: types.h:67
MotorInterface Fawkes BlackBoard Interface.
Interface for configuration handling.
Definition: config.h:67
NavigatorInterface Fawkes BlackBoard Interface.
Interface for logging.
Definition: logger.h:34