Fawkes API Fawkes Development Version
JacoInterface.h
1
2/***************************************************************************
3 * JacoInterface.h - Fawkes BlackBoard Interface - JacoInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2013 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_JACOINTERFACE_H_
25#define _INTERFACES_JACOINTERFACE_H_
26
27#include <interface/interface.h>
28#include <interface/message.h>
29#include <interface/field_iterator.h>
30
31namespace fawkes {
32
34{
35 /// @cond INTERNALS
36 INTERFACE_MGMT_FRIENDS(JacoInterface)
37 /// @endcond
38 public:
39 /* constants */
40 static const uint32_t ERROR_NONE;
41 static const uint32_t ERROR_UNSPECIFIC;
42 static const uint32_t ERROR_NO_IK;
43 static const uint32_t ERROR_PLANNING;
44
45 private:
46 /** Internal data storage, do NOT modify! */
47 typedef struct {
48 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
49 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
50 bool connected; /**< Is JacoArm connected/ready? */
51 bool initialized; /**< Checks if Jaco arm has been initialized once after switched on. */
52 float x; /**< X-Coordinate of tool translation. */
53 float y; /**< Y-Coordinate op tool translation. */
54 float z; /**< Z-Coordinate of tool translation. */
55 float euler1; /**< 1st Euler angle of tool rotation. */
56 float euler2; /**< 2nd Euler angle of tool rotation. */
57 float euler3; /**< 3rd Euler angle of tool rotation. */
58 float joints[6]; /**< Angle values of joints */
59 float finger1; /**< Angular value of finger 1. */
60 float finger2; /**< Angular value of finger 2. */
61 float finger3; /**< Angular value of finger 3. */
62 uint32_t msgid; /**< The ID of the message that is currently being
63 processed, or 0 if no message is being processed. */
64 bool final; /**< True, if the last goto command has been finished,
65 false if it is still running */
66 uint32_t error_code; /**< Error code, set if
67 final is true. 0 if no error occured, an error code from ERROR_*
68 constants otherwise. */
69 } JacoInterface_data_t;
70
71 JacoInterface_data_t *data;
72
73 public:
74 /* messages */
76 {
77 private:
78 /** Internal data storage, do NOT modify! */
79 typedef struct {
80 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
81 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
82 } CalibrateMessage_data_t;
83
84 CalibrateMessage_data_t *data;
85
86 public:
89
90 explicit CalibrateMessage(const CalibrateMessage *m);
91 /* Methods */
92 virtual Message * clone() const;
93 };
94
95 class RetractMessage : public Message
96 {
97 private:
98 /** Internal data storage, do NOT modify! */
99 typedef struct {
100 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
101 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
102 } RetractMessage_data_t;
103
104 RetractMessage_data_t *data;
105
106 public:
109
110 explicit RetractMessage(const RetractMessage *m);
111 /* Methods */
112 virtual Message * clone() const;
113 };
114
115 class StopMessage : public Message
116 {
117 private:
118 /** Internal data storage, do NOT modify! */
119 typedef struct {
120 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
121 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
122 } StopMessage_data_t;
123
124 StopMessage_data_t *data;
125
126 public:
127 StopMessage();
128 ~StopMessage();
129
130 explicit StopMessage(const StopMessage *m);
131 /* Methods */
132 virtual Message * clone() const;
133 };
134
136 {
137 private:
138 /** Internal data storage, do NOT modify! */
139 typedef struct {
140 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
141 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
142 float x; /**< X-coordinate of target */
143 float y; /**< Y-coordinate of target */
144 float z; /**< Z-coordinate of target */
145 float e1; /**< 1st Euler angle of target rotation */
146 float e2; /**< 2nd Euler angle of target rotation */
147 float e3; /**< 3rd Euler angle of target rotation */
148 } CartesianGotoMessage_data_t;
149
150 CartesianGotoMessage_data_t *data;
151
152 public:
153 CartesianGotoMessage(const float ini_x, const float ini_y, const float ini_z, const float ini_e1, const float ini_e2, const float ini_e3);
156
158 /* Methods */
159 float x() const;
160 void set_x(const float new_x);
161 size_t maxlenof_x() const;
162 float y() const;
163 void set_y(const float new_y);
164 size_t maxlenof_y() const;
165 float z() const;
166 void set_z(const float new_z);
167 size_t maxlenof_z() const;
168 float e1() const;
169 void set_e1(const float new_e1);
170 size_t maxlenof_e1() const;
171 float e2() const;
172 void set_e2(const float new_e2);
173 size_t maxlenof_e2() const;
174 float e3() const;
175 void set_e3(const float new_e3);
176 size_t maxlenof_e3() const;
177 virtual Message * clone() const;
178 };
179
181 {
182 private:
183 /** Internal data storage, do NOT modify! */
184 typedef struct {
185 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
186 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
187 float j1; /**< Angular value of 1st joint */
188 float j2; /**< Angular value of 2nd joint */
189 float j3; /**< Angular value of 3rd joint */
190 float j4; /**< Angular value of 4th joint */
191 float j5; /**< Angular value of 5th joint */
192 float j6; /**< Angular value of 6th joint */
193 } AngularGotoMessage_data_t;
194
195 AngularGotoMessage_data_t *data;
196
197 public:
198 AngularGotoMessage(const float ini_j1, const float ini_j2, const float ini_j3, const float ini_j4, const float ini_j5, const float ini_j6);
201
202 explicit AngularGotoMessage(const AngularGotoMessage *m);
203 /* Methods */
204 float j1() const;
205 void set_j1(const float new_j1);
206 size_t maxlenof_j1() const;
207 float j2() const;
208 void set_j2(const float new_j2);
209 size_t maxlenof_j2() const;
210 float j3() const;
211 void set_j3(const float new_j3);
212 size_t maxlenof_j3() const;
213 float j4() const;
214 void set_j4(const float new_j4);
215 size_t maxlenof_j4() const;
216 float j5() const;
217 void set_j5(const float new_j5);
218 size_t maxlenof_j5() const;
219 float j6() const;
220 void set_j6(const float new_j6);
221 size_t maxlenof_j6() const;
222 virtual Message * clone() const;
223 };
224
226 {
227 private:
228 /** Internal data storage, do NOT modify! */
229 typedef struct {
230 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
231 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
232 float finger1; /**< Value of finger 1. Range [0,60] */
233 float finger2; /**< Value of finger 2. Range [0,60] */
234 float finger3; /**< Value of finger 3. Range [0,60] */
235 } MoveGripperMessage_data_t;
236
237 MoveGripperMessage_data_t *data;
238
239 public:
240 MoveGripperMessage(const float ini_finger1, const float ini_finger2, const float ini_finger3);
243
244 explicit MoveGripperMessage(const MoveGripperMessage *m);
245 /* Methods */
246 float finger1() const;
247 void set_finger1(const float new_finger1);
248 size_t maxlenof_finger1() const;
249 float finger2() const;
250 void set_finger2(const float new_finger2);
251 size_t maxlenof_finger2() const;
252 float finger3() const;
253 void set_finger3(const float new_finger3);
254 size_t maxlenof_finger3() const;
255 virtual Message * clone() const;
256 };
257
259 {
260 private:
261 /** Internal data storage, do NOT modify! */
262 typedef struct {
263 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
264 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
265 char params[1024]; /**< Planner parameters */
266 } SetPlannerParamsMessage_data_t;
267
268 SetPlannerParamsMessage_data_t *data;
269
270 public:
271 SetPlannerParamsMessage(const char * ini_params);
274
276 /* Methods */
277 char * params() const;
278 void set_params(const char * new_params);
279 size_t maxlenof_params() const;
280 virtual Message * clone() const;
281 };
282
284 {
285 private:
286 /** Internal data storage, do NOT modify! */
287 typedef struct {
288 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
289 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
290 uint32_t button; /**< Button ID to push. */
291 } JoystickPushMessage_data_t;
292
293 JoystickPushMessage_data_t *data;
294
295 public:
296 JoystickPushMessage(const uint32_t ini_button);
299
300 explicit JoystickPushMessage(const JoystickPushMessage *m);
301 /* Methods */
302 uint32_t button() const;
303 void set_button(const uint32_t new_button);
304 size_t maxlenof_button() const;
305 virtual Message * clone() const;
306 };
307
309 {
310 private:
311 /** Internal data storage, do NOT modify! */
312 typedef struct {
313 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
314 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
315 } JoystickReleaseMessage_data_t;
316
317 JoystickReleaseMessage_data_t *data;
318
319 public:
322
324 /* Methods */
325 virtual Message * clone() const;
326 };
327
328 virtual bool message_valid(const Message *message) const;
329 private:
332
333 public:
334 /* Methods */
335 bool is_connected() const;
336 void set_connected(const bool new_connected);
337 size_t maxlenof_connected() const;
338 bool is_initialized() const;
339 void set_initialized(const bool new_initialized);
340 size_t maxlenof_initialized() const;
341 float x() const;
342 void set_x(const float new_x);
343 size_t maxlenof_x() const;
344 float y() const;
345 void set_y(const float new_y);
346 size_t maxlenof_y() const;
347 float z() const;
348 void set_z(const float new_z);
349 size_t maxlenof_z() const;
350 float euler1() const;
351 void set_euler1(const float new_euler1);
352 size_t maxlenof_euler1() const;
353 float euler2() const;
354 void set_euler2(const float new_euler2);
355 size_t maxlenof_euler2() const;
356 float euler3() const;
357 void set_euler3(const float new_euler3);
358 size_t maxlenof_euler3() const;
359 float * joints() const;
360 float joints(unsigned int index) const;
361 void set_joints(unsigned int index, const float new_joints);
362 void set_joints(const float * new_joints);
363 size_t maxlenof_joints() const;
364 float finger1() const;
365 void set_finger1(const float new_finger1);
366 size_t maxlenof_finger1() const;
367 float finger2() const;
368 void set_finger2(const float new_finger2);
369 size_t maxlenof_finger2() const;
370 float finger3() const;
371 void set_finger3(const float new_finger3);
372 size_t maxlenof_finger3() const;
373 uint32_t msgid() const;
374 void set_msgid(const uint32_t new_msgid);
375 size_t maxlenof_msgid() const;
376 bool is_final() const;
377 void set_final(const bool new_final);
378 size_t maxlenof_final() const;
379 uint32_t error_code() const;
380 void set_error_code(const uint32_t new_error_code);
381 size_t maxlenof_error_code() const;
382 virtual Message * create_message(const char *type) const;
383
384 virtual void copy_values(const Interface *other);
385 virtual const char * enum_tostring(const char *enumtype, int val) const;
386
387};
388
389} // end namespace fawkes
390
391#endif
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
AngularGotoMessage Fawkes BlackBoard Interface Message.
void set_j3(const float new_j3)
Set j3 value.
size_t maxlenof_j6() const
Get maximum length of j6 value.
void set_j5(const float new_j5)
Set j5 value.
void set_j1(const float new_j1)
Set j1 value.
void set_j6(const float new_j6)
Set j6 value.
size_t maxlenof_j2() const
Get maximum length of j2 value.
void set_j2(const float new_j2)
Set j2 value.
size_t maxlenof_j3() const
Get maximum length of j3 value.
size_t maxlenof_j1() const
Get maximum length of j1 value.
virtual Message * clone() const
Clone this message.
void set_j4(const float new_j4)
Set j4 value.
size_t maxlenof_j4() const
Get maximum length of j4 value.
size_t maxlenof_j5() const
Get maximum length of j5 value.
CalibrateMessage Fawkes BlackBoard Interface Message.
Definition: JacoInterface.h:76
virtual Message * clone() const
Clone this message.
CartesianGotoMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_e2() const
Get maximum length of e2 value.
size_t maxlenof_z() const
Get maximum length of z value.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_e1() const
Get maximum length of e1 value.
void set_e1(const float new_e1)
Set e1 value.
void set_x(const float new_x)
Set x value.
void set_e2(const float new_e2)
Set e2 value.
virtual Message * clone() const
Clone this message.
void set_e3(const float new_e3)
Set e3 value.
void set_y(const float new_y)
Set y value.
size_t maxlenof_e3() const
Get maximum length of e3 value.
void set_z(const float new_z)
Set z value.
JoystickPushMessage Fawkes BlackBoard Interface Message.
void set_button(const uint32_t new_button)
Set button value.
uint32_t button() const
Get button value.
size_t maxlenof_button() const
Get maximum length of button value.
virtual Message * clone() const
Clone this message.
JoystickReleaseMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
MoveGripperMessage Fawkes BlackBoard Interface Message.
float finger1() const
Get finger1 value.
size_t maxlenof_finger1() const
Get maximum length of finger1 value.
virtual Message * clone() const
Clone this message.
void set_finger3(const float new_finger3)
Set finger3 value.
size_t maxlenof_finger2() const
Get maximum length of finger2 value.
void set_finger2(const float new_finger2)
Set finger2 value.
float finger3() const
Get finger3 value.
size_t maxlenof_finger3() const
Get maximum length of finger3 value.
void set_finger1(const float new_finger1)
Set finger1 value.
float finger2() const
Get finger2 value.
RetractMessage Fawkes BlackBoard Interface Message.
Definition: JacoInterface.h:96
virtual Message * clone() const
Clone this message.
SetPlannerParamsMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_params() const
Get maximum length of params value.
void set_params(const char *new_params)
Set params value.
virtual Message * clone() const
Clone this message.
StopMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
JacoInterface Fawkes BlackBoard Interface.
Definition: JacoInterface.h:34
size_t maxlenof_error_code() const
Get maximum length of error_code value.
void set_initialized(const bool new_initialized)
Set initialized value.
void set_error_code(const uint32_t new_error_code)
Set error_code value.
void set_final(const bool new_final)
Set final value.
size_t maxlenof_initialized() const
Get maximum length of initialized value.
static const uint32_t ERROR_NONE
ERROR_NONE constant.
Definition: JacoInterface.h:40
void set_finger2(const float new_finger2)
Set finger2 value.
size_t maxlenof_final() const
Get maximum length of final value.
size_t maxlenof_finger1() const
Get maximum length of finger1 value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_connected(const bool new_connected)
Set connected value.
size_t maxlenof_finger3() const
Get maximum length of finger3 value.
bool is_initialized() const
Get initialized value.
uint32_t error_code() const
Get error_code value.
void set_msgid(const uint32_t new_msgid)
Set msgid value.
float finger3() const
Get finger3 value.
void set_euler3(const float new_euler3)
Set euler3 value.
float finger2() const
Get finger2 value.
size_t maxlenof_euler3() const
Get maximum length of euler3 value.
void set_z(const float new_z)
Set z value.
void set_y(const float new_y)
Set y value.
size_t maxlenof_euler1() const
Get maximum length of euler1 value.
bool is_connected() const
Get connected value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
float x() const
Get x value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
float euler3() const
Get euler3 value.
uint32_t msgid() const
Get msgid value.
void set_finger1(const float new_finger1)
Set finger1 value.
size_t maxlenof_joints() const
Get maximum length of joints value.
void set_finger3(const float new_finger3)
Set finger3 value.
float finger1() const
Get finger1 value.
size_t maxlenof_y() const
Get maximum length of y value.
void set_euler1(const float new_euler1)
Set euler1 value.
float * joints() const
Get joints value.
void set_x(const float new_x)
Set x value.
size_t maxlenof_x() const
Get maximum length of x value.
float euler2() const
Get euler2 value.
static const uint32_t ERROR_NO_IK
ERROR_NO_IK constant.
Definition: JacoInterface.h:42
float z() const
Get z value.
size_t maxlenof_z() const
Get maximum length of z value.
size_t maxlenof_msgid() const
Get maximum length of msgid value.
float euler1() const
Get euler1 value.
size_t maxlenof_finger2() const
Get maximum length of finger2 value.
void set_euler2(const float new_euler2)
Set euler2 value.
float y() const
Get y value.
static const uint32_t ERROR_UNSPECIFIC
ERROR_UNSPECIFIC constant.
Definition: JacoInterface.h:41
size_t maxlenof_euler2() const
Get maximum length of euler2 value.
static const uint32_t ERROR_PLANNING
ERROR_PLANNING constant.
Definition: JacoInterface.h:43
size_t maxlenof_connected() const
Get maximum length of connected value.
virtual Message * create_message(const char *type) const
Create message based on type name.
bool is_final() const
Get final value.
void set_joints(unsigned int index, const float new_joints)
Set joints value at given index.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Fawkes library namespace.