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 class Logger;
29 class Configuration;
30 
31 class RoboShape
32 {
33 public:
34  RoboShape(const char *cfg_prefix, fawkes::Logger *logger, fawkes::Configuration *config);
35  ~RoboShape();
36 
37  bool is_round_robot();
38  bool is_angular_robot();
39 
40  ///\brief Check if the reading is 'in' the robot
41  bool is_robot_reading_for_rad(float anglerad, float length);
42 
43  ///\brief Check if the reading is 'in' the robot
44  bool is_robot_reading_for_deg(float angledeg, float length);
45 
46  ///\brief return the length of the robot for a specific angle
47  float get_robot_length_for_rad(float anglerad);
48 
49  ///\brief return the length of the robot for a specific angle
50  float get_robot_length_for_deg(float angledeg);
51 
52  ///\brief Returns the radius of the robot if its round.
53  float get_radius();
54 
55  ///\brief Returns the maximum radius of the robot if its round.
56  float get_complete_radius();
57 
58  ///\brief Returns the width-x of the angular robot.
59  float get_width_x();
60 
61  ///\brief Returns the width-y of the angular robot.
62  float get_width_y();
63 
64  ///\brief Returns the complete x width of the angular robot.
65  float get_complete_width_x();
66 
67  ///\brief Returns the complete x width of the angular robot.
68  float get_complete_width_y();
69 
70  ///\brief Returns the laser offset in x direction of the robot.
71  float get_laser_offset_x();
72 
73  ///\brief Returns the laser offset in y direction of the robot.
74  float get_laser_offset_y();
75 
76  ///\brief Get angle to the front left corner of the robot
77  float get_angle_front_left() const;
78 
79  ///\brief Get angle to the front right corner of the robot
80  float get_angle_front_right() const;
81 
82  ///\brief Get angle to of the rear left corner robot
83  float get_angle_back_left() const;
84 
85  ///\brief Get angle to of the rear right corner robot
86  float get_angle_back_right() const;
87 
88  ///\brief Get angle to middle of the left side of the robot
89  float get_angle_left() const;
90 
91  ///\brief Get angle to middle of the right side of the robot
92  float get_angle_right() const;
93 
94  ///\brief Get angle to middle of the front side of the robot
95  float get_angle_front() const;
96 
97  ///\brief Get angle to middle of the back side of the robot
98  float get_angle_back() const;
99 
100 private:
101  bool is_round_; /**< flag if the robot is round */
102  bool is_angular_; /**< flag if the robot is angular */
103 
104  // several variables containing information about the robot.
105  float radius_, width_x_, width_y_;
106  float laser_offset_x_, laser_offset_y_;
107  float width_add_front_, width_add_back_, width_add_left_, width_add_right_;
108  float robot_to_front_, robot_to_right_, robot_to_back_, robot_to_left_;
109 
110  // angles to the "corners" and mid-sections of the complete roboshape
111  float ang_front_left_, ang_front_right_, ang_back_left_, ang_back_right_;
112  float ang_left_, ang_right_, ang_front_, ang_back_;
113 
114  fawkes::Logger *logger_;
115 };
116 
117 } // namespace fawkes
118 
119 #endif
fawkes::RoboShape::get_angle_left
float get_angle_left() const
Get angle to middle of the left side of the robot.
Definition: roboshape.cpp:217
fawkes::RoboShape::get_complete_width_x
float get_complete_width_x()
Returns the complete x width of the angular robot.
Definition: roboshape.cpp:381
fawkes::RoboShape::get_width_y
float get_width_y()
Returns the width-y of the angular robot.
Definition: roboshape.cpp:367
fawkes::RoboShape::get_laser_offset_x
float get_laser_offset_x()
Returns the laser offset in x direction of the robot.
Definition: roboshape.cpp:409
fawkes::RoboShape::is_robot_reading_for_rad
bool is_robot_reading_for_rad(float anglerad, float length)
Check if the reading is 'in' the robot.
Definition: roboshape.cpp:161
fawkes::RoboShape::get_angle_front_left
float get_angle_front_left() const
Get angle to the front left corner of the robot.
Definition: roboshape.cpp:181
fawkes::RoboShape::RoboShape
RoboShape(const char *cfg_prefix, fawkes::Logger *logger, fawkes::Configuration *config)
Constructor.
Definition: roboshape.cpp:46
fawkes::RoboShape::is_round_robot
bool is_round_robot()
Returns if the robot is round.
Definition: roboshape.cpp:141
fawkes::RoboShape::is_angular_robot
bool is_angular_robot()
Returns if the robot is angular.
Definition: roboshape.cpp:150
fawkes::RoboShape::is_robot_reading_for_deg
bool is_robot_reading_for_deg(float angledeg, float length)
Check if the reading is 'in' the robot.
Definition: roboshape.cpp:172
fawkes::Configuration
Interface for configuration handling.
Definition: config.h:65
fawkes::RoboShape::get_width_x
float get_width_x()
Returns the width-x of the angular robot.
Definition: roboshape.cpp:353
fawkes::RoboShape::get_angle_back_right
float get_angle_back_right() const
Get angle to of the rear right corner robot.
Definition: roboshape.cpp:208
fawkes::RoboShape::get_angle_back
float get_angle_back() const
Get angle to middle of the back side of the robot.
Definition: roboshape.cpp:244
fawkes::RoboShape::get_angle_right
float get_angle_right() const
Get angle to middle of the right side of the robot.
Definition: roboshape.cpp:226
fawkes::Logger
Interface for logging.
Definition: logger.h:42
fawkes::RoboShape::get_complete_radius
float get_complete_radius()
Returns the maximum radius of the robot if its round.
Definition: roboshape.cpp:338
fawkes::RoboShape::get_complete_width_y
float get_complete_width_y()
Returns the complete x width of the angular robot.
Definition: roboshape.cpp:395
fawkes
Fawkes library namespace.
fawkes::RoboShape::get_radius
float get_radius()
Returns the radius of the robot if its round.
Definition: roboshape.cpp:324
fawkes::RoboShape::get_angle_back_left
float get_angle_back_left() const
Get angle to of the rear left corner robot.
Definition: roboshape.cpp:199
fawkes::RoboShape::get_robot_length_for_rad
float get_robot_length_for_rad(float anglerad)
return the length of the robot for a specific angle
Definition: roboshape.cpp:254
fawkes::RoboShape::~RoboShape
~RoboShape()
Desctructor.
Definition: roboshape.cpp:133
fawkes::RoboShape::get_angle_front
float get_angle_front() const
Get angle to middle of the front side of the robot.
Definition: roboshape.cpp:235
fawkes::RoboShape::get_angle_front_right
float get_angle_front_right() const
Get angle to the front right corner of the robot.
Definition: roboshape.cpp:190
fawkes::RoboShape::get_robot_length_for_deg
float get_robot_length_for_deg(float angledeg)
return the length of the robot for a specific angle
Definition: roboshape.cpp:315
fawkes::RoboShape
This is a class containing all roboshape information.
Definition: roboshape.h:32
fawkes::RoboShape::get_laser_offset_y
float get_laser_offset_y()
Returns the laser offset in y direction of the robot.
Definition: roboshape.cpp:418