Fawkes API  Fawkes Development Version
OpenRaveInterface.h
1 
2 /***************************************************************************
3  * OpenRaveInterface.h - Fawkes BlackBoard Interface - OpenRaveInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2011 Bahram Maleki-Fard
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_OPENRAVEINTERFACE_H_
25 #define __INTERFACES_OPENRAVEINTERFACE_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(OpenRaveInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  private:
42  /** Internal data storage, do NOT modify! */
43  typedef struct __attribute__((packed)) {
44  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
45  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
46  uint32_t msgid; /**< The ID of the message that is currently being
47  processed, or 0 if no message is being processed. */
48  bool final; /**< True, if the last goto command has been finished,
49  false if it is still running */
50  uint32_t error_code; /**< Failure code set if
51  final is true. 0 if no error occured, an error code from ERROR_*
52  constants otherwise (or a bit-wise combination). */
53  bool success; /**< True, if last command was successful. False otherwise */
54  } OpenRaveInterface_data_t;
55 
56  OpenRaveInterface_data_t *data;
57 
58  public:
59  /* messages */
60  class StartViewerMessage : public Message
61  {
62  private:
63  /** Internal data storage, do NOT modify! */
64  typedef struct __attribute__((packed)) {
65  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
66  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
67  } StartViewerMessage_data_t;
68 
69  StartViewerMessage_data_t *data;
70 
71  public:
74 
76  /* Methods */
77  virtual Message * clone() const;
78  };
79 
80  class AddObjectMessage : public Message
81  {
82  private:
83  /** Internal data storage, do NOT modify! */
84  typedef struct __attribute__((packed)) {
85  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
86  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
87  char name[30]; /**< Name of object */
88  char path[1024]; /**< Path to object xml file */
89  } AddObjectMessage_data_t;
90 
91  AddObjectMessage_data_t *data;
92 
93  public:
94  AddObjectMessage(const char * ini_name, const char * ini_path);
97 
99  /* Methods */
100  char * name() const;
101  void set_name(const char * new_name);
102  size_t maxlenof_name() const;
103  char * path() const;
104  void set_path(const char * new_path);
105  size_t maxlenof_path() const;
106  virtual Message * clone() const;
107  };
108 
110  {
111  private:
112  /** Internal data storage, do NOT modify! */
113  typedef struct __attribute__((packed)) {
114  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
115  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
116  char name[30]; /**< Name of object */
117  } DeleteObjectMessage_data_t;
118 
119  DeleteObjectMessage_data_t *data;
120 
121  public:
122  DeleteObjectMessage(const char * ini_name);
125 
127  /* Methods */
128  char * name() const;
129  void set_name(const char * new_name);
130  size_t maxlenof_name() const;
131  virtual Message * clone() const;
132  };
133 
135  {
136  private:
137  /** Internal data storage, do NOT modify! */
138  typedef struct __attribute__((packed)) {
139  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
140  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
141  } DeleteAllObjectsMessage_data_t;
142 
143  DeleteAllObjectsMessage_data_t *data;
144 
145  public:
148 
150  /* Methods */
151  virtual Message * clone() const;
152  };
153 
155  {
156  private:
157  /** Internal data storage, do NOT modify! */
158  typedef struct __attribute__((packed)) {
159  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
160  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
161  char name[30]; /**< Name of object */
162  char manip_name[30]; /**< Name of manipulator */
163  } AttachObjectMessage_data_t;
164 
165  AttachObjectMessage_data_t *data;
166 
167  public:
168  AttachObjectMessage(const char * ini_name, const char * ini_manip_name);
171 
173  /* Methods */
174  char * name() const;
175  void set_name(const char * new_name);
176  size_t maxlenof_name() const;
177  char * manip_name() const;
178  void set_manip_name(const char * new_manip_name);
179  size_t maxlenof_manip_name() const;
180  virtual Message * clone() const;
181  };
182 
184  {
185  private:
186  /** Internal data storage, do NOT modify! */
187  typedef struct __attribute__((packed)) {
188  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
189  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
190  char name[30]; /**< Name of object */
191  } ReleaseObjectMessage_data_t;
192 
193  ReleaseObjectMessage_data_t *data;
194 
195  public:
196  ReleaseObjectMessage(const char * ini_name);
199 
201  /* Methods */
202  char * name() const;
203  void set_name(const char * new_name);
204  size_t maxlenof_name() const;
205  virtual Message * clone() const;
206  };
207 
209  {
210  private:
211  /** Internal data storage, do NOT modify! */
212  typedef struct __attribute__((packed)) {
213  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
214  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
215  } ReleaseAllObjectsMessage_data_t;
216 
217  ReleaseAllObjectsMessage_data_t *data;
218 
219  public:
222 
224  /* Methods */
225  virtual Message * clone() const;
226  };
227 
228  class MoveObjectMessage : public Message
229  {
230  private:
231  /** Internal data storage, do NOT modify! */
232  typedef struct __attribute__((packed)) {
233  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
234  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
235  char name[30]; /**< Name of object */
236  float x; /**< x position of object (meters) */
237  float y; /**< y position of object (meters) */
238  float z; /**< z position of object (meters) */
239  } MoveObjectMessage_data_t;
240 
241  MoveObjectMessage_data_t *data;
242 
243  public:
244  MoveObjectMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z);
247 
249  /* Methods */
250  char * name() const;
251  void set_name(const char * new_name);
252  size_t maxlenof_name() const;
253  float x() const;
254  void set_x(const float new_x);
255  size_t maxlenof_x() const;
256  float y() const;
257  void set_y(const float new_y);
258  size_t maxlenof_y() const;
259  float z() const;
260  void set_z(const float new_z);
261  size_t maxlenof_z() const;
262  virtual Message * clone() const;
263  };
264 
266  {
267  private:
268  /** Internal data storage, do NOT modify! */
269  typedef struct __attribute__((packed)) {
270  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
271  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
272  char name[30]; /**< Name of object */
273  float x; /**< x value of quaternion */
274  float y; /**< y value of quaternion */
275  float z; /**< z value of quaternion */
276  float w; /**< w value of quaternion */
277  } RotateObjectQuatMessage_data_t;
278 
279  RotateObjectQuatMessage_data_t *data;
280 
281  public:
282  RotateObjectQuatMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z, const float ini_w);
285 
287  /* Methods */
288  char * name() const;
289  void set_name(const char * new_name);
290  size_t maxlenof_name() const;
291  float x() const;
292  void set_x(const float new_x);
293  size_t maxlenof_x() const;
294  float y() const;
295  void set_y(const float new_y);
296  size_t maxlenof_y() const;
297  float z() const;
298  void set_z(const float new_z);
299  size_t maxlenof_z() const;
300  float w() const;
301  void set_w(const float new_w);
302  size_t maxlenof_w() const;
303  virtual Message * clone() const;
304  };
305 
307  {
308  private:
309  /** Internal data storage, do NOT modify! */
310  typedef struct __attribute__((packed)) {
311  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
312  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
313  char name[30]; /**< Name of object */
314  float x; /**< x-axis rotation of object (rad) */
315  float y; /**< y-axis rotation of object (rad) */
316  float z; /**< z-axis rotation of object (rad) */
317  } RotateObjectMessage_data_t;
318 
319  RotateObjectMessage_data_t *data;
320 
321  public:
322  RotateObjectMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z);
325 
327  /* Methods */
328  char * name() const;
329  void set_name(const char * new_name);
330  size_t maxlenof_name() const;
331  float x() const;
332  void set_x(const float new_x);
333  size_t maxlenof_x() const;
334  float y() const;
335  void set_y(const float new_y);
336  size_t maxlenof_y() const;
337  float z() const;
338  void set_z(const float new_z);
339  size_t maxlenof_z() const;
340  virtual Message * clone() const;
341  };
342 
344  {
345  private:
346  /** Internal data storage, do NOT modify! */
347  typedef struct __attribute__((packed)) {
348  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
349  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
350  char name[30]; /**< Name of object */
351  char newName[30]; /**< New name of object */
352  } RenameObjectMessage_data_t;
353 
354  RenameObjectMessage_data_t *data;
355 
356  public:
357  RenameObjectMessage(const char * ini_name, const char * ini_newName);
360 
362  /* Methods */
363  char * name() const;
364  void set_name(const char * new_name);
365  size_t maxlenof_name() const;
366  char * newName() const;
367  void set_newName(const char * new_newName);
368  size_t maxlenof_newName() const;
369  virtual Message * clone() const;
370  };
371 
372  virtual bool message_valid(const Message *message) const;
373  private:
376 
377  public:
378  /* Methods */
379  uint32_t msgid() const;
380  void set_msgid(const uint32_t new_msgid);
381  size_t maxlenof_msgid() const;
382  bool is_final() const;
383  void set_final(const bool new_final);
384  size_t maxlenof_final() const;
385  uint32_t error_code() const;
386  void set_error_code(const uint32_t new_error_code);
387  size_t maxlenof_error_code() const;
388  bool is_success() const;
389  void set_success(const bool new_success);
390  size_t maxlenof_success() const;
391  virtual Message * create_message(const char *type) const;
392 
393  virtual void copy_values(const Interface *other);
394  virtual const char * enum_tostring(const char *enumtype, int val) const;
395 
396 };
397 
398 } // end namespace fawkes
399 
400 #endif
RotateObjectQuatMessage Fawkes BlackBoard Interface Message.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
uint32_t error_code() const
Get error_code value.
void set_error_code(const uint32_t new_error_code)
Set error_code value.
bool is_final() const
Get final value.
void set_success(const bool new_success)
Set success value.
ReleaseAllObjectsMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_msgid() const
Get maximum length of msgid value.
Fawkes library namespace.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_final(const bool new_final)
Set final value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
RotateObjectMessage Fawkes BlackBoard Interface Message.
StartViewerMessage Fawkes BlackBoard Interface Message.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
void set_msgid(const uint32_t new_msgid)
Set msgid value.
AttachObjectMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_final() const
Get maximum length of final value.
DeleteAllObjectsMessage Fawkes BlackBoard Interface Message.
virtual Message * create_message(const char *type) const
Create message based on type name.
ReleaseObjectMessage Fawkes BlackBoard Interface Message.
RenameObjectMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_success() const
Get maximum length of success value.
size_t maxlenof_error_code() const
Get maximum length of error_code value.
DeleteObjectMessage Fawkes BlackBoard Interface Message.
MoveObjectMessage Fawkes BlackBoard Interface Message.
uint32_t msgid() const
Get msgid value.
bool is_success() const
Get success value.
OpenRaveInterface Fawkes BlackBoard Interface.
AddObjectMessage Fawkes BlackBoard Interface Message.