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