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