Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 #pragma pack(push,4)
43  /** Internal data storage, do NOT modify! */
44  typedef struct {
45  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
46  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
47  uint32_t msgid; /**< The ID of the message that is currently being
48  processed, or 0 if no message is being processed. */
49  bool final; /**< True, if the last goto command has been finished,
50  false if it is still running */
51  uint32_t error_code; /**< Failure code set if
52  final is true. 0 if no error occured, an error code from ERROR_*
53  constants otherwise (or a bit-wise combination). */
54  bool success; /**< True, if last command was successful. False otherwise */
55  } OpenRaveInterface_data_t;
56 #pragma pack(pop)
57 
58  OpenRaveInterface_data_t *data;
59 
60  public:
61  /* messages */
62  class AddObjectMessage : public Message
63  {
64  private:
65 #pragma pack(push,4)
66  /** Internal data storage, do NOT modify! */
67  typedef struct {
68  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
69  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
70  char name[30]; /**< Name of object */
71  char path[1024]; /**< Path to object xml file */
72  } AddObjectMessage_data_t;
73 #pragma pack(pop)
74 
75  AddObjectMessage_data_t *data;
76 
77  public:
78  AddObjectMessage(const char * ini_name, const char * ini_path);
81 
83  /* Methods */
84  char * name() const;
85  void set_name(const char * new_name);
86  size_t maxlenof_name() const;
87  char * path() const;
88  void set_path(const char * new_path);
89  size_t maxlenof_path() const;
90  virtual Message * clone() const;
91  };
92 
94  {
95  private:
96 #pragma pack(push,4)
97  /** Internal data storage, do NOT modify! */
98  typedef struct {
99  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
100  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
101  char name[30]; /**< Name of object */
102  } DeleteObjectMessage_data_t;
103 #pragma pack(pop)
104 
105  DeleteObjectMessage_data_t *data;
106 
107  public:
108  DeleteObjectMessage(const char * ini_name);
111 
113  /* Methods */
114  char * name() const;
115  void set_name(const char * new_name);
116  size_t maxlenof_name() const;
117  virtual Message * clone() const;
118  };
119 
121  {
122  private:
123 #pragma pack(push,4)
124  /** Internal data storage, do NOT modify! */
125  typedef struct {
126  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
127  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
128  char name[30]; /**< Name of object */
129  } AttachObjectMessage_data_t;
130 #pragma pack(pop)
131 
132  AttachObjectMessage_data_t *data;
133 
134  public:
135  AttachObjectMessage(const char * ini_name);
138 
140  /* Methods */
141  char * name() const;
142  void set_name(const char * new_name);
143  size_t maxlenof_name() const;
144  virtual Message * clone() const;
145  };
146 
148  {
149  private:
150 #pragma pack(push,4)
151  /** Internal data storage, do NOT modify! */
152  typedef struct {
153  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
154  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
155  char name[30]; /**< Name of object */
156  } ReleaseObjectMessage_data_t;
157 #pragma pack(pop)
158 
159  ReleaseObjectMessage_data_t *data;
160 
161  public:
162  ReleaseObjectMessage(const char * ini_name);
165 
167  /* Methods */
168  char * name() const;
169  void set_name(const char * new_name);
170  size_t maxlenof_name() const;
171  virtual Message * clone() const;
172  };
173 
175  {
176  private:
177 #pragma pack(push,4)
178  /** Internal data storage, do NOT modify! */
179  typedef struct {
180  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
181  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
182  } ReleaseAllObjectsMessage_data_t;
183 #pragma pack(pop)
184 
185  ReleaseAllObjectsMessage_data_t *data;
186 
187  public:
190 
192  /* Methods */
193  virtual Message * clone() const;
194  };
195 
196  class MoveObjectMessage : public Message
197  {
198  private:
199 #pragma pack(push,4)
200  /** Internal data storage, do NOT modify! */
201  typedef struct {
202  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
203  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
204  char name[30]; /**< Name of object */
205  float x; /**< x position of object (meters) */
206  float y; /**< y position of object (meters) */
207  float z; /**< z position of object (meters) */
208  } MoveObjectMessage_data_t;
209 #pragma pack(pop)
210 
211  MoveObjectMessage_data_t *data;
212 
213  public:
214  MoveObjectMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z);
217 
219  /* Methods */
220  char * name() const;
221  void set_name(const char * new_name);
222  size_t maxlenof_name() const;
223  float x() const;
224  void set_x(const float new_x);
225  size_t maxlenof_x() const;
226  float y() const;
227  void set_y(const float new_y);
228  size_t maxlenof_y() const;
229  float z() const;
230  void set_z(const float new_z);
231  size_t maxlenof_z() const;
232  virtual Message * clone() const;
233  };
234 
236  {
237  private:
238 #pragma pack(push,4)
239  /** Internal data storage, do NOT modify! */
240  typedef struct {
241  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
242  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
243  char name[30]; /**< Name of object */
244  float x; /**< x value of quaternion */
245  float y; /**< y value of quaternion */
246  float z; /**< z value of quaternion */
247  float w; /**< w value of quaternion */
248  } RotateObjectQuatMessage_data_t;
249 #pragma pack(pop)
250 
251  RotateObjectQuatMessage_data_t *data;
252 
253  public:
254  RotateObjectQuatMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z, const float ini_w);
257 
259  /* Methods */
260  char * name() const;
261  void set_name(const char * new_name);
262  size_t maxlenof_name() const;
263  float x() const;
264  void set_x(const float new_x);
265  size_t maxlenof_x() const;
266  float y() const;
267  void set_y(const float new_y);
268  size_t maxlenof_y() const;
269  float z() const;
270  void set_z(const float new_z);
271  size_t maxlenof_z() const;
272  float w() const;
273  void set_w(const float new_w);
274  size_t maxlenof_w() const;
275  virtual Message * clone() const;
276  };
277 
279  {
280  private:
281 #pragma pack(push,4)
282  /** Internal data storage, do NOT modify! */
283  typedef struct {
284  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
285  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
286  char name[30]; /**< Name of object */
287  float x; /**< x-axis rotation of object (rad) */
288  float y; /**< y-axis rotation of object (rad) */
289  float z; /**< z-axis rotation of object (rad) */
290  } RotateObjectMessage_data_t;
291 #pragma pack(pop)
292 
293  RotateObjectMessage_data_t *data;
294 
295  public:
296  RotateObjectMessage(const char * ini_name, const float ini_x, const float ini_y, const float ini_z);
299 
301  /* Methods */
302  char * name() const;
303  void set_name(const char * new_name);
304  size_t maxlenof_name() const;
305  float x() const;
306  void set_x(const float new_x);
307  size_t maxlenof_x() const;
308  float y() const;
309  void set_y(const float new_y);
310  size_t maxlenof_y() const;
311  float z() const;
312  void set_z(const float new_z);
313  size_t maxlenof_z() const;
314  virtual Message * clone() const;
315  };
316 
318  {
319  private:
320 #pragma pack(push,4)
321  /** Internal data storage, do NOT modify! */
322  typedef struct {
323  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
324  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
325  char name[30]; /**< Name of object */
326  char newName[30]; /**< New name of object */
327  } RenameObjectMessage_data_t;
328 #pragma pack(pop)
329 
330  RenameObjectMessage_data_t *data;
331 
332  public:
333  RenameObjectMessage(const char * ini_name, const char * ini_newName);
336 
338  /* Methods */
339  char * name() const;
340  void set_name(const char * new_name);
341  size_t maxlenof_name() const;
342  char * newName() const;
343  void set_newName(const char * new_newName);
344  size_t maxlenof_newName() const;
345  virtual Message * clone() const;
346  };
347 
348  virtual bool message_valid(const Message *message) const;
349  private:
352 
353  public:
354  /* Methods */
355  uint32_t msgid() const;
356  void set_msgid(const uint32_t new_msgid);
357  size_t maxlenof_msgid() const;
358  bool is_final() const;
359  void set_final(const bool new_final);
360  size_t maxlenof_final() const;
361  uint32_t error_code() const;
362  void set_error_code(const uint32_t new_error_code);
363  size_t maxlenof_error_code() const;
364  bool is_success() const;
365  void set_success(const bool new_success);
366  size_t maxlenof_success() const;
367  virtual Message * create_message(const char *type) const;
368 
369  virtual void copy_values(const Interface *other);
370  virtual const char * enum_tostring(const char *enumtype, int val) const;
371 
372 };
373 
374 } // end namespace fawkes
375 
376 #endif