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