Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
NavigatorInterface.h
1 
2 /***************************************************************************
3  * NavigatorInterface.h - Fawkes BlackBoard Interface - NavigatorInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2007-2009 Martin Liebenberg, Daniel Beck, Tim Niemueller
7  *
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. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
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_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACES_NAVIGATORINTERFACE_H_
25 #define __INTERFACES_NAVIGATORINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(NavigatorInterface)
37  /// @endcond
38  public:
39  /* constants */
40  static const uint32_t ERROR_NONE;
41  static const uint32_t ERROR_MOTOR;
42  static const uint32_t ERROR_OBSTRUCTION;
43  static const uint32_t ERROR_UNKNOWN_PLACE;
44  static const uint32_t FLAG_NONE;
45  static const uint32_t FLAG_CART_GOTO;
46  static const uint32_t FLAG_POLAR_GOTO;
47  static const uint32_t FLAG_PLACE_GOTO;
48  static const uint32_t FLAG_UPDATES_DEST_DIST;
49  static const uint32_t FLAG_SECURITY_DISTANCE;
50  static const uint32_t FLAG_ESCAPING;
51 
52  private:
53 #pragma pack(push,4)
54  /** Internal data storage, do NOT modify! */
55  typedef struct {
56  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
57  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
58  uint32_t flags; /**< Bit-wise combination of
59  FLAG_* constants denoting navigator component features. */
60  float x; /**< Current X-coordinate in the navigator coordinate system. */
61  float y; /**< Current Y-coordinate in the navigator coordinate system. */
62  float dest_x; /**< X-coordinate of the current destination, or 0.0 if no target has been set. */
63  float dest_y; /**< Y-coordinate of the current destination, or 0.0 if no target has been set. */
64  float dest_ori; /**< Orientation of the current destination, or 0.0 if no target has been set. */
65  float dest_dist; /**< Distance to destination in m. */
66  uint32_t msgid; /**< The ID of the message that is currently being
67  processed, or 0 if no message is being processed. */
68  bool final; /**< True, if the last goto command has been finished,
69  false if it is still running */
70  uint32_t error_code; /**< Failure code set if
71  final is true. 0 if no error occured, an error code from ERROR_*
72  constants otherwise (or a bit-wise combination). */
73  float max_velocity; /**< Maximum velocity */
74  float security_distance; /**< Security distance to
75  keep to obstacles */
76  bool escaping_enabled; /**< This is used for
77  navigation components with integrated collision avoidance, to
78  check whether the navigator should stop when an obstacle
79  obstructs the path, or if it should escape. */
80  } NavigatorInterface_data_t;
81 #pragma pack(pop)
82 
83  NavigatorInterface_data_t *data;
84 
85  public:
86  /* messages */
87  class StopMessage : public Message
88  {
89  private:
90 #pragma pack(push,4)
91  /** Internal data storage, do NOT modify! */
92  typedef struct {
93  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
94  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
95  } StopMessage_data_t;
96 #pragma pack(pop)
97 
98  StopMessage_data_t *data;
99 
100  public:
101  StopMessage();
102  ~StopMessage();
103 
104  StopMessage(const StopMessage *m);
105  /* Methods */
106  virtual Message * clone() const;
107  };
108 
109  class TurnMessage : public Message
110  {
111  private:
112 #pragma pack(push,4)
113  /** Internal data storage, do NOT modify! */
114  typedef struct {
115  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
116  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
117  float angle; /**< Angle of the turn. */
118  float velocity; /**< The desired turning velocity in rad/s,
119  set to zero to use default value. */
120  } TurnMessage_data_t;
121 #pragma pack(pop)
122 
123  TurnMessage_data_t *data;
124 
125  public:
126  TurnMessage(const float ini_angle, const float ini_velocity);
127  TurnMessage();
128  ~TurnMessage();
129 
130  TurnMessage(const TurnMessage *m);
131  /* Methods */
132  float angle() const;
133  void set_angle(const float new_angle);
134  size_t maxlenof_angle() const;
135  float velocity() const;
136  void set_velocity(const float new_velocity);
137  size_t maxlenof_velocity() const;
138  virtual Message * clone() const;
139  };
140 
142  {
143  private:
144 #pragma pack(push,4)
145  /** Internal data storage, do NOT modify! */
146  typedef struct {
147  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
148  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
149  float x; /**< X-coordinate of the target, in the robot's coordinate system. */
150  float y; /**< Y-coordinate of the target, in the robot's coordinate system. */
151  float orientation; /**< The orientation of the robot at the target. */
152  } CartesianGotoMessage_data_t;
153 #pragma pack(pop)
154 
155  CartesianGotoMessage_data_t *data;
156 
157  public:
158  CartesianGotoMessage(const float ini_x, const float ini_y, const float ini_orientation);
161 
163  /* Methods */
164  float x() const;
165  void set_x(const float new_x);
166  size_t maxlenof_x() const;
167  float y() const;
168  void set_y(const float new_y);
169  size_t maxlenof_y() const;
170  float orientation() const;
171  void set_orientation(const float new_orientation);
172  size_t maxlenof_orientation() const;
173  virtual Message * clone() const;
174  };
175 
176  class PolarGotoMessage : public Message
177  {
178  private:
179 #pragma pack(push,4)
180  /** Internal data storage, do NOT modify! */
181  typedef struct {
182  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
183  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
184  float phi; /**< Angle between the robot's front and the target. */
185  float dist; /**< Distance to the target. */
186  float orientation; /**< The orientation of the robot at the target. */
187  } PolarGotoMessage_data_t;
188 #pragma pack(pop)
189 
190  PolarGotoMessage_data_t *data;
191 
192  public:
193  PolarGotoMessage(const float ini_phi, const float ini_dist, const float ini_orientation);
196 
198  /* Methods */
199  float phi() const;
200  void set_phi(const float new_phi);
201  size_t maxlenof_phi() const;
202  float dist() const;
203  void set_dist(const float new_dist);
204  size_t maxlenof_dist() const;
205  float orientation() const;
206  void set_orientation(const float new_orientation);
207  size_t maxlenof_orientation() const;
208  virtual Message * clone() const;
209  };
210 
211  class PlaceGotoMessage : public Message
212  {
213  private:
214 #pragma pack(push,4)
215  /** Internal data storage, do NOT modify! */
216  typedef struct {
217  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
218  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
219  char place[64]; /**< Place to go to. */
220  } PlaceGotoMessage_data_t;
221 #pragma pack(pop)
222 
223  PlaceGotoMessage_data_t *data;
224 
225  public:
226  PlaceGotoMessage(const char * ini_place);
229 
231  /* Methods */
232  char * place() const;
233  void set_place(const char * new_place);
234  size_t maxlenof_place() const;
235  virtual Message * clone() const;
236  };
237 
238  class ObstacleMessage : public Message
239  {
240  private:
241 #pragma pack(push,4)
242  /** Internal data storage, do NOT modify! */
243  typedef struct {
244  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
245  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
246  float x; /**< X-coordinate of the obstacle. */
247  float y; /**< Y-coordinate of the obstacle. */
248  float width; /**< Width of the obstacle. */
249  } ObstacleMessage_data_t;
250 #pragma pack(pop)
251 
252  ObstacleMessage_data_t *data;
253 
254  public:
255  ObstacleMessage(const float ini_x, const float ini_y, const float ini_width);
256  ObstacleMessage();
258 
260  /* Methods */
261  float x() const;
262  void set_x(const float new_x);
263  size_t maxlenof_x() const;
264  float y() const;
265  void set_y(const float new_y);
266  size_t maxlenof_y() const;
267  float width() const;
268  void set_width(const float new_width);
269  size_t maxlenof_width() const;
270  virtual Message * clone() const;
271  };
272 
274  {
275  private:
276 #pragma pack(push,4)
277  /** Internal data storage, do NOT modify! */
278  typedef struct {
279  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
280  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
281  } ResetOdometryMessage_data_t;
282 #pragma pack(pop)
283 
284  ResetOdometryMessage_data_t *data;
285 
286  public:
289 
291  /* Methods */
292  virtual Message * clone() const;
293  };
294 
296  {
297  private:
298 #pragma pack(push,4)
299  /** Internal data storage, do NOT modify! */
300  typedef struct {
301  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
302  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
303  float max_velocity; /**< Maximum velocity */
304  } SetMaxVelocityMessage_data_t;
305 #pragma pack(pop)
306 
307  SetMaxVelocityMessage_data_t *data;
308 
309  public:
310  SetMaxVelocityMessage(const float ini_max_velocity);
313 
315  /* Methods */
316  float max_velocity() const;
317  void set_max_velocity(const float new_max_velocity);
318  size_t maxlenof_max_velocity() const;
319  virtual Message * clone() const;
320  };
321 
323  {
324  private:
325 #pragma pack(push,4)
326  /** Internal data storage, do NOT modify! */
327  typedef struct {
328  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
329  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
330  bool escaping_enabled; /**< This is used for
331  navigation components with integrated collision avoidance, to
332  check whether the navigator should stop when an obstacle
333  obstructs the path, or if it should escape. */
334  } SetEscapingMessage_data_t;
335 #pragma pack(pop)
336 
337  SetEscapingMessage_data_t *data;
338 
339  public:
340  SetEscapingMessage(const bool ini_escaping_enabled);
343 
345  /* Methods */
346  bool is_escaping_enabled() const;
347  void set_escaping_enabled(const bool new_escaping_enabled);
348  size_t maxlenof_escaping_enabled() const;
349  virtual Message * clone() const;
350  };
351 
353  {
354  private:
355 #pragma pack(push,4)
356  /** Internal data storage, do NOT modify! */
357  typedef struct {
358  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
359  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
360  float security_distance; /**< Security distance to
361  keep to obstacles */
362  } SetSecurityDistanceMessage_data_t;
363 #pragma pack(pop)
364 
365  SetSecurityDistanceMessage_data_t *data;
366 
367  public:
368  SetSecurityDistanceMessage(const float ini_security_distance);
371 
373  /* Methods */
374  float security_distance() const;
375  void set_security_distance(const float new_security_distance);
376  size_t maxlenof_security_distance() const;
377  virtual Message * clone() const;
378  };
379 
380  virtual bool message_valid(const Message *message) const;
381  private:
384 
385  public:
386  /* Methods */
387  uint32_t flags() const;
388  void set_flags(const uint32_t new_flags);
389  size_t maxlenof_flags() const;
390  float x() const;
391  void set_x(const float new_x);
392  size_t maxlenof_x() const;
393  float y() const;
394  void set_y(const float new_y);
395  size_t maxlenof_y() const;
396  float dest_x() const;
397  void set_dest_x(const float new_dest_x);
398  size_t maxlenof_dest_x() const;
399  float dest_y() const;
400  void set_dest_y(const float new_dest_y);
401  size_t maxlenof_dest_y() const;
402  float dest_ori() const;
403  void set_dest_ori(const float new_dest_ori);
404  size_t maxlenof_dest_ori() const;
405  float dest_dist() const;
406  void set_dest_dist(const float new_dest_dist);
407  size_t maxlenof_dest_dist() const;
408  uint32_t msgid() const;
409  void set_msgid(const uint32_t new_msgid);
410  size_t maxlenof_msgid() const;
411  bool is_final() const;
412  void set_final(const bool new_final);
413  size_t maxlenof_final() const;
414  uint32_t error_code() const;
415  void set_error_code(const uint32_t new_error_code);
416  size_t maxlenof_error_code() const;
417  float max_velocity() const;
418  void set_max_velocity(const float new_max_velocity);
419  size_t maxlenof_max_velocity() const;
420  float security_distance() const;
421  void set_security_distance(const float new_security_distance);
422  size_t maxlenof_security_distance() const;
423  bool is_escaping_enabled() const;
424  void set_escaping_enabled(const bool new_escaping_enabled);
425  size_t maxlenof_escaping_enabled() const;
426  virtual Message * create_message(const char *type) const;
427 
428  virtual void copy_values(const Interface *other);
429  virtual const char * enum_tostring(const char *enumtype, int val) const;
430 
431 };
432 
433 } // end namespace fawkes
434 
435 #endif
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_security_distance() const
Get maximum length of security_distance value.
size_t maxlenof_escaping_enabled() const
Get maximum length of escaping_enabled value.
size_t maxlenof_width() const
Get maximum length of width value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:43
float max_velocity() const
Get max_velocity value.
size_t maxlenof_security_distance() const
Get maximum length of security_distance value.
void set_dist(const float new_dist)
Set dist value.
virtual Message * clone() const
Clone this message.
void set_angle(const float new_angle)
Set angle value.
void set_escaping_enabled(const bool new_escaping_enabled)
Set escaping_enabled value.
virtual Message * clone() const
Clone this message.
float y() const
Get y value.
uint32_t flags() const
Get flags value.
size_t maxlenof_dest_ori() const
Get maximum length of dest_ori value.
void set_max_velocity(const float new_max_velocity)
Set max_velocity value.
ObstacleMessage Fawkes BlackBoard Interface Message.
void set_final(const bool new_final)
Set final value.
float dest_y() const
Get dest_y value.
static const uint32_t ERROR_MOTOR
ERROR_MOTOR constant.
float security_distance() const
Get security_distance value.
SetSecurityDistanceMessage Fawkes BlackBoard Interface Message.
void set_place(const char *new_place)
Set place value.
static const uint32_t FLAG_CART_GOTO
FLAG_CART_GOTO constant.
void set_escaping_enabled(const bool new_escaping_enabled)
Set escaping_enabled value.
size_t maxlenof_dest_dist() const
Get maximum length of dest_dist value.
uint32_t msgid() const
Get msgid value.
bool is_final() const
Get final value.
uint32_t error_code() const
Get error_code value.
size_t maxlenof_y() const
Get maximum length of y value.
PolarGotoMessage Fawkes BlackBoard Interface Message.
static const uint32_t ERROR_UNKNOWN_PLACE
ERROR_UNKNOWN_PLACE constant.
size_t maxlenof_error_code() const
Get maximum length of error_code value.
float orientation() const
Get orientation value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
float dest_ori() const
Get dest_ori value.
size_t maxlenof_max_velocity() const
Get maximum length of max_velocity value.
void set_phi(const float new_phi)
Set phi value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_phi() const
Get maximum length of phi value.
size_t maxlenof_max_velocity() const
Get maximum length of max_velocity value.
static const uint32_t FLAG_POLAR_GOTO
FLAG_POLAR_GOTO constant.
void set_security_distance(const float new_security_distance)
Set security_distance value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
SetEscapingMessage Fawkes BlackBoard Interface Message.
virtual Message * create_message(const char *type) const
Create message based on type name.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
float dest_x() const
Get dest_x value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_orientation() const
Get maximum length of orientation value.
void set_orientation(const float new_orientation)
Set orientation value.
size_t maxlenof_orientation() const
Get maximum length of orientation value.
bool is_escaping_enabled() const
Get escaping_enabled value.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_dest_y() const
Get maximum length of dest_y value.
size_t maxlenof_velocity() const
Get maximum length of velocity value.
PlaceGotoMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_place() const
Get maximum length of place value.
size_t maxlenof_dist() const
Get maximum length of dist value.
float velocity() const
Get velocity value.
size_t maxlenof_angle() const
Get maximum length of angle value.
size_t maxlenof_flags() const
Get maximum length of flags value.
CartesianGotoMessage Fawkes BlackBoard Interface Message.
void set_flags(const uint32_t new_flags)
Set flags value.
virtual Message * clone() const
Clone this message.
virtual Message * clone() const
Clone this message.
virtual Message * clone() const
Clone this message.
bool is_escaping_enabled() const
Get escaping_enabled value.
float security_distance() const
Get security_distance value.
virtual Message * clone() const
Clone this message.
void set_y(const float new_y)
Set y value.
void set_max_velocity(const float new_max_velocity)
Set max_velocity value.
void set_y(const float new_y)
Set y value.
void set_width(const float new_width)
Set width value.
float max_velocity() const
Get max_velocity value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
size_t maxlenof_final() const
Get maximum length of final value.
void set_error_code(const uint32_t new_error_code)
Set error_code value.
virtual Message * clone() const
Clone this message.
static const uint32_t FLAG_ESCAPING
FLAG_ESCAPING constant.
static const uint32_t ERROR_OBSTRUCTION
ERROR_OBSTRUCTION constant.
size_t maxlenof_escaping_enabled() const
Get maximum length of escaping_enabled value.
float x() const
Get x value.
void set_dest_ori(const float new_dest_ori)
Set dest_ori value.
void set_y(const float new_y)
Set y value.
TurnMessage Fawkes BlackBoard Interface Message.
void set_velocity(const float new_velocity)
Set velocity value.
static const uint32_t FLAG_SECURITY_DISTANCE
FLAG_SECURITY_DISTANCE constant.
void set_security_distance(const float new_security_distance)
Set security_distance value.
void set_dest_dist(const float new_dest_dist)
Set dest_dist value.
void set_orientation(const float new_orientation)
Set orientation value.
void set_dest_x(const float new_dest_x)
Set dest_x value.
void set_x(const float new_x)
Set x value.
static const uint32_t ERROR_NONE
ERROR_NONE constant.
static const uint32_t FLAG_UPDATES_DEST_DIST
FLAG_UPDATES_DEST_DIST constant.
virtual Message * clone() const
Clone this message.
void set_x(const float new_x)
Set x value.
void set_dest_y(const float new_dest_y)
Set dest_y value.
static const uint32_t FLAG_NONE
FLAG_NONE constant.
void set_msgid(const uint32_t new_msgid)
Set msgid value.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_x() const
Get maximum length of x value.
const char * type() const
Get type of interface.
Definition: interface.cpp:635
float orientation() const
Get orientation value.
float dest_dist() const
Get dest_dist value.
void set_x(const float new_x)
Set x value.
float angle() const
Get angle value.
size_t maxlenof_msgid() const
Get maximum length of msgid value.
SetMaxVelocityMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_dest_x() const
Get maximum length of dest_x value.
ResetOdometryMessage Fawkes BlackBoard Interface Message.
static const uint32_t FLAG_PLACE_GOTO
FLAG_PLACE_GOTO constant.
StopMessage Fawkes BlackBoard Interface Message.
NavigatorInterface Fawkes BlackBoard Interface.