Fawkes API  Fawkes Development Version
KatanaInterface.cpp
1 
2 /***************************************************************************
3  * KatanaInterface.cpp - Fawkes BlackBoard Interface - KatanaInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2009 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 #include <interfaces/KatanaInterface.h>
25 
26 #include <core/exceptions/software.h>
27 
28 #include <map>
29 #include <string>
30 #include <cstring>
31 #include <cstdlib>
32 
33 namespace fawkes {
34 
35 /** @class KatanaInterface <interfaces/KatanaInterface.h>
36  * KatanaInterface Fawkes BlackBoard Interface.
37  *
38  Interface to access component providing access to a Neuronics
39  Katana arm.
40 
41  * @ingroup FawkesInterfaces
42  */
43 
44 
45 /** SENSOR_IR_RIGHT_INNER_MIDDLE constant */
47 /** SENSOR_IR_RIGHT_INNER_FRONT constant */
49 /** SENSOR_RESERVED_2 constant */
50 const uint32_t KatanaInterface::SENSOR_RESERVED_2 = 2u;
51 /** SENSOR_COND_BOTH constant */
52 const uint32_t KatanaInterface::SENSOR_COND_BOTH = 3u;
53 /** SENSOR_IR_RIGHT_OUTER_FRONT constant */
55 /** SENSOR_IR_RIGHT_BOTTOM_FRONT constant */
57 /** SENSOR_FORCE_RIGHT_REAR constant */
59 /** SENSOR_FORCE_RIGHT_FRONT constant */
61 /** SENSOR_IR_LEFT_INNER_MIDDLE constant */
63 /** SENSOR_IR_LEFT_INNER_FRONT constant */
65 /** SENSOR_RESERVED_10 constant */
66 const uint32_t KatanaInterface::SENSOR_RESERVED_10 = 10u;
67 /** SENSOR_IR_CENTER_GRIPPER constant */
69 /** SENSOR_IR_LEFT_OUTER_FRONT constant */
71 /** SENSOR_IR_LEFT_BOTTOM_FRONT constant */
73 /** SENSOR_FORCE_LEFT_REAR constant */
74 const uint32_t KatanaInterface::SENSOR_FORCE_LEFT_REAR = 14u;
75 /** SENSOR_FORCE_LEFT_FRONT constant */
76 const uint32_t KatanaInterface::SENSOR_FORCE_LEFT_FRONT = 15u;
77 /** ERROR_NONE constant */
78 const uint32_t KatanaInterface::ERROR_NONE = 0u;
79 /** ERROR_UNSPECIFIC constant */
80 const uint32_t KatanaInterface::ERROR_UNSPECIFIC = 1u;
81 /** ERROR_CMD_START_FAILED constant */
82 const uint32_t KatanaInterface::ERROR_CMD_START_FAILED = 2u;
83 /** ERROR_NO_SOLUTION constant */
84 const uint32_t KatanaInterface::ERROR_NO_SOLUTION = 4u;
85 /** ERROR_COMMUNICATION constant */
86 const uint32_t KatanaInterface::ERROR_COMMUNICATION = 8u;
87 /** ERROR_MOTOR_CRASHED constant */
88 const uint32_t KatanaInterface::ERROR_MOTOR_CRASHED = 16u;
89 
90 /** Constructor */
91 KatanaInterface::KatanaInterface() : Interface()
92 {
93  data_size = sizeof(KatanaInterface_data_t);
94  data_ptr = malloc(data_size);
95  data = (KatanaInterface_data_t *)data_ptr;
96  data_ts = (interface_data_ts_t *)data_ptr;
97  memset(data_ptr, 0, data_size);
98  add_fieldinfo(IFT_BYTE, "sensor_value", 16, &data->sensor_value);
99  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
100  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
101  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
102  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
103  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
104  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
105  add_fieldinfo(IFT_INT32, "encoders", 6, &data->encoders);
106  add_fieldinfo(IFT_FLOAT, "angles", 6, &data->angles);
107  add_fieldinfo(IFT_UINT32, "msgid", 1, &data->msgid);
108  add_fieldinfo(IFT_BOOL, "final", 1, &data->final);
109  add_fieldinfo(IFT_UINT32, "error_code", 1, &data->error_code);
110  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
111  add_fieldinfo(IFT_BOOL, "calibrated", 1, &data->calibrated);
112  add_fieldinfo(IFT_BYTE, "max_velocity", 1, &data->max_velocity);
113  add_fieldinfo(IFT_BYTE, "num_motors", 1, &data->num_motors);
114  add_messageinfo("StopMessage");
115  add_messageinfo("FlushMessage");
116  add_messageinfo("ParkMessage");
117  add_messageinfo("LinearGotoMessage");
118  add_messageinfo("LinearGotoKniMessage");
119  add_messageinfo("ObjectGotoMessage");
120  add_messageinfo("CalibrateMessage");
121  add_messageinfo("OpenGripperMessage");
122  add_messageinfo("CloseGripperMessage");
123  add_messageinfo("SetEnabledMessage");
124  add_messageinfo("SetMaxVelocityMessage");
125  add_messageinfo("SetPlannerParamsMessage");
126  add_messageinfo("SetMotorEncoderMessage");
127  add_messageinfo("MoveMotorEncoderMessage");
128  add_messageinfo("SetMotorAngleMessage");
129  add_messageinfo("MoveMotorAngleMessage");
130  unsigned char tmp_hash[] = {0x63, 0x62, 0xb0, 0x97, 0x9, 0x8f, 0x58, 0x40, 0x61, 0xdc, 0x9a, 0xcc, 0xa, 0x97, 0xf8, 0xcd};
131  set_hash(tmp_hash);
132 }
133 
134 /** Destructor */
135 KatanaInterface::~KatanaInterface()
136 {
137  free(data_ptr);
138 }
139 /* Methods */
140 /** Get sensor_value value.
141  * Sensor
142  values. Use SENSOR_* indexes for accessing the values.
143  * @return sensor_value value
144  */
145 uint8_t *
146 KatanaInterface::sensor_value() const
147 {
148  return data->sensor_value;
149 }
150 
151 /** Get sensor_value value at given index.
152  * Sensor
153  values. Use SENSOR_* indexes for accessing the values.
154  * @param index index of value
155  * @return sensor_value value
156  * @exception Exception thrown if index is out of bounds
157  */
158 uint8_t
159 KatanaInterface::sensor_value(unsigned int index) const
160 {
161  if (index > 15) {
162  throw Exception("Index value %u out of bounds (0..15)", index);
163  }
164  return data->sensor_value[index];
165 }
166 
167 /** Get maximum length of sensor_value value.
168  * @return length of sensor_value value, can be length of the array or number of
169  * maximum number of characters for a string
170  */
171 size_t
172 KatanaInterface::maxlenof_sensor_value() const
173 {
174  return 16;
175 }
176 
177 /** Set sensor_value value.
178  * Sensor
179  values. Use SENSOR_* indexes for accessing the values.
180  * @param new_sensor_value new sensor_value value
181  */
182 void
183 KatanaInterface::set_sensor_value(const uint8_t * new_sensor_value)
184 {
185  data_changed |= change_field(data->sensor_value, new_sensor_value);
186 }
187 
188 /** Set sensor_value value at given index.
189  * Sensor
190  values. Use SENSOR_* indexes for accessing the values.
191  * @param new_sensor_value new sensor_value value
192  * @param index index for of the value
193  */
194 void
195 KatanaInterface::set_sensor_value(unsigned int index, const uint8_t new_sensor_value)
196 {
197  data_changed |= change_field(data->sensor_value, index, new_sensor_value);
198 }
199 /** Get x value.
200  * DEPRECATED! X-Coordinate for tool position
201  compared to base coordinate system.
202  * @return x value
203  */
204 float
205 KatanaInterface::x() const
206 {
207  return data->x;
208 }
209 
210 /** Get maximum length of x value.
211  * @return length of x value, can be length of the array or number of
212  * maximum number of characters for a string
213  */
214 size_t
215 KatanaInterface::maxlenof_x() const
216 {
217  return 1;
218 }
219 
220 /** Set x value.
221  * DEPRECATED! X-Coordinate for tool position
222  compared to base coordinate system.
223  * @param new_x new x value
224  */
225 void
226 KatanaInterface::set_x(const float new_x)
227 {
228  data_changed |= change_field(data->x, new_x);
229 }
230 
231 /** Get y value.
232  * DEPRECATED! Y-Coordinate for tool position
233  compared to base coordinate system.
234  * @return y value
235  */
236 float
237 KatanaInterface::y() const
238 {
239  return data->y;
240 }
241 
242 /** Get maximum length of y value.
243  * @return length of y value, can be length of the array or number of
244  * maximum number of characters for a string
245  */
246 size_t
247 KatanaInterface::maxlenof_y() const
248 {
249  return 1;
250 }
251 
252 /** Set y value.
253  * DEPRECATED! Y-Coordinate for tool position
254  compared to base coordinate system.
255  * @param new_y new y value
256  */
257 void
258 KatanaInterface::set_y(const float new_y)
259 {
260  data_changed |= change_field(data->y, new_y);
261 }
262 
263 /** Get z value.
264  * DEPRECATED! Z-Coordinate for tool position
265  compared to base coordinate system.
266  * @return z value
267  */
268 float
269 KatanaInterface::z() const
270 {
271  return data->z;
272 }
273 
274 /** Get maximum length of z value.
275  * @return length of z value, can be length of the array or number of
276  * maximum number of characters for a string
277  */
278 size_t
279 KatanaInterface::maxlenof_z() const
280 {
281  return 1;
282 }
283 
284 /** Set z value.
285  * DEPRECATED! Z-Coordinate for tool position
286  compared to base coordinate system.
287  * @param new_z new z value
288  */
289 void
290 KatanaInterface::set_z(const float new_z)
291 {
292  data_changed |= change_field(data->z, new_z);
293 }
294 
295 /** Get phi value.
296  * DEPRECATED! Euler angle Phi of tool orientation.
297  * @return phi value
298  */
299 float
300 KatanaInterface::phi() const
301 {
302  return data->phi;
303 }
304 
305 /** Get maximum length of phi value.
306  * @return length of phi value, can be length of the array or number of
307  * maximum number of characters for a string
308  */
309 size_t
310 KatanaInterface::maxlenof_phi() const
311 {
312  return 1;
313 }
314 
315 /** Set phi value.
316  * DEPRECATED! Euler angle Phi of tool orientation.
317  * @param new_phi new phi value
318  */
319 void
320 KatanaInterface::set_phi(const float new_phi)
321 {
322  data_changed |= change_field(data->phi, new_phi);
323 }
324 
325 /** Get theta value.
326  * DEPRECATED! Euler angle Theta of tool orientation.
327  * @return theta value
328  */
329 float
330 KatanaInterface::theta() const
331 {
332  return data->theta;
333 }
334 
335 /** Get maximum length of theta value.
336  * @return length of theta value, can be length of the array or number of
337  * maximum number of characters for a string
338  */
339 size_t
340 KatanaInterface::maxlenof_theta() const
341 {
342  return 1;
343 }
344 
345 /** Set theta value.
346  * DEPRECATED! Euler angle Theta of tool orientation.
347  * @param new_theta new theta value
348  */
349 void
350 KatanaInterface::set_theta(const float new_theta)
351 {
352  data_changed |= change_field(data->theta, new_theta);
353 }
354 
355 /** Get psi value.
356  * DEPRECATED! Euler angle Psi of tool orientation.
357  * @return psi value
358  */
359 float
360 KatanaInterface::psi() const
361 {
362  return data->psi;
363 }
364 
365 /** Get maximum length of psi value.
366  * @return length of psi value, can be length of the array or number of
367  * maximum number of characters for a string
368  */
369 size_t
370 KatanaInterface::maxlenof_psi() const
371 {
372  return 1;
373 }
374 
375 /** Set psi value.
376  * DEPRECATED! Euler angle Psi of tool orientation.
377  * @param new_psi new psi value
378  */
379 void
380 KatanaInterface::set_psi(const float new_psi)
381 {
382  data_changed |= change_field(data->psi, new_psi);
383 }
384 
385 /** Get encoders value.
386  * Encoder values of motors
387  * @return encoders value
388  */
389 int32_t *
390 KatanaInterface::encoders() const
391 {
392  return data->encoders;
393 }
394 
395 /** Get encoders value at given index.
396  * Encoder values of motors
397  * @param index index of value
398  * @return encoders value
399  * @exception Exception thrown if index is out of bounds
400  */
401 int32_t
402 KatanaInterface::encoders(unsigned int index) const
403 {
404  if (index > 5) {
405  throw Exception("Index value %u out of bounds (0..5)", index);
406  }
407  return data->encoders[index];
408 }
409 
410 /** Get maximum length of encoders value.
411  * @return length of encoders value, can be length of the array or number of
412  * maximum number of characters for a string
413  */
414 size_t
415 KatanaInterface::maxlenof_encoders() const
416 {
417  return 6;
418 }
419 
420 /** Set encoders value.
421  * Encoder values of motors
422  * @param new_encoders new encoders value
423  */
424 void
425 KatanaInterface::set_encoders(const int32_t * new_encoders)
426 {
427  data_changed |= change_field(data->encoders, new_encoders);
428 }
429 
430 /** Set encoders value at given index.
431  * Encoder values of motors
432  * @param new_encoders new encoders value
433  * @param index index for of the value
434  */
435 void
436 KatanaInterface::set_encoders(unsigned int index, const int32_t new_encoders)
437 {
438  data_changed |= change_field(data->encoders, index, new_encoders);
439 }
440 /** Get angles value.
441  * Angle values of motors
442  * @return angles value
443  */
444 float *
445 KatanaInterface::angles() const
446 {
447  return data->angles;
448 }
449 
450 /** Get angles value at given index.
451  * Angle values of motors
452  * @param index index of value
453  * @return angles value
454  * @exception Exception thrown if index is out of bounds
455  */
456 float
457 KatanaInterface::angles(unsigned int index) const
458 {
459  if (index > 5) {
460  throw Exception("Index value %u out of bounds (0..5)", index);
461  }
462  return data->angles[index];
463 }
464 
465 /** Get maximum length of angles value.
466  * @return length of angles value, can be length of the array or number of
467  * maximum number of characters for a string
468  */
469 size_t
470 KatanaInterface::maxlenof_angles() const
471 {
472  return 6;
473 }
474 
475 /** Set angles value.
476  * Angle values of motors
477  * @param new_angles new angles value
478  */
479 void
480 KatanaInterface::set_angles(const float * new_angles)
481 {
482  data_changed |= change_field(data->angles, new_angles);
483 }
484 
485 /** Set angles value at given index.
486  * Angle values of motors
487  * @param new_angles new angles value
488  * @param index index for of the value
489  */
490 void
491 KatanaInterface::set_angles(unsigned int index, const float new_angles)
492 {
493  data_changed |= change_field(data->angles, index, new_angles);
494 }
495 /** Get msgid value.
496  * The ID of the message that is currently being
497  processed, or 0 if no message is being processed.
498  * @return msgid value
499  */
500 uint32_t
501 KatanaInterface::msgid() const
502 {
503  return data->msgid;
504 }
505 
506 /** Get maximum length of msgid value.
507  * @return length of msgid value, can be length of the array or number of
508  * maximum number of characters for a string
509  */
510 size_t
511 KatanaInterface::maxlenof_msgid() const
512 {
513  return 1;
514 }
515 
516 /** Set msgid value.
517  * The ID of the message that is currently being
518  processed, or 0 if no message is being processed.
519  * @param new_msgid new msgid value
520  */
521 void
522 KatanaInterface::set_msgid(const uint32_t new_msgid)
523 {
524  data_changed |= change_field(data->msgid, new_msgid);
525 }
526 
527 /** Get final value.
528  * True, if the last goto command has been finished,
529  false if it is still running
530  * @return final value
531  */
532 bool
533 KatanaInterface::is_final() const
534 {
535  return data->final;
536 }
537 
538 /** Get maximum length of final value.
539  * @return length of final value, can be length of the array or number of
540  * maximum number of characters for a string
541  */
542 size_t
543 KatanaInterface::maxlenof_final() const
544 {
545  return 1;
546 }
547 
548 /** Set final value.
549  * True, if the last goto command has been finished,
550  false if it is still running
551  * @param new_final new final value
552  */
553 void
554 KatanaInterface::set_final(const bool new_final)
555 {
556  data_changed |= change_field(data->final, new_final);
557 }
558 
559 /** Get error_code value.
560  * Failure code set if
561  final is true. 0 if no error occured, an error code from ERROR_*
562  constants otherwise (or a bit-wise combination).
563  * @return error_code value
564  */
565 uint32_t
566 KatanaInterface::error_code() const
567 {
568  return data->error_code;
569 }
570 
571 /** Get maximum length of error_code value.
572  * @return length of error_code value, can be length of the array or number of
573  * maximum number of characters for a string
574  */
575 size_t
576 KatanaInterface::maxlenof_error_code() const
577 {
578  return 1;
579 }
580 
581 /** Set error_code value.
582  * Failure code set if
583  final is true. 0 if no error occured, an error code from ERROR_*
584  constants otherwise (or a bit-wise combination).
585  * @param new_error_code new error_code value
586  */
587 void
588 KatanaInterface::set_error_code(const uint32_t new_error_code)
589 {
590  data_changed |= change_field(data->error_code, new_error_code);
591 }
592 
593 /** Get enabled value.
594  * Are motors enabled?
595  * @return enabled value
596  */
597 bool
598 KatanaInterface::is_enabled() const
599 {
600  return data->enabled;
601 }
602 
603 /** Get maximum length of enabled value.
604  * @return length of enabled value, can be length of the array or number of
605  * maximum number of characters for a string
606  */
607 size_t
608 KatanaInterface::maxlenof_enabled() const
609 {
610  return 1;
611 }
612 
613 /** Set enabled value.
614  * Are motors enabled?
615  * @param new_enabled new enabled value
616  */
617 void
618 KatanaInterface::set_enabled(const bool new_enabled)
619 {
620  data_changed |= change_field(data->enabled, new_enabled);
621 }
622 
623 /** Get calibrated value.
624  * Has arm been calibrated?
625  * @return calibrated value
626  */
627 bool
628 KatanaInterface::is_calibrated() const
629 {
630  return data->calibrated;
631 }
632 
633 /** Get maximum length of calibrated value.
634  * @return length of calibrated value, can be length of the array or number of
635  * maximum number of characters for a string
636  */
637 size_t
638 KatanaInterface::maxlenof_calibrated() const
639 {
640  return 1;
641 }
642 
643 /** Set calibrated value.
644  * Has arm been calibrated?
645  * @param new_calibrated new calibrated value
646  */
647 void
648 KatanaInterface::set_calibrated(const bool new_calibrated)
649 {
650  data_changed |= change_field(data->calibrated, new_calibrated);
651 }
652 
653 /** Get max_velocity value.
654  * Maximum velocity
655  * @return max_velocity value
656  */
657 uint8_t
658 KatanaInterface::max_velocity() const
659 {
660  return data->max_velocity;
661 }
662 
663 /** Get maximum length of max_velocity value.
664  * @return length of max_velocity value, can be length of the array or number of
665  * maximum number of characters for a string
666  */
667 size_t
668 KatanaInterface::maxlenof_max_velocity() const
669 {
670  return 1;
671 }
672 
673 /** Set max_velocity value.
674  * Maximum velocity
675  * @param new_max_velocity new max_velocity value
676  */
677 void
678 KatanaInterface::set_max_velocity(const uint8_t new_max_velocity)
679 {
680  data_changed |= change_field(data->max_velocity, new_max_velocity);
681 }
682 
683 /** Get num_motors value.
684  * Number of motors
685  * @return num_motors value
686  */
687 uint8_t
688 KatanaInterface::num_motors() const
689 {
690  return data->num_motors;
691 }
692 
693 /** Get maximum length of num_motors value.
694  * @return length of num_motors value, can be length of the array or number of
695  * maximum number of characters for a string
696  */
697 size_t
698 KatanaInterface::maxlenof_num_motors() const
699 {
700  return 1;
701 }
702 
703 /** Set num_motors value.
704  * Number of motors
705  * @param new_num_motors new num_motors value
706  */
707 void
708 KatanaInterface::set_num_motors(const uint8_t new_num_motors)
709 {
710  data_changed |= change_field(data->num_motors, new_num_motors);
711 }
712 
713 /* =========== message create =========== */
714 Message *
715 KatanaInterface::create_message(const char *type) const
716 {
717  if ( strncmp("StopMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
718  return new StopMessage();
719  } else if ( strncmp("FlushMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
720  return new FlushMessage();
721  } else if ( strncmp("ParkMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
722  return new ParkMessage();
723  } else if ( strncmp("LinearGotoMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
724  return new LinearGotoMessage();
725  } else if ( strncmp("LinearGotoKniMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
726  return new LinearGotoKniMessage();
727  } else if ( strncmp("ObjectGotoMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
728  return new ObjectGotoMessage();
729  } else if ( strncmp("CalibrateMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
730  return new CalibrateMessage();
731  } else if ( strncmp("OpenGripperMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
732  return new OpenGripperMessage();
733  } else if ( strncmp("CloseGripperMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
734  return new CloseGripperMessage();
735  } else if ( strncmp("SetEnabledMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
736  return new SetEnabledMessage();
737  } else if ( strncmp("SetMaxVelocityMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
738  return new SetMaxVelocityMessage();
739  } else if ( strncmp("SetPlannerParamsMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
740  return new SetPlannerParamsMessage();
741  } else if ( strncmp("SetMotorEncoderMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
742  return new SetMotorEncoderMessage();
743  } else if ( strncmp("MoveMotorEncoderMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
744  return new MoveMotorEncoderMessage();
745  } else if ( strncmp("SetMotorAngleMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
746  return new SetMotorAngleMessage();
747  } else if ( strncmp("MoveMotorAngleMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
748  return new MoveMotorAngleMessage();
749  } else {
750  throw UnknownTypeException("The given type '%s' does not match any known "
751  "message type for this interface type.", type);
752  }
753 }
754 
755 
756 /** Copy values from other interface.
757  * @param other other interface to copy values from
758  */
759 void
760 KatanaInterface::copy_values(const Interface *other)
761 {
762  const KatanaInterface *oi = dynamic_cast<const KatanaInterface *>(other);
763  if (oi == NULL) {
764  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
765  type(), other->type());
766  }
767  memcpy(data, oi->data, sizeof(KatanaInterface_data_t));
768 }
769 
770 const char *
771 KatanaInterface::enum_tostring(const char *enumtype, int val) const
772 {
773  throw UnknownTypeException("Unknown enum type %s", enumtype);
774 }
775 
776 /* =========== messages =========== */
777 /** @class KatanaInterface::StopMessage <interfaces/KatanaInterface.h>
778  * StopMessage Fawkes BlackBoard Interface Message.
779  *
780 
781  */
782 
783 
784 /** Constructor */
785 KatanaInterface::StopMessage::StopMessage() : Message("StopMessage")
786 {
787  data_size = sizeof(StopMessage_data_t);
788  data_ptr = malloc(data_size);
789  memset(data_ptr, 0, data_size);
790  data = (StopMessage_data_t *)data_ptr;
792 }
793 
794 /** Destructor */
796 {
797  free(data_ptr);
798 }
799 
800 /** Copy constructor.
801  * @param m message to copy from
802  */
804 {
805  data_size = m->data_size;
806  data_ptr = malloc(data_size);
807  memcpy(data_ptr, m->data_ptr, data_size);
808  data = (StopMessage_data_t *)data_ptr;
810 }
811 
812 /* Methods */
813 /** Clone this message.
814  * Produces a message of the same type as this message and copies the
815  * data to the new message.
816  * @return clone of this message
817  */
818 Message *
820 {
821  return new KatanaInterface::StopMessage(this);
822 }
823 /** @class KatanaInterface::FlushMessage <interfaces/KatanaInterface.h>
824  * FlushMessage Fawkes BlackBoard Interface Message.
825  *
826 
827  */
828 
829 
830 /** Constructor */
832 {
833  data_size = sizeof(FlushMessage_data_t);
834  data_ptr = malloc(data_size);
835  memset(data_ptr, 0, data_size);
836  data = (FlushMessage_data_t *)data_ptr;
838 }
839 
840 /** Destructor */
842 {
843  free(data_ptr);
844 }
845 
846 /** Copy constructor.
847  * @param m message to copy from
848  */
850 {
851  data_size = m->data_size;
852  data_ptr = malloc(data_size);
853  memcpy(data_ptr, m->data_ptr, data_size);
854  data = (FlushMessage_data_t *)data_ptr;
856 }
857 
858 /* Methods */
859 /** Clone this message.
860  * Produces a message of the same type as this message and copies the
861  * data to the new message.
862  * @return clone of this message
863  */
864 Message *
866 {
867  return new KatanaInterface::FlushMessage(this);
868 }
869 /** @class KatanaInterface::ParkMessage <interfaces/KatanaInterface.h>
870  * ParkMessage Fawkes BlackBoard Interface Message.
871  *
872 
873  */
874 
875 
876 /** Constructor */
878 {
879  data_size = sizeof(ParkMessage_data_t);
880  data_ptr = malloc(data_size);
881  memset(data_ptr, 0, data_size);
882  data = (ParkMessage_data_t *)data_ptr;
884 }
885 
886 /** Destructor */
888 {
889  free(data_ptr);
890 }
891 
892 /** Copy constructor.
893  * @param m message to copy from
894  */
896 {
897  data_size = m->data_size;
898  data_ptr = malloc(data_size);
899  memcpy(data_ptr, m->data_ptr, data_size);
900  data = (ParkMessage_data_t *)data_ptr;
902 }
903 
904 /* Methods */
905 /** Clone this message.
906  * Produces a message of the same type as this message and copies the
907  * data to the new message.
908  * @return clone of this message
909  */
910 Message *
912 {
913  return new KatanaInterface::ParkMessage(this);
914 }
915 /** @class KatanaInterface::LinearGotoMessage <interfaces/KatanaInterface.h>
916  * LinearGotoMessage Fawkes BlackBoard Interface Message.
917  *
918 
919  */
920 
921 
922 /** Constructor with initial values.
923  * @param ini_theta_error initial value for theta_error
924  * @param ini_offset_xy initial value for offset_xy
925  * @param ini_straight initial value for straight
926  * @param ini_trans_frame initial value for trans_frame
927  * @param ini_rot_frame initial value for rot_frame
928  * @param ini_x initial value for x
929  * @param ini_y initial value for y
930  * @param ini_z initial value for z
931  * @param ini_phi initial value for phi
932  * @param ini_theta initial value for theta
933  * @param ini_psi initial value for psi
934  */
935 KatanaInterface::LinearGotoMessage::LinearGotoMessage(const float ini_theta_error, const float ini_offset_xy, const bool ini_straight, const char * ini_trans_frame, const char * ini_rot_frame, const float ini_x, const float ini_y, const float ini_z, const float ini_phi, const float ini_theta, const float ini_psi) : Message("LinearGotoMessage")
936 {
937  data_size = sizeof(LinearGotoMessage_data_t);
938  data_ptr = malloc(data_size);
939  memset(data_ptr, 0, data_size);
940  data = (LinearGotoMessage_data_t *)data_ptr;
942  data->theta_error = ini_theta_error;
943  data->offset_xy = ini_offset_xy;
944  data->straight = ini_straight;
945  strncpy(data->trans_frame, ini_trans_frame, 32-1);
946  data->trans_frame[32-1] = 0;
947  strncpy(data->rot_frame, ini_rot_frame, 32-1);
948  data->rot_frame[32-1] = 0;
949  data->x = ini_x;
950  data->y = ini_y;
951  data->z = ini_z;
952  data->phi = ini_phi;
953  data->theta = ini_theta;
954  data->psi = ini_psi;
955  add_fieldinfo(IFT_FLOAT, "theta_error", 1, &data->theta_error);
956  add_fieldinfo(IFT_FLOAT, "offset_xy", 1, &data->offset_xy);
957  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
958  add_fieldinfo(IFT_STRING, "trans_frame", 32, data->trans_frame);
959  add_fieldinfo(IFT_STRING, "rot_frame", 32, data->rot_frame);
960  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
961  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
962  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
963  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
964  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
965  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
966 }
967 /** Constructor */
969 {
970  data_size = sizeof(LinearGotoMessage_data_t);
971  data_ptr = malloc(data_size);
972  memset(data_ptr, 0, data_size);
973  data = (LinearGotoMessage_data_t *)data_ptr;
975  add_fieldinfo(IFT_FLOAT, "theta_error", 1, &data->theta_error);
976  add_fieldinfo(IFT_FLOAT, "offset_xy", 1, &data->offset_xy);
977  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
978  add_fieldinfo(IFT_STRING, "trans_frame", 32, data->trans_frame);
979  add_fieldinfo(IFT_STRING, "rot_frame", 32, data->rot_frame);
980  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
981  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
982  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
983  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
984  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
985  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
986 }
987 
988 /** Destructor */
990 {
991  free(data_ptr);
992 }
993 
994 /** Copy constructor.
995  * @param m message to copy from
996  */
998 {
999  data_size = m->data_size;
1000  data_ptr = malloc(data_size);
1001  memcpy(data_ptr, m->data_ptr, data_size);
1002  data = (LinearGotoMessage_data_t *)data_ptr;
1004 }
1005 
1006 /* Methods */
1007 /** Get theta_error value.
1008  * Error range of theta rotation, gives more flexibility
1009  for IK-solution searching.
1010  * @return theta_error value
1011  */
1012 float
1014 {
1015  return data->theta_error;
1016 }
1017 
1018 /** Get maximum length of theta_error value.
1019  * @return length of theta_error value, can be length of the array or number of
1020  * maximum number of characters for a string
1021  */
1022 size_t
1024 {
1025  return 1;
1026 }
1027 
1028 /** Set theta_error value.
1029  * Error range of theta rotation, gives more flexibility
1030  for IK-solution searching.
1031  * @param new_theta_error new theta_error value
1032  */
1033 void
1035 {
1036  change_field(data->theta_error, new_theta_error);
1037 }
1038 
1039 /** Get offset_xy value.
1040  * Offset to target. Distance in m (on the way to the target)
1041  * @return offset_xy value
1042  */
1043 float
1045 {
1046  return data->offset_xy;
1047 }
1048 
1049 /** Get maximum length of offset_xy value.
1050  * @return length of offset_xy value, can be length of the array or number of
1051  * maximum number of characters for a string
1052  */
1053 size_t
1055 {
1056  return 1;
1057 }
1058 
1059 /** Set offset_xy value.
1060  * Offset to target. Distance in m (on the way to the target)
1061  * @param new_offset_xy new offset_xy value
1062  */
1063 void
1065 {
1066  change_field(data->offset_xy, new_offset_xy);
1067 }
1068 
1069 /** Get straight value.
1070  * Move in a straight line?
1071  * @return straight value
1072  */
1073 bool
1075 {
1076  return data->straight;
1077 }
1078 
1079 /** Get maximum length of straight value.
1080  * @return length of straight value, can be length of the array or number of
1081  * maximum number of characters for a string
1082  */
1083 size_t
1085 {
1086  return 1;
1087 }
1088 
1089 /** Set straight value.
1090  * Move in a straight line?
1091  * @param new_straight new straight value
1092  */
1093 void
1095 {
1096  change_field(data->straight, new_straight);
1097 }
1098 
1099 /** Get trans_frame value.
1100  * tf frame-id of origin's coordinate system,
1101  regarding the translation
1102  * @return trans_frame value
1103  */
1104 char *
1106 {
1107  return data->trans_frame;
1108 }
1109 
1110 /** Get maximum length of trans_frame value.
1111  * @return length of trans_frame value, can be length of the array or number of
1112  * maximum number of characters for a string
1113  */
1114 size_t
1116 {
1117  return 32;
1118 }
1119 
1120 /** Set trans_frame value.
1121  * tf frame-id of origin's coordinate system,
1122  regarding the translation
1123  * @param new_trans_frame new trans_frame value
1124  */
1125 void
1127 {
1128  change_field(data->trans_frame, new_trans_frame);
1129 }
1130 
1131 /** Get rot_frame value.
1132  * tf frame-id of origin's coordinate system,
1133  regarding the rotation. In most cases, this is the robot's base coordinate system.
1134  * @return rot_frame value
1135  */
1136 char *
1138 {
1139  return data->rot_frame;
1140 }
1141 
1142 /** Get maximum length of rot_frame value.
1143  * @return length of rot_frame value, can be length of the array or number of
1144  * maximum number of characters for a string
1145  */
1146 size_t
1148 {
1149  return 32;
1150 }
1151 
1152 /** Set rot_frame value.
1153  * tf frame-id of origin's coordinate system,
1154  regarding the rotation. In most cases, this is the robot's base coordinate system.
1155  * @param new_rot_frame new rot_frame value
1156  */
1157 void
1159 {
1160  change_field(data->rot_frame, new_rot_frame);
1161 }
1162 
1163 /** Get x value.
1164  * DEPRECATED! X-Coordinate for tool position
1165  compared to base coordinate system.
1166  * @return x value
1167  */
1168 float
1170 {
1171  return data->x;
1172 }
1173 
1174 /** Get maximum length of x value.
1175  * @return length of x value, can be length of the array or number of
1176  * maximum number of characters for a string
1177  */
1178 size_t
1180 {
1181  return 1;
1182 }
1183 
1184 /** Set x value.
1185  * DEPRECATED! X-Coordinate for tool position
1186  compared to base coordinate system.
1187  * @param new_x new x value
1188  */
1189 void
1191 {
1192  change_field(data->x, new_x);
1193 }
1194 
1195 /** Get y value.
1196  * DEPRECATED! Y-Coordinate for tool position
1197  compared to base coordinate system.
1198  * @return y value
1199  */
1200 float
1202 {
1203  return data->y;
1204 }
1205 
1206 /** Get maximum length of y value.
1207  * @return length of y value, can be length of the array or number of
1208  * maximum number of characters for a string
1209  */
1210 size_t
1212 {
1213  return 1;
1214 }
1215 
1216 /** Set y value.
1217  * DEPRECATED! Y-Coordinate for tool position
1218  compared to base coordinate system.
1219  * @param new_y new y value
1220  */
1221 void
1223 {
1224  change_field(data->y, new_y);
1225 }
1226 
1227 /** Get z value.
1228  * DEPRECATED! Z-Coordinate for tool position
1229  compared to base coordinate system.
1230  * @return z value
1231  */
1232 float
1234 {
1235  return data->z;
1236 }
1237 
1238 /** Get maximum length of z value.
1239  * @return length of z value, can be length of the array or number of
1240  * maximum number of characters for a string
1241  */
1242 size_t
1244 {
1245  return 1;
1246 }
1247 
1248 /** Set z value.
1249  * DEPRECATED! Z-Coordinate for tool position
1250  compared to base coordinate system.
1251  * @param new_z new z value
1252  */
1253 void
1255 {
1256  change_field(data->z, new_z);
1257 }
1258 
1259 /** Get phi value.
1260  * DEPRECATED! Euler angle Phi of tool orientation.
1261  * @return phi value
1262  */
1263 float
1265 {
1266  return data->phi;
1267 }
1268 
1269 /** Get maximum length of phi value.
1270  * @return length of phi value, can be length of the array or number of
1271  * maximum number of characters for a string
1272  */
1273 size_t
1275 {
1276  return 1;
1277 }
1278 
1279 /** Set phi value.
1280  * DEPRECATED! Euler angle Phi of tool orientation.
1281  * @param new_phi new phi value
1282  */
1283 void
1285 {
1286  change_field(data->phi, new_phi);
1287 }
1288 
1289 /** Get theta value.
1290  * DEPRECATED! Euler angle Theta of tool orientation.
1291  * @return theta value
1292  */
1293 float
1295 {
1296  return data->theta;
1297 }
1298 
1299 /** Get maximum length of theta value.
1300  * @return length of theta value, can be length of the array or number of
1301  * maximum number of characters for a string
1302  */
1303 size_t
1305 {
1306  return 1;
1307 }
1308 
1309 /** Set theta value.
1310  * DEPRECATED! Euler angle Theta of tool orientation.
1311  * @param new_theta new theta value
1312  */
1313 void
1315 {
1316  change_field(data->theta, new_theta);
1317 }
1318 
1319 /** Get psi value.
1320  * DEPRECATED! Euler angle Psi of tool orientation.
1321  * @return psi value
1322  */
1323 float
1325 {
1326  return data->psi;
1327 }
1328 
1329 /** Get maximum length of psi value.
1330  * @return length of psi value, can be length of the array or number of
1331  * maximum number of characters for a string
1332  */
1333 size_t
1335 {
1336  return 1;
1337 }
1338 
1339 /** Set psi value.
1340  * DEPRECATED! Euler angle Psi of tool orientation.
1341  * @param new_psi new psi value
1342  */
1343 void
1345 {
1346  change_field(data->psi, new_psi);
1347 }
1348 
1349 /** Clone this message.
1350  * Produces a message of the same type as this message and copies the
1351  * data to the new message.
1352  * @return clone of this message
1353  */
1354 Message *
1356 {
1357  return new KatanaInterface::LinearGotoMessage(this);
1358 }
1359 /** @class KatanaInterface::LinearGotoKniMessage <interfaces/KatanaInterface.h>
1360  * LinearGotoKniMessage Fawkes BlackBoard Interface Message.
1361  *
1362 
1363  */
1364 
1365 
1366 /** Constructor with initial values.
1367  * @param ini_x initial value for x
1368  * @param ini_y initial value for y
1369  * @param ini_z initial value for z
1370  * @param ini_phi initial value for phi
1371  * @param ini_theta initial value for theta
1372  * @param ini_psi initial value for psi
1373  */
1374 KatanaInterface::LinearGotoKniMessage::LinearGotoKniMessage(const float ini_x, const float ini_y, const float ini_z, const float ini_phi, const float ini_theta, const float ini_psi) : Message("LinearGotoKniMessage")
1375 {
1376  data_size = sizeof(LinearGotoKniMessage_data_t);
1377  data_ptr = malloc(data_size);
1378  memset(data_ptr, 0, data_size);
1379  data = (LinearGotoKniMessage_data_t *)data_ptr;
1381  data->x = ini_x;
1382  data->y = ini_y;
1383  data->z = ini_z;
1384  data->phi = ini_phi;
1385  data->theta = ini_theta;
1386  data->psi = ini_psi;
1387  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1388  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1389  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
1390  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
1391  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
1392  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
1393 }
1394 /** Constructor */
1396 {
1397  data_size = sizeof(LinearGotoKniMessage_data_t);
1398  data_ptr = malloc(data_size);
1399  memset(data_ptr, 0, data_size);
1400  data = (LinearGotoKniMessage_data_t *)data_ptr;
1402  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1403  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1404  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
1405  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
1406  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
1407  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
1408 }
1409 
1410 /** Destructor */
1412 {
1413  free(data_ptr);
1414 }
1415 
1416 /** Copy constructor.
1417  * @param m message to copy from
1418  */
1420 {
1421  data_size = m->data_size;
1422  data_ptr = malloc(data_size);
1423  memcpy(data_ptr, m->data_ptr, data_size);
1424  data = (LinearGotoKniMessage_data_t *)data_ptr;
1426 }
1427 
1428 /* Methods */
1429 /** Get x value.
1430  * X-Coordinate for tool position
1431  compared to base libkni coordinate system.
1432  * @return x value
1433  */
1434 float
1436 {
1437  return data->x;
1438 }
1439 
1440 /** Get maximum length of x value.
1441  * @return length of x value, can be length of the array or number of
1442  * maximum number of characters for a string
1443  */
1444 size_t
1446 {
1447  return 1;
1448 }
1449 
1450 /** Set x value.
1451  * X-Coordinate for tool position
1452  compared to base libkni coordinate system.
1453  * @param new_x new x value
1454  */
1455 void
1457 {
1458  change_field(data->x, new_x);
1459 }
1460 
1461 /** Get y value.
1462  * Y-Coordinate for tool position
1463  compared to base libkni coordinate system.
1464  * @return y value
1465  */
1466 float
1468 {
1469  return data->y;
1470 }
1471 
1472 /** Get maximum length of y value.
1473  * @return length of y value, can be length of the array or number of
1474  * maximum number of characters for a string
1475  */
1476 size_t
1478 {
1479  return 1;
1480 }
1481 
1482 /** Set y value.
1483  * Y-Coordinate for tool position
1484  compared to base libkni coordinate system.
1485  * @param new_y new y value
1486  */
1487 void
1489 {
1490  change_field(data->y, new_y);
1491 }
1492 
1493 /** Get z value.
1494  * Z-Coordinate for tool position
1495  compared to base libkni coordinate system.
1496  * @return z value
1497  */
1498 float
1500 {
1501  return data->z;
1502 }
1503 
1504 /** Get maximum length of z value.
1505  * @return length of z value, can be length of the array or number of
1506  * maximum number of characters for a string
1507  */
1508 size_t
1510 {
1511  return 1;
1512 }
1513 
1514 /** Set z value.
1515  * Z-Coordinate for tool position
1516  compared to base libkni coordinate system.
1517  * @param new_z new z value
1518  */
1519 void
1521 {
1522  change_field(data->z, new_z);
1523 }
1524 
1525 /** Get phi value.
1526  * Euler angle Phi of tool orientation.
1527  * @return phi value
1528  */
1529 float
1531 {
1532  return data->phi;
1533 }
1534 
1535 /** Get maximum length of phi value.
1536  * @return length of phi value, can be length of the array or number of
1537  * maximum number of characters for a string
1538  */
1539 size_t
1541 {
1542  return 1;
1543 }
1544 
1545 /** Set phi value.
1546  * Euler angle Phi of tool orientation.
1547  * @param new_phi new phi value
1548  */
1549 void
1551 {
1552  change_field(data->phi, new_phi);
1553 }
1554 
1555 /** Get theta value.
1556  * Euler angle Theta of tool orientation.
1557  * @return theta value
1558  */
1559 float
1561 {
1562  return data->theta;
1563 }
1564 
1565 /** Get maximum length of theta value.
1566  * @return length of theta value, can be length of the array or number of
1567  * maximum number of characters for a string
1568  */
1569 size_t
1571 {
1572  return 1;
1573 }
1574 
1575 /** Set theta value.
1576  * Euler angle Theta of tool orientation.
1577  * @param new_theta new theta value
1578  */
1579 void
1581 {
1582  change_field(data->theta, new_theta);
1583 }
1584 
1585 /** Get psi value.
1586  * Euler angle Psi of tool orientation.
1587  * @return psi value
1588  */
1589 float
1591 {
1592  return data->psi;
1593 }
1594 
1595 /** Get maximum length of psi value.
1596  * @return length of psi value, can be length of the array or number of
1597  * maximum number of characters for a string
1598  */
1599 size_t
1601 {
1602  return 1;
1603 }
1604 
1605 /** Set psi value.
1606  * Euler angle Psi of tool orientation.
1607  * @param new_psi new psi value
1608  */
1609 void
1611 {
1612  change_field(data->psi, new_psi);
1613 }
1614 
1615 /** Clone this message.
1616  * Produces a message of the same type as this message and copies the
1617  * data to the new message.
1618  * @return clone of this message
1619  */
1620 Message *
1622 {
1623  return new KatanaInterface::LinearGotoKniMessage(this);
1624 }
1625 /** @class KatanaInterface::ObjectGotoMessage <interfaces/KatanaInterface.h>
1626  * ObjectGotoMessage Fawkes BlackBoard Interface Message.
1627  *
1628 
1629  */
1630 
1631 
1632 /** Constructor with initial values.
1633  * @param ini_object initial value for object
1634  * @param ini_rot_x initial value for rot_x
1635  */
1636 KatanaInterface::ObjectGotoMessage::ObjectGotoMessage(const char * ini_object, const float ini_rot_x) : Message("ObjectGotoMessage")
1637 {
1638  data_size = sizeof(ObjectGotoMessage_data_t);
1639  data_ptr = malloc(data_size);
1640  memset(data_ptr, 0, data_size);
1641  data = (ObjectGotoMessage_data_t *)data_ptr;
1643  strncpy(data->object, ini_object, 32-1);
1644  data->object[32-1] = 0;
1645  data->rot_x = ini_rot_x;
1646  add_fieldinfo(IFT_STRING, "object", 32, data->object);
1647  add_fieldinfo(IFT_FLOAT, "rot_x", 1, &data->rot_x);
1648 }
1649 /** Constructor */
1651 {
1652  data_size = sizeof(ObjectGotoMessage_data_t);
1653  data_ptr = malloc(data_size);
1654  memset(data_ptr, 0, data_size);
1655  data = (ObjectGotoMessage_data_t *)data_ptr;
1657  add_fieldinfo(IFT_STRING, "object", 32, data->object);
1658  add_fieldinfo(IFT_FLOAT, "rot_x", 1, &data->rot_x);
1659 }
1660 
1661 /** Destructor */
1663 {
1664  free(data_ptr);
1665 }
1666 
1667 /** Copy constructor.
1668  * @param m message to copy from
1669  */
1671 {
1672  data_size = m->data_size;
1673  data_ptr = malloc(data_size);
1674  memcpy(data_ptr, m->data_ptr, data_size);
1675  data = (ObjectGotoMessage_data_t *)data_ptr;
1677 }
1678 
1679 /* Methods */
1680 /** Get object value.
1681  * Name of object
1682  * @return object value
1683  */
1684 char *
1686 {
1687  return data->object;
1688 }
1689 
1690 /** Get maximum length of object value.
1691  * @return length of object value, can be length of the array or number of
1692  * maximum number of characters for a string
1693  */
1694 size_t
1696 {
1697  return 32;
1698 }
1699 
1700 /** Set object value.
1701  * Name of object
1702  * @param new_object new object value
1703  */
1704 void
1706 {
1707  change_field(data->object, new_object);
1708 }
1709 
1710 /** Get rot_x value.
1711  * Rotation of object on its x-axis
1712  * @return rot_x value
1713  */
1714 float
1716 {
1717  return data->rot_x;
1718 }
1719 
1720 /** Get maximum length of rot_x value.
1721  * @return length of rot_x value, can be length of the array or number of
1722  * maximum number of characters for a string
1723  */
1724 size_t
1726 {
1727  return 1;
1728 }
1729 
1730 /** Set rot_x value.
1731  * Rotation of object on its x-axis
1732  * @param new_rot_x new rot_x value
1733  */
1734 void
1736 {
1737  change_field(data->rot_x, new_rot_x);
1738 }
1739 
1740 /** Clone this message.
1741  * Produces a message of the same type as this message and copies the
1742  * data to the new message.
1743  * @return clone of this message
1744  */
1745 Message *
1747 {
1748  return new KatanaInterface::ObjectGotoMessage(this);
1749 }
1750 /** @class KatanaInterface::CalibrateMessage <interfaces/KatanaInterface.h>
1751  * CalibrateMessage Fawkes BlackBoard Interface Message.
1752  *
1753 
1754  */
1755 
1756 
1757 /** Constructor */
1759 {
1760  data_size = sizeof(CalibrateMessage_data_t);
1761  data_ptr = malloc(data_size);
1762  memset(data_ptr, 0, data_size);
1763  data = (CalibrateMessage_data_t *)data_ptr;
1765 }
1766 
1767 /** Destructor */
1769 {
1770  free(data_ptr);
1771 }
1772 
1773 /** Copy constructor.
1774  * @param m message to copy from
1775  */
1777 {
1778  data_size = m->data_size;
1779  data_ptr = malloc(data_size);
1780  memcpy(data_ptr, m->data_ptr, data_size);
1781  data = (CalibrateMessage_data_t *)data_ptr;
1783 }
1784 
1785 /* Methods */
1786 /** Clone this message.
1787  * Produces a message of the same type as this message and copies the
1788  * data to the new message.
1789  * @return clone of this message
1790  */
1791 Message *
1793 {
1794  return new KatanaInterface::CalibrateMessage(this);
1795 }
1796 /** @class KatanaInterface::OpenGripperMessage <interfaces/KatanaInterface.h>
1797  * OpenGripperMessage Fawkes BlackBoard Interface Message.
1798  *
1799 
1800  */
1801 
1802 
1803 /** Constructor */
1805 {
1806  data_size = sizeof(OpenGripperMessage_data_t);
1807  data_ptr = malloc(data_size);
1808  memset(data_ptr, 0, data_size);
1809  data = (OpenGripperMessage_data_t *)data_ptr;
1811 }
1812 
1813 /** Destructor */
1815 {
1816  free(data_ptr);
1817 }
1818 
1819 /** Copy constructor.
1820  * @param m message to copy from
1821  */
1823 {
1824  data_size = m->data_size;
1825  data_ptr = malloc(data_size);
1826  memcpy(data_ptr, m->data_ptr, data_size);
1827  data = (OpenGripperMessage_data_t *)data_ptr;
1829 }
1830 
1831 /* Methods */
1832 /** Clone this message.
1833  * Produces a message of the same type as this message and copies the
1834  * data to the new message.
1835  * @return clone of this message
1836  */
1837 Message *
1839 {
1840  return new KatanaInterface::OpenGripperMessage(this);
1841 }
1842 /** @class KatanaInterface::CloseGripperMessage <interfaces/KatanaInterface.h>
1843  * CloseGripperMessage Fawkes BlackBoard Interface Message.
1844  *
1845 
1846  */
1847 
1848 
1849 /** Constructor */
1851 {
1852  data_size = sizeof(CloseGripperMessage_data_t);
1853  data_ptr = malloc(data_size);
1854  memset(data_ptr, 0, data_size);
1855  data = (CloseGripperMessage_data_t *)data_ptr;
1857 }
1858 
1859 /** Destructor */
1861 {
1862  free(data_ptr);
1863 }
1864 
1865 /** Copy constructor.
1866  * @param m message to copy from
1867  */
1869 {
1870  data_size = m->data_size;
1871  data_ptr = malloc(data_size);
1872  memcpy(data_ptr, m->data_ptr, data_size);
1873  data = (CloseGripperMessage_data_t *)data_ptr;
1875 }
1876 
1877 /* Methods */
1878 /** Clone this message.
1879  * Produces a message of the same type as this message and copies the
1880  * data to the new message.
1881  * @return clone of this message
1882  */
1883 Message *
1885 {
1886  return new KatanaInterface::CloseGripperMessage(this);
1887 }
1888 /** @class KatanaInterface::SetEnabledMessage <interfaces/KatanaInterface.h>
1889  * SetEnabledMessage Fawkes BlackBoard Interface Message.
1890  *
1891 
1892  */
1893 
1894 
1895 /** Constructor with initial values.
1896  * @param ini_enabled initial value for enabled
1897  */
1898 KatanaInterface::SetEnabledMessage::SetEnabledMessage(const bool ini_enabled) : Message("SetEnabledMessage")
1899 {
1900  data_size = sizeof(SetEnabledMessage_data_t);
1901  data_ptr = malloc(data_size);
1902  memset(data_ptr, 0, data_size);
1903  data = (SetEnabledMessage_data_t *)data_ptr;
1905  data->enabled = ini_enabled;
1906  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
1907 }
1908 /** Constructor */
1910 {
1911  data_size = sizeof(SetEnabledMessage_data_t);
1912  data_ptr = malloc(data_size);
1913  memset(data_ptr, 0, data_size);
1914  data = (SetEnabledMessage_data_t *)data_ptr;
1916  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
1917 }
1918 
1919 /** Destructor */
1921 {
1922  free(data_ptr);
1923 }
1924 
1925 /** Copy constructor.
1926  * @param m message to copy from
1927  */
1929 {
1930  data_size = m->data_size;
1931  data_ptr = malloc(data_size);
1932  memcpy(data_ptr, m->data_ptr, data_size);
1933  data = (SetEnabledMessage_data_t *)data_ptr;
1935 }
1936 
1937 /* Methods */
1938 /** Get enabled value.
1939  * Are motors enabled?
1940  * @return enabled value
1941  */
1942 bool
1944 {
1945  return data->enabled;
1946 }
1947 
1948 /** Get maximum length of enabled value.
1949  * @return length of enabled value, can be length of the array or number of
1950  * maximum number of characters for a string
1951  */
1952 size_t
1954 {
1955  return 1;
1956 }
1957 
1958 /** Set enabled value.
1959  * Are motors enabled?
1960  * @param new_enabled new enabled value
1961  */
1962 void
1964 {
1965  change_field(data->enabled, new_enabled);
1966 }
1967 
1968 /** Clone this message.
1969  * Produces a message of the same type as this message and copies the
1970  * data to the new message.
1971  * @return clone of this message
1972  */
1973 Message *
1975 {
1976  return new KatanaInterface::SetEnabledMessage(this);
1977 }
1978 /** @class KatanaInterface::SetMaxVelocityMessage <interfaces/KatanaInterface.h>
1979  * SetMaxVelocityMessage Fawkes BlackBoard Interface Message.
1980  *
1981 
1982  */
1983 
1984 
1985 /** Constructor with initial values.
1986  * @param ini_max_velocity initial value for max_velocity
1987  */
1988 KatanaInterface::SetMaxVelocityMessage::SetMaxVelocityMessage(const uint8_t ini_max_velocity) : Message("SetMaxVelocityMessage")
1989 {
1990  data_size = sizeof(SetMaxVelocityMessage_data_t);
1991  data_ptr = malloc(data_size);
1992  memset(data_ptr, 0, data_size);
1993  data = (SetMaxVelocityMessage_data_t *)data_ptr;
1995  data->max_velocity = ini_max_velocity;
1996  add_fieldinfo(IFT_BYTE, "max_velocity", 1, &data->max_velocity);
1997 }
1998 /** Constructor */
2000 {
2001  data_size = sizeof(SetMaxVelocityMessage_data_t);
2002  data_ptr = malloc(data_size);
2003  memset(data_ptr, 0, data_size);
2004  data = (SetMaxVelocityMessage_data_t *)data_ptr;
2006  add_fieldinfo(IFT_BYTE, "max_velocity", 1, &data->max_velocity);
2007 }
2008 
2009 /** Destructor */
2011 {
2012  free(data_ptr);
2013 }
2014 
2015 /** Copy constructor.
2016  * @param m message to copy from
2017  */
2019 {
2020  data_size = m->data_size;
2021  data_ptr = malloc(data_size);
2022  memcpy(data_ptr, m->data_ptr, data_size);
2023  data = (SetMaxVelocityMessage_data_t *)data_ptr;
2025 }
2026 
2027 /* Methods */
2028 /** Get max_velocity value.
2029  * Maximum velocity
2030  * @return max_velocity value
2031  */
2032 uint8_t
2034 {
2035  return data->max_velocity;
2036 }
2037 
2038 /** Get maximum length of max_velocity value.
2039  * @return length of max_velocity value, can be length of the array or number of
2040  * maximum number of characters for a string
2041  */
2042 size_t
2044 {
2045  return 1;
2046 }
2047 
2048 /** Set max_velocity value.
2049  * Maximum velocity
2050  * @param new_max_velocity new max_velocity value
2051  */
2052 void
2054 {
2055  change_field(data->max_velocity, new_max_velocity);
2056 }
2057 
2058 /** Clone this message.
2059  * Produces a message of the same type as this message and copies the
2060  * data to the new message.
2061  * @return clone of this message
2062  */
2063 Message *
2065 {
2066  return new KatanaInterface::SetMaxVelocityMessage(this);
2067 }
2068 /** @class KatanaInterface::SetPlannerParamsMessage <interfaces/KatanaInterface.h>
2069  * SetPlannerParamsMessage Fawkes BlackBoard Interface Message.
2070  *
2071 
2072  */
2073 
2074 
2075 /** Constructor with initial values.
2076  * @param ini_plannerparams initial value for plannerparams
2077  * @param ini_straight initial value for straight
2078  */
2079 KatanaInterface::SetPlannerParamsMessage::SetPlannerParamsMessage(const char * ini_plannerparams, const bool ini_straight) : Message("SetPlannerParamsMessage")
2080 {
2081  data_size = sizeof(SetPlannerParamsMessage_data_t);
2082  data_ptr = malloc(data_size);
2083  memset(data_ptr, 0, data_size);
2084  data = (SetPlannerParamsMessage_data_t *)data_ptr;
2086  strncpy(data->plannerparams, ini_plannerparams, 1024-1);
2087  data->plannerparams[1024-1] = 0;
2088  data->straight = ini_straight;
2089  add_fieldinfo(IFT_STRING, "plannerparams", 1024, data->plannerparams);
2090  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
2091 }
2092 /** Constructor */
2094 {
2095  data_size = sizeof(SetPlannerParamsMessage_data_t);
2096  data_ptr = malloc(data_size);
2097  memset(data_ptr, 0, data_size);
2098  data = (SetPlannerParamsMessage_data_t *)data_ptr;
2100  add_fieldinfo(IFT_STRING, "plannerparams", 1024, data->plannerparams);
2101  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
2102 }
2103 
2104 /** Destructor */
2106 {
2107  free(data_ptr);
2108 }
2109 
2110 /** Copy constructor.
2111  * @param m message to copy from
2112  */
2114 {
2115  data_size = m->data_size;
2116  data_ptr = malloc(data_size);
2117  memcpy(data_ptr, m->data_ptr, data_size);
2118  data = (SetPlannerParamsMessage_data_t *)data_ptr;
2120 }
2121 
2122 /* Methods */
2123 /** Get plannerparams value.
2124  * Planner parameters
2125  * @return plannerparams value
2126  */
2127 char *
2129 {
2130  return data->plannerparams;
2131 }
2132 
2133 /** Get maximum length of plannerparams value.
2134  * @return length of plannerparams value, can be length of the array or number of
2135  * maximum number of characters for a string
2136  */
2137 size_t
2139 {
2140  return 1024;
2141 }
2142 
2143 /** Set plannerparams value.
2144  * Planner parameters
2145  * @param new_plannerparams new plannerparams value
2146  */
2147 void
2149 {
2150  change_field(data->plannerparams, new_plannerparams);
2151 }
2152 
2153 /** Get straight value.
2154  * Parameters for straight movement?
2155  * @return straight value
2156  */
2157 bool
2159 {
2160  return data->straight;
2161 }
2162 
2163 /** Get maximum length of straight value.
2164  * @return length of straight value, can be length of the array or number of
2165  * maximum number of characters for a string
2166  */
2167 size_t
2169 {
2170  return 1;
2171 }
2172 
2173 /** Set straight value.
2174  * Parameters for straight movement?
2175  * @param new_straight new straight value
2176  */
2177 void
2179 {
2180  change_field(data->straight, new_straight);
2181 }
2182 
2183 /** Clone this message.
2184  * Produces a message of the same type as this message and copies the
2185  * data to the new message.
2186  * @return clone of this message
2187  */
2188 Message *
2190 {
2192 }
2193 /** @class KatanaInterface::SetMotorEncoderMessage <interfaces/KatanaInterface.h>
2194  * SetMotorEncoderMessage Fawkes BlackBoard Interface Message.
2195  *
2196 
2197  */
2198 
2199 
2200 /** Constructor with initial values.
2201  * @param ini_nr initial value for nr
2202  * @param ini_enc initial value for enc
2203  */
2204 KatanaInterface::SetMotorEncoderMessage::SetMotorEncoderMessage(const uint32_t ini_nr, const uint32_t ini_enc) : Message("SetMotorEncoderMessage")
2205 {
2206  data_size = sizeof(SetMotorEncoderMessage_data_t);
2207  data_ptr = malloc(data_size);
2208  memset(data_ptr, 0, data_size);
2209  data = (SetMotorEncoderMessage_data_t *)data_ptr;
2211  data->nr = ini_nr;
2212  data->enc = ini_enc;
2213  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2214  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2215 }
2216 /** Constructor */
2218 {
2219  data_size = sizeof(SetMotorEncoderMessage_data_t);
2220  data_ptr = malloc(data_size);
2221  memset(data_ptr, 0, data_size);
2222  data = (SetMotorEncoderMessage_data_t *)data_ptr;
2224  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2225  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2226 }
2227 
2228 /** Destructor */
2230 {
2231  free(data_ptr);
2232 }
2233 
2234 /** Copy constructor.
2235  * @param m message to copy from
2236  */
2238 {
2239  data_size = m->data_size;
2240  data_ptr = malloc(data_size);
2241  memcpy(data_ptr, m->data_ptr, data_size);
2242  data = (SetMotorEncoderMessage_data_t *)data_ptr;
2244 }
2245 
2246 /* Methods */
2247 /** Get nr value.
2248  * Motor number
2249  * @return nr value
2250  */
2251 uint32_t
2253 {
2254  return data->nr;
2255 }
2256 
2257 /** Get maximum length of nr value.
2258  * @return length of nr value, can be length of the array or number of
2259  * maximum number of characters for a string
2260  */
2261 size_t
2263 {
2264  return 1;
2265 }
2266 
2267 /** Set nr value.
2268  * Motor number
2269  * @param new_nr new nr value
2270  */
2271 void
2273 {
2274  change_field(data->nr, new_nr);
2275 }
2276 
2277 /** Get enc value.
2278  * Encoder value
2279  * @return enc value
2280  */
2281 uint32_t
2283 {
2284  return data->enc;
2285 }
2286 
2287 /** Get maximum length of enc value.
2288  * @return length of enc value, can be length of the array or number of
2289  * maximum number of characters for a string
2290  */
2291 size_t
2293 {
2294  return 1;
2295 }
2296 
2297 /** Set enc value.
2298  * Encoder value
2299  * @param new_enc new enc value
2300  */
2301 void
2303 {
2304  change_field(data->enc, new_enc);
2305 }
2306 
2307 /** Clone this message.
2308  * Produces a message of the same type as this message and copies the
2309  * data to the new message.
2310  * @return clone of this message
2311  */
2312 Message *
2314 {
2315  return new KatanaInterface::SetMotorEncoderMessage(this);
2316 }
2317 /** @class KatanaInterface::MoveMotorEncoderMessage <interfaces/KatanaInterface.h>
2318  * MoveMotorEncoderMessage Fawkes BlackBoard Interface Message.
2319  *
2320 
2321  */
2322 
2323 
2324 /** Constructor with initial values.
2325  * @param ini_nr initial value for nr
2326  * @param ini_enc initial value for enc
2327  */
2328 KatanaInterface::MoveMotorEncoderMessage::MoveMotorEncoderMessage(const uint32_t ini_nr, const uint32_t ini_enc) : Message("MoveMotorEncoderMessage")
2329 {
2330  data_size = sizeof(MoveMotorEncoderMessage_data_t);
2331  data_ptr = malloc(data_size);
2332  memset(data_ptr, 0, data_size);
2333  data = (MoveMotorEncoderMessage_data_t *)data_ptr;
2335  data->nr = ini_nr;
2336  data->enc = ini_enc;
2337  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2338  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2339 }
2340 /** Constructor */
2342 {
2343  data_size = sizeof(MoveMotorEncoderMessage_data_t);
2344  data_ptr = malloc(data_size);
2345  memset(data_ptr, 0, data_size);
2346  data = (MoveMotorEncoderMessage_data_t *)data_ptr;
2348  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2349  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2350 }
2351 
2352 /** Destructor */
2354 {
2355  free(data_ptr);
2356 }
2357 
2358 /** Copy constructor.
2359  * @param m message to copy from
2360  */
2362 {
2363  data_size = m->data_size;
2364  data_ptr = malloc(data_size);
2365  memcpy(data_ptr, m->data_ptr, data_size);
2366  data = (MoveMotorEncoderMessage_data_t *)data_ptr;
2368 }
2369 
2370 /* Methods */
2371 /** Get nr value.
2372  * Motor number
2373  * @return nr value
2374  */
2375 uint32_t
2377 {
2378  return data->nr;
2379 }
2380 
2381 /** Get maximum length of nr value.
2382  * @return length of nr value, can be length of the array or number of
2383  * maximum number of characters for a string
2384  */
2385 size_t
2387 {
2388  return 1;
2389 }
2390 
2391 /** Set nr value.
2392  * Motor number
2393  * @param new_nr new nr value
2394  */
2395 void
2397 {
2398  change_field(data->nr, new_nr);
2399 }
2400 
2401 /** Get enc value.
2402  * Encoder value
2403  * @return enc value
2404  */
2405 uint32_t
2407 {
2408  return data->enc;
2409 }
2410 
2411 /** Get maximum length of enc value.
2412  * @return length of enc value, can be length of the array or number of
2413  * maximum number of characters for a string
2414  */
2415 size_t
2417 {
2418  return 1;
2419 }
2420 
2421 /** Set enc value.
2422  * Encoder value
2423  * @param new_enc new enc value
2424  */
2425 void
2427 {
2428  change_field(data->enc, new_enc);
2429 }
2430 
2431 /** Clone this message.
2432  * Produces a message of the same type as this message and copies the
2433  * data to the new message.
2434  * @return clone of this message
2435  */
2436 Message *
2438 {
2440 }
2441 /** @class KatanaInterface::SetMotorAngleMessage <interfaces/KatanaInterface.h>
2442  * SetMotorAngleMessage Fawkes BlackBoard Interface Message.
2443  *
2444 
2445  */
2446 
2447 
2448 /** Constructor with initial values.
2449  * @param ini_nr initial value for nr
2450  * @param ini_angle initial value for angle
2451  */
2452 KatanaInterface::SetMotorAngleMessage::SetMotorAngleMessage(const uint32_t ini_nr, const float ini_angle) : Message("SetMotorAngleMessage")
2453 {
2454  data_size = sizeof(SetMotorAngleMessage_data_t);
2455  data_ptr = malloc(data_size);
2456  memset(data_ptr, 0, data_size);
2457  data = (SetMotorAngleMessage_data_t *)data_ptr;
2459  data->nr = ini_nr;
2460  data->angle = ini_angle;
2461  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2462  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2463 }
2464 /** Constructor */
2466 {
2467  data_size = sizeof(SetMotorAngleMessage_data_t);
2468  data_ptr = malloc(data_size);
2469  memset(data_ptr, 0, data_size);
2470  data = (SetMotorAngleMessage_data_t *)data_ptr;
2472  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2473  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2474 }
2475 
2476 /** Destructor */
2478 {
2479  free(data_ptr);
2480 }
2481 
2482 /** Copy constructor.
2483  * @param m message to copy from
2484  */
2486 {
2487  data_size = m->data_size;
2488  data_ptr = malloc(data_size);
2489  memcpy(data_ptr, m->data_ptr, data_size);
2490  data = (SetMotorAngleMessage_data_t *)data_ptr;
2492 }
2493 
2494 /* Methods */
2495 /** Get nr value.
2496  * Motor number
2497  * @return nr value
2498  */
2499 uint32_t
2501 {
2502  return data->nr;
2503 }
2504 
2505 /** Get maximum length of nr value.
2506  * @return length of nr value, can be length of the array or number of
2507  * maximum number of characters for a string
2508  */
2509 size_t
2511 {
2512  return 1;
2513 }
2514 
2515 /** Set nr value.
2516  * Motor number
2517  * @param new_nr new nr value
2518  */
2519 void
2521 {
2522  change_field(data->nr, new_nr);
2523 }
2524 
2525 /** Get angle value.
2526  * Angle value (positive: increase; negative: decrease)
2527  * @return angle value
2528  */
2529 float
2531 {
2532  return data->angle;
2533 }
2534 
2535 /** Get maximum length of angle value.
2536  * @return length of angle value, can be length of the array or number of
2537  * maximum number of characters for a string
2538  */
2539 size_t
2541 {
2542  return 1;
2543 }
2544 
2545 /** Set angle value.
2546  * Angle value (positive: increase; negative: decrease)
2547  * @param new_angle new angle value
2548  */
2549 void
2551 {
2552  change_field(data->angle, new_angle);
2553 }
2554 
2555 /** Clone this message.
2556  * Produces a message of the same type as this message and copies the
2557  * data to the new message.
2558  * @return clone of this message
2559  */
2560 Message *
2562 {
2563  return new KatanaInterface::SetMotorAngleMessage(this);
2564 }
2565 /** @class KatanaInterface::MoveMotorAngleMessage <interfaces/KatanaInterface.h>
2566  * MoveMotorAngleMessage Fawkes BlackBoard Interface Message.
2567  *
2568 
2569  */
2570 
2571 
2572 /** Constructor with initial values.
2573  * @param ini_nr initial value for nr
2574  * @param ini_angle initial value for angle
2575  */
2576 KatanaInterface::MoveMotorAngleMessage::MoveMotorAngleMessage(const uint32_t ini_nr, const float ini_angle) : Message("MoveMotorAngleMessage")
2577 {
2578  data_size = sizeof(MoveMotorAngleMessage_data_t);
2579  data_ptr = malloc(data_size);
2580  memset(data_ptr, 0, data_size);
2581  data = (MoveMotorAngleMessage_data_t *)data_ptr;
2583  data->nr = ini_nr;
2584  data->angle = ini_angle;
2585  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2586  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2587 }
2588 /** Constructor */
2590 {
2591  data_size = sizeof(MoveMotorAngleMessage_data_t);
2592  data_ptr = malloc(data_size);
2593  memset(data_ptr, 0, data_size);
2594  data = (MoveMotorAngleMessage_data_t *)data_ptr;
2596  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2597  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2598 }
2599 
2600 /** Destructor */
2602 {
2603  free(data_ptr);
2604 }
2605 
2606 /** Copy constructor.
2607  * @param m message to copy from
2608  */
2610 {
2611  data_size = m->data_size;
2612  data_ptr = malloc(data_size);
2613  memcpy(data_ptr, m->data_ptr, data_size);
2614  data = (MoveMotorAngleMessage_data_t *)data_ptr;
2616 }
2617 
2618 /* Methods */
2619 /** Get nr value.
2620  * Motor number
2621  * @return nr value
2622  */
2623 uint32_t
2625 {
2626  return data->nr;
2627 }
2628 
2629 /** Get maximum length of nr value.
2630  * @return length of nr value, can be length of the array or number of
2631  * maximum number of characters for a string
2632  */
2633 size_t
2635 {
2636  return 1;
2637 }
2638 
2639 /** Set nr value.
2640  * Motor number
2641  * @param new_nr new nr value
2642  */
2643 void
2645 {
2646  change_field(data->nr, new_nr);
2647 }
2648 
2649 /** Get angle value.
2650  * Angle value (positive: increase; negative: decrease)
2651  * @return angle value
2652  */
2653 float
2655 {
2656  return data->angle;
2657 }
2658 
2659 /** Get maximum length of angle value.
2660  * @return length of angle value, can be length of the array or number of
2661  * maximum number of characters for a string
2662  */
2663 size_t
2665 {
2666  return 1;
2667 }
2668 
2669 /** Set angle value.
2670  * Angle value (positive: increase; negative: decrease)
2671  * @param new_angle new angle value
2672  */
2673 void
2675 {
2676  change_field(data->angle, new_angle);
2677 }
2678 
2679 /** Clone this message.
2680  * Produces a message of the same type as this message and copies the
2681  * data to the new message.
2682  * @return clone of this message
2683  */
2684 Message *
2686 {
2687  return new KatanaInterface::MoveMotorAngleMessage(this);
2688 }
2689 /** Check if message is valid and can be enqueued.
2690  * @param message Message to check
2691  * @return true if the message is valid, false otherwise.
2692  */
2693 bool
2695 {
2696  const StopMessage *m0 = dynamic_cast<const StopMessage *>(message);
2697  if ( m0 != NULL ) {
2698  return true;
2699  }
2700  const FlushMessage *m1 = dynamic_cast<const FlushMessage *>(message);
2701  if ( m1 != NULL ) {
2702  return true;
2703  }
2704  const ParkMessage *m2 = dynamic_cast<const ParkMessage *>(message);
2705  if ( m2 != NULL ) {
2706  return true;
2707  }
2708  const LinearGotoMessage *m3 = dynamic_cast<const LinearGotoMessage *>(message);
2709  if ( m3 != NULL ) {
2710  return true;
2711  }
2712  const LinearGotoKniMessage *m4 = dynamic_cast<const LinearGotoKniMessage *>(message);
2713  if ( m4 != NULL ) {
2714  return true;
2715  }
2716  const ObjectGotoMessage *m5 = dynamic_cast<const ObjectGotoMessage *>(message);
2717  if ( m5 != NULL ) {
2718  return true;
2719  }
2720  const CalibrateMessage *m6 = dynamic_cast<const CalibrateMessage *>(message);
2721  if ( m6 != NULL ) {
2722  return true;
2723  }
2724  const OpenGripperMessage *m7 = dynamic_cast<const OpenGripperMessage *>(message);
2725  if ( m7 != NULL ) {
2726  return true;
2727  }
2728  const CloseGripperMessage *m8 = dynamic_cast<const CloseGripperMessage *>(message);
2729  if ( m8 != NULL ) {
2730  return true;
2731  }
2732  const SetEnabledMessage *m9 = dynamic_cast<const SetEnabledMessage *>(message);
2733  if ( m9 != NULL ) {
2734  return true;
2735  }
2736  const SetMaxVelocityMessage *m10 = dynamic_cast<const SetMaxVelocityMessage *>(message);
2737  if ( m10 != NULL ) {
2738  return true;
2739  }
2740  const SetPlannerParamsMessage *m11 = dynamic_cast<const SetPlannerParamsMessage *>(message);
2741  if ( m11 != NULL ) {
2742  return true;
2743  }
2744  const SetMotorEncoderMessage *m12 = dynamic_cast<const SetMotorEncoderMessage *>(message);
2745  if ( m12 != NULL ) {
2746  return true;
2747  }
2748  const MoveMotorEncoderMessage *m13 = dynamic_cast<const MoveMotorEncoderMessage *>(message);
2749  if ( m13 != NULL ) {
2750  return true;
2751  }
2752  const SetMotorAngleMessage *m14 = dynamic_cast<const SetMotorAngleMessage *>(message);
2753  if ( m14 != NULL ) {
2754  return true;
2755  }
2756  const MoveMotorAngleMessage *m15 = dynamic_cast<const MoveMotorAngleMessage *>(message);
2757  if ( m15 != NULL ) {
2758  return true;
2759  }
2760  return false;
2761 }
2762 
2763 /// @cond INTERNALS
2764 EXPORT_INTERFACE(KatanaInterface)
2765 /// @endcond
2766 
2767 
2768 } // end namespace fawkes
Base class for exceptions in Fawkes.
Definition: exception.h:36
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
const char * type() const
Get type of interface.
Definition: interface.cpp:643
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:224
CalibrateMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
CloseGripperMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
FlushMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
LinearGotoKniMessage Fawkes BlackBoard Interface Message.
void set_y(const float new_y)
Set y value.
void set_phi(const float new_phi)
Set phi value.
void set_z(const float new_z)
Set z value.
void set_psi(const float new_psi)
Set psi value.
size_t maxlenof_theta() const
Get maximum length of theta 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_y() const
Get maximum length of y value.
void set_x(const float new_x)
Set x value.
size_t maxlenof_phi() const
Get maximum length of phi value.
size_t maxlenof_psi() const
Get maximum length of psi value.
void set_theta(const float new_theta)
Set theta value.
virtual Message * clone() const
Clone this message.
LinearGotoMessage Fawkes BlackBoard Interface Message.
void set_phi(const float new_phi)
Set phi value.
void set_rot_frame(const char *new_rot_frame)
Set rot_frame value.
char * trans_frame() const
Get trans_frame value.
size_t maxlenof_trans_frame() const
Get maximum length of trans_frame value.
float offset_xy() const
Get offset_xy value.
void set_x(const float new_x)
Set x value.
void set_y(const float new_y)
Set y 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_rot_frame() const
Get maximum length of rot_frame value.
size_t maxlenof_y() const
Get maximum length of y value.
virtual Message * clone() const
Clone this message.
float theta_error() const
Get theta_error value.
char * rot_frame() const
Get rot_frame value.
size_t maxlenof_theta() const
Get maximum length of theta value.
void set_trans_frame(const char *new_trans_frame)
Set trans_frame value.
void set_offset_xy(const float new_offset_xy)
Set offset_xy value.
size_t maxlenof_straight() const
Get maximum length of straight value.
size_t maxlenof_theta_error() const
Get maximum length of theta_error value.
void set_z(const float new_z)
Set z value.
void set_theta(const float new_theta)
Set theta value.
void set_theta_error(const float new_theta_error)
Set theta_error value.
size_t maxlenof_offset_xy() const
Get maximum length of offset_xy value.
size_t maxlenof_phi() const
Get maximum length of phi value.
void set_straight(const bool new_straight)
Set straight value.
void set_psi(const float new_psi)
Set psi value.
size_t maxlenof_psi() const
Get maximum length of psi value.
bool is_straight() const
Get straight value.
MoveMotorAngleMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_angle() const
Get maximum length of angle value.
void set_angle(const float new_angle)
Set angle value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_nr() const
Get maximum length of nr value.
void set_nr(const uint32_t new_nr)
Set nr value.
MoveMotorEncoderMessage Fawkes BlackBoard Interface Message.
void set_nr(const uint32_t new_nr)
Set nr value.
virtual Message * clone() const
Clone this message.
void set_enc(const uint32_t new_enc)
Set enc value.
size_t maxlenof_nr() const
Get maximum length of nr value.
size_t maxlenof_enc() const
Get maximum length of enc value.
ObjectGotoMessage Fawkes BlackBoard Interface Message.
void set_object(const char *new_object)
Set object value.
size_t maxlenof_object() const
Get maximum length of object value.
char * object() const
Get object value.
void set_rot_x(const float new_rot_x)
Set rot_x value.
size_t maxlenof_rot_x() const
Get maximum length of rot_x value.
virtual Message * clone() const
Clone this message.
OpenGripperMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
ParkMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
SetEnabledMessage Fawkes BlackBoard Interface Message.
bool is_enabled() const
Get enabled value.
void set_enabled(const bool new_enabled)
Set enabled value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_enabled() const
Get maximum length of enabled value.
SetMaxVelocityMessage Fawkes BlackBoard Interface Message.
void set_max_velocity(const uint8_t new_max_velocity)
Set max_velocity value.
virtual Message * clone() const
Clone this message.
uint8_t max_velocity() const
Get max_velocity value.
size_t maxlenof_max_velocity() const
Get maximum length of max_velocity value.
SetMotorAngleMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
size_t maxlenof_nr() const
Get maximum length of nr value.
size_t maxlenof_angle() const
Get maximum length of angle value.
void set_angle(const float new_angle)
Set angle value.
void set_nr(const uint32_t new_nr)
Set nr value.
SetMotorEncoderMessage Fawkes BlackBoard Interface Message.
void set_nr(const uint32_t new_nr)
Set nr value.
size_t maxlenof_enc() const
Get maximum length of enc value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_nr() const
Get maximum length of nr value.
void set_enc(const uint32_t new_enc)
Set enc value.
SetPlannerParamsMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_straight() const
Get maximum length of straight value.
size_t maxlenof_plannerparams() const
Get maximum length of plannerparams value.
void set_plannerparams(const char *new_plannerparams)
Set plannerparams value.
char * plannerparams() const
Get plannerparams value.
virtual Message * clone() const
Clone this message.
void set_straight(const bool new_straight)
Set straight value.
StopMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
KatanaInterface Fawkes BlackBoard Interface.
static const uint32_t ERROR_NO_SOLUTION
ERROR_NO_SOLUTION constant.
static const uint32_t ERROR_COMMUNICATION
ERROR_COMMUNICATION constant.
static const uint32_t SENSOR_IR_LEFT_OUTER_FRONT
SENSOR_IR_LEFT_OUTER_FRONT constant.
static const uint32_t SENSOR_IR_RIGHT_OUTER_FRONT
SENSOR_IR_RIGHT_OUTER_FRONT constant.
static const uint32_t SENSOR_IR_RIGHT_BOTTOM_FRONT
SENSOR_IR_RIGHT_BOTTOM_FRONT constant.
static const uint32_t SENSOR_IR_CENTER_GRIPPER
SENSOR_IR_CENTER_GRIPPER constant.
static const uint32_t SENSOR_IR_LEFT_INNER_MIDDLE
SENSOR_IR_LEFT_INNER_MIDDLE constant.
static const uint32_t ERROR_NONE
ERROR_NONE constant.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
static const uint32_t ERROR_MOTOR_CRASHED
ERROR_MOTOR_CRASHED constant.
static const uint32_t SENSOR_RESERVED_2
SENSOR_RESERVED_2 constant.
static const uint32_t SENSOR_FORCE_LEFT_REAR
SENSOR_FORCE_LEFT_REAR constant.
static const uint32_t SENSOR_IR_RIGHT_INNER_MIDDLE
SENSOR_IR_RIGHT_INNER_MIDDLE constant.
static const uint32_t SENSOR_IR_LEFT_BOTTOM_FRONT
SENSOR_IR_LEFT_BOTTOM_FRONT constant.
static const uint32_t SENSOR_FORCE_LEFT_FRONT
SENSOR_FORCE_LEFT_FRONT constant.
static const uint32_t SENSOR_RESERVED_10
SENSOR_RESERVED_10 constant.
static const uint32_t SENSOR_FORCE_RIGHT_FRONT
SENSOR_FORCE_RIGHT_FRONT constant.
static const uint32_t SENSOR_IR_RIGHT_INNER_FRONT
SENSOR_IR_RIGHT_INNER_FRONT constant.
static const uint32_t ERROR_CMD_START_FAILED
ERROR_CMD_START_FAILED constant.
static const uint32_t SENSOR_COND_BOTH
SENSOR_COND_BOTH constant.
static const uint32_t ERROR_UNSPECIFIC
ERROR_UNSPECIFIC constant.
static const uint32_t SENSOR_IR_LEFT_INNER_FRONT
SENSOR_IR_LEFT_INNER_FRONT constant.
static const uint32_t SENSOR_FORCE_RIGHT_REAR
SENSOR_FORCE_RIGHT_REAR constant.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:45
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
Definition: message.cpp:400
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:128
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:138
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:129
Fawkes library namespace.
@ IFT_UINT32
32 bit unsigned integer field
Definition: types.h:43
@ IFT_FLOAT
float field
Definition: types.h:46
@ IFT_BYTE
byte field, alias for uint8
Definition: types.h:49
@ IFT_STRING
string field
Definition: types.h:48
@ IFT_BOOL
boolean field
Definition: types.h:37
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
Definition: message.h:167
Timestamp data, must be present and first entries for each interface data structs!...
Definition: message.h:134