Fawkes API  Fawkes Development Version
roboshape.h
1 
2 /***************************************************************************
3  * roboshape.h - Class containing shape information of robot
4  *
5  * Created: Fri Oct 18 15:16:23 2013
6  * Copyright 2002 Stefan Jacobs
7  * 2013-2014 Bahram Maleki-Fard
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_COLLI_UTILS_ROB_ROBOSHAPE_H_
24 #define __PLUGINS_COLLI_UTILS_ROB_ROBOSHAPE_H_
25 
26 namespace fawkes
27 {
28 #if 0 /* just to make Emacs auto-indent happy */
29 }
30 #endif
31 
32 class Logger;
33 class Configuration;
34 
35 class RoboShape
36 {
37  public:
38  RoboShape( const char * cfg_prefix,
39  fawkes::Logger* logger,
40  fawkes::Configuration* config);
41  ~RoboShape();
42 
43  bool is_round_robot( );
44  bool is_angular_robot( );
45 
46  ///\brief Check if the reading is 'in' the robot
47  bool is_robot_reading_for_rad( float anglerad, float length );
48 
49  ///\brief Check if the reading is 'in' the robot
50  bool is_robot_reading_for_deg( float angledeg, float length );
51 
52  ///\brief return the length of the robot for a specific angle
53  float get_robot_length_for_rad( float anglerad );
54 
55  ///\brief return the length of the robot for a specific angle
56  float get_robot_length_for_deg( float angledeg );
57 
58  ///\brief Returns the radius of the robot if its round.
59  float get_radius();
60 
61  ///\brief Returns the maximum radius of the robot if its round.
62  float get_complete_radius();
63 
64  ///\brief Returns the width-x of the angular robot.
65  float get_width_x();
66 
67  ///\brief Returns the width-y of the angular robot.
68  float get_width_y();
69 
70  ///\brief Returns the complete x width of the angular robot.
71  float get_complete_width_x();
72 
73  ///\brief Returns the complete x width of the angular robot.
74  float get_complete_width_y();
75 
76  ///\brief Returns the laser offset in x direction of the robot.
77  float get_laser_offset_x();
78 
79  ///\brief Returns the laser offset in y direction of the robot.
80  float get_laser_offset_y();
81 
82  ///\brief Get angle to the front left corner of the robot
83  float get_angle_front_left() const;
84 
85  ///\brief Get angle to the front right corner of the robot
86  float get_angle_front_right() const;
87 
88  ///\brief Get angle to of the rear left corner robot
89  float get_angle_back_left() const;
90 
91  ///\brief Get angle to of the rear right corner robot
92  float get_angle_back_right() const;
93 
94  ///\brief Get angle to middle of the left side of the robot
95  float get_angle_left() const;
96 
97  ///\brief Get angle to middle of the right side of the robot
98  float get_angle_right() const;
99 
100  ///\brief Get angle to middle of the front side of the robot
101  float get_angle_front() const;
102 
103  ///\brief Get angle to middle of the back side of the robot
104  float get_angle_back() const;
105 
106 
107 private:
108 
109  bool is_round_; /**< flag if the robot is round */
110  bool is_angular_; /**< flag if the robot is angular */
111 
112  // several variables containing information about the robot.
113  float radius_, width_x_, width_y_;
114  float laser_offset_x_, laser_offset_y_;
115  float width_add_front_, width_add_back_, width_add_left_, width_add_right_;
116  float robot_to_front_, robot_to_right_, robot_to_back_, robot_to_left_;
117 
118  // angles to the "corners" and mid-sections of the complete roboshape
119  float ang_front_left_, ang_front_right_, ang_back_left_, ang_back_right_;
120  float ang_left_, ang_right_, ang_front_, ang_back_;
121 
122  fawkes::Logger* logger_;
123 };
124 
125 } // namespace fawkes
126 
127 #endif
float get_radius()
Returns the radius of the robot if its round.
Definition: roboshape.cpp:342
float get_robot_length_for_deg(float angledeg)
return the length of the robot for a specific angle
Definition: roboshape.cpp:333
float get_robot_length_for_rad(float anglerad)
return the length of the robot for a specific angle
Definition: roboshape.cpp:274
float get_width_x()
Returns the width-x of the angular robot.
Definition: roboshape.cpp:370
Fawkes library namespace.
float get_complete_width_y()
Returns the complete x width of the angular robot.
Definition: roboshape.cpp:413
float get_angle_right() const
Get angle to middle of the right side of the robot.
Definition: roboshape.cpp:246
bool is_robot_reading_for_rad(float anglerad, float length)
Check if the reading is &#39;in&#39; the robot.
Definition: roboshape.cpp:181
float get_laser_offset_y()
Returns the laser offset in y direction of the robot.
Definition: roboshape.cpp:436
float get_angle_front() const
Get angle to middle of the front side of the robot.
Definition: roboshape.cpp:255
float get_angle_left() const
Get angle to middle of the left side of the robot.
Definition: roboshape.cpp:237
float get_complete_width_x()
Returns the complete x width of the angular robot.
Definition: roboshape.cpp:398
RoboShape(const char *cfg_prefix, fawkes::Logger *logger, fawkes::Configuration *config)
Constructor.
Definition: roboshape.cpp:49
float get_angle_front_right() const
Get angle to the front right corner of the robot.
Definition: roboshape.cpp:210
float get_width_y()
Returns the width-y of the angular robot.
Definition: roboshape.cpp:384
~RoboShape()
Desctructor.
Definition: roboshape.cpp:153
float get_laser_offset_x()
Returns the laser offset in x direction of the robot.
Definition: roboshape.cpp:427
float get_angle_back() const
Get angle to middle of the back side of the robot.
Definition: roboshape.cpp:264
float get_angle_front_left() const
Get angle to the front left corner of the robot.
Definition: roboshape.cpp:201
This is a class containing all roboshape information.
Definition: roboshape.h:35
float get_complete_radius()
Returns the maximum radius of the robot if its round.
Definition: roboshape.cpp:356
bool is_round_robot()
Returns if the robot is round.
Definition: roboshape.cpp:161
bool is_angular_robot()
Returns if the robot is angular.
Definition: roboshape.cpp:170
bool is_robot_reading_for_deg(float angledeg, float length)
Check if the reading is &#39;in&#39; the robot.
Definition: roboshape.cpp:192
Interface for configuration handling.
Definition: config.h:67
float get_angle_back_left() const
Get angle to of the rear left corner robot.
Definition: roboshape.cpp:219
float get_angle_back_right() const
Get angle to of the rear right corner robot.
Definition: roboshape.cpp:228
Interface for logging.
Definition: logger.h:34