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
31namespace fawkes {
32
33class AbstractDriveMode;
34class MotorInterface;
35class NavigatorInterface;
36class Logger;
37class Configuration;
38class LaserOccupancyGrid;
39
41{
42public:
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.
61
62 ///\brief Returns the proposed translation. After an update.
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
72private:
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
Interface for configuration handling.
Definition: config.h:68
This OccGrid is derived by the Occupancy Grid originally from Andreas Strack, but modified for speed ...
Definition: og_laser.h:47
Interface for logging.
Definition: logger.h:42
MotorInterface Fawkes BlackBoard Interface.
NavigatorInterface Fawkes BlackBoard Interface.
This class selects the correct drive mode and calls the appopriate drive component.
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...
SelectDriveMode(MotorInterface *motor, NavigatorInterface *colli_target, Logger *logger, Configuration *config, colli_escape_mode_t escape_mode=colli_escape_mode_t::basic)
Constructor.
float get_proposed_trans_y()
Returns the proposed translation. After an update.
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.
void set_local_target(float x, float y)
Set local target point before update!
float get_proposed_trans_x()
Returns the proposed translation. After an update.
void set_local_trajec(float x, float y)
Set local trajectory point before update!
void update(bool escape=false)
Has to be called before the proposed values are called.
Fawkes library namespace.
colli_escape_mode_t
Colli Escape modes.
Definition: types.h:67
colli_drive_restriction_t
Colli drive restrictions.
Definition: types.h:76
Cartesian coordinates (2D).
Definition: types.h:65
Storing Translation and rotation.
Definition: types.h:60