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-1);
974  data->trans_frame[32-1] = 0;
975  strncpy(data->rot_frame, ini_rot_frame, 32-1);
976  data->rot_frame[32-1] = 0;
977  data->x = ini_x;
978  data->y = ini_y;
979  data->z = ini_z;
980  data->phi = ini_phi;
981  data->theta = ini_theta;
982  data->psi = ini_psi;
983  add_fieldinfo(IFT_FLOAT, "theta_error", 1, &data->theta_error);
984  add_fieldinfo(IFT_FLOAT, "offset_xy", 1, &data->offset_xy);
985  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
986  add_fieldinfo(IFT_STRING, "trans_frame", 32, data->trans_frame);
987  add_fieldinfo(IFT_STRING, "rot_frame", 32, data->rot_frame);
988  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
989  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
990  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
991  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
992  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
993  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
994 }
995 /** Constructor */
997 {
998  data_size = sizeof(LinearGotoMessage_data_t);
999  data_ptr = malloc(data_size);
1000  memset(data_ptr, 0, data_size);
1001  data = (LinearGotoMessage_data_t *)data_ptr;
1003  add_fieldinfo(IFT_FLOAT, "theta_error", 1, &data->theta_error);
1004  add_fieldinfo(IFT_FLOAT, "offset_xy", 1, &data->offset_xy);
1005  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
1006  add_fieldinfo(IFT_STRING, "trans_frame", 32, data->trans_frame);
1007  add_fieldinfo(IFT_STRING, "rot_frame", 32, data->rot_frame);
1008  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1009  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1010  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
1011  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
1012  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
1013  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
1014 }
1015 
1016 /** Destructor */
1018 {
1019  free(data_ptr);
1020 }
1021 
1022 /** Copy constructor.
1023  * @param m message to copy from
1024  */
1026 {
1027  data_size = m->data_size;
1028  data_ptr = malloc(data_size);
1029  memcpy(data_ptr, m->data_ptr, data_size);
1030  data = (LinearGotoMessage_data_t *)data_ptr;
1032 }
1033 
1034 /* Methods */
1035 /** Get theta_error value.
1036  * Error range of theta rotation, gives more flexibility
1037  for IK-solution searching.
1038  * @return theta_error value
1039  */
1040 float
1042 {
1043  return data->theta_error;
1044 }
1045 
1046 /** Get maximum length of theta_error value.
1047  * @return length of theta_error value, can be length of the array or number of
1048  * maximum number of characters for a string
1049  */
1050 size_t
1052 {
1053  return 1;
1054 }
1055 
1056 /** Set theta_error value.
1057  * Error range of theta rotation, gives more flexibility
1058  for IK-solution searching.
1059  * @param new_theta_error new theta_error value
1060  */
1061 void
1063 {
1064  data->theta_error = new_theta_error;
1065 }
1066 
1067 /** Get offset_xy value.
1068  * Offset to target. Distance in m (on the way to the target)
1069  * @return offset_xy value
1070  */
1071 float
1073 {
1074  return data->offset_xy;
1075 }
1076 
1077 /** Get maximum length of offset_xy value.
1078  * @return length of offset_xy value, can be length of the array or number of
1079  * maximum number of characters for a string
1080  */
1081 size_t
1083 {
1084  return 1;
1085 }
1086 
1087 /** Set offset_xy value.
1088  * Offset to target. Distance in m (on the way to the target)
1089  * @param new_offset_xy new offset_xy value
1090  */
1091 void
1093 {
1094  data->offset_xy = new_offset_xy;
1095 }
1096 
1097 /** Get straight value.
1098  * Move in a straight line?
1099  * @return straight value
1100  */
1101 bool
1103 {
1104  return data->straight;
1105 }
1106 
1107 /** Get maximum length of straight value.
1108  * @return length of straight value, can be length of the array or number of
1109  * maximum number of characters for a string
1110  */
1111 size_t
1113 {
1114  return 1;
1115 }
1116 
1117 /** Set straight value.
1118  * Move in a straight line?
1119  * @param new_straight new straight value
1120  */
1121 void
1123 {
1124  data->straight = new_straight;
1125 }
1126 
1127 /** Get trans_frame value.
1128  * tf frame-id of origin's coordinate system,
1129  regarding the translation
1130  * @return trans_frame value
1131  */
1132 char *
1134 {
1135  return data->trans_frame;
1136 }
1137 
1138 /** Get maximum length of trans_frame value.
1139  * @return length of trans_frame value, can be length of the array or number of
1140  * maximum number of characters for a string
1141  */
1142 size_t
1144 {
1145  return 32;
1146 }
1147 
1148 /** Set trans_frame value.
1149  * tf frame-id of origin's coordinate system,
1150  regarding the translation
1151  * @param new_trans_frame new trans_frame value
1152  */
1153 void
1155 {
1156  strncpy(data->trans_frame, new_trans_frame, sizeof(data->trans_frame)-1);
1157  data->trans_frame[sizeof(data->trans_frame)-1] = 0;
1158 }
1159 
1160 /** Get rot_frame value.
1161  * tf frame-id of origin's coordinate system,
1162  regarding the rotation. In most cases, this is the robot's base coordinate system.
1163  * @return rot_frame value
1164  */
1165 char *
1167 {
1168  return data->rot_frame;
1169 }
1170 
1171 /** Get maximum length of rot_frame value.
1172  * @return length of rot_frame value, can be length of the array or number of
1173  * maximum number of characters for a string
1174  */
1175 size_t
1177 {
1178  return 32;
1179 }
1180 
1181 /** Set rot_frame value.
1182  * tf frame-id of origin's coordinate system,
1183  regarding the rotation. In most cases, this is the robot's base coordinate system.
1184  * @param new_rot_frame new rot_frame value
1185  */
1186 void
1188 {
1189  strncpy(data->rot_frame, new_rot_frame, sizeof(data->rot_frame)-1);
1190  data->rot_frame[sizeof(data->rot_frame)-1] = 0;
1191 }
1192 
1193 /** Get x value.
1194  * DEPRECATED! X-Coordinate for tool position
1195  compared to base coordinate system.
1196  * @return x value
1197  */
1198 float
1200 {
1201  return data->x;
1202 }
1203 
1204 /** Get maximum length of x value.
1205  * @return length of x value, can be length of the array or number of
1206  * maximum number of characters for a string
1207  */
1208 size_t
1210 {
1211  return 1;
1212 }
1213 
1214 /** Set x value.
1215  * DEPRECATED! X-Coordinate for tool position
1216  compared to base coordinate system.
1217  * @param new_x new x value
1218  */
1219 void
1221 {
1222  data->x = new_x;
1223 }
1224 
1225 /** Get y value.
1226  * DEPRECATED! Y-Coordinate for tool position
1227  compared to base coordinate system.
1228  * @return y value
1229  */
1230 float
1232 {
1233  return data->y;
1234 }
1235 
1236 /** Get maximum length of y value.
1237  * @return length of y value, can be length of the array or number of
1238  * maximum number of characters for a string
1239  */
1240 size_t
1242 {
1243  return 1;
1244 }
1245 
1246 /** Set y value.
1247  * DEPRECATED! Y-Coordinate for tool position
1248  compared to base coordinate system.
1249  * @param new_y new y value
1250  */
1251 void
1253 {
1254  data->y = new_y;
1255 }
1256 
1257 /** Get z value.
1258  * DEPRECATED! Z-Coordinate for tool position
1259  compared to base coordinate system.
1260  * @return z value
1261  */
1262 float
1264 {
1265  return data->z;
1266 }
1267 
1268 /** Get maximum length of z value.
1269  * @return length of z value, can be length of the array or number of
1270  * maximum number of characters for a string
1271  */
1272 size_t
1274 {
1275  return 1;
1276 }
1277 
1278 /** Set z value.
1279  * DEPRECATED! Z-Coordinate for tool position
1280  compared to base coordinate system.
1281  * @param new_z new z value
1282  */
1283 void
1285 {
1286  data->z = new_z;
1287 }
1288 
1289 /** Get phi value.
1290  * DEPRECATED! Euler angle Phi of tool orientation.
1291  * @return phi value
1292  */
1293 float
1295 {
1296  return data->phi;
1297 }
1298 
1299 /** Get maximum length of phi value.
1300  * @return length of phi value, can be length of the array or number of
1301  * maximum number of characters for a string
1302  */
1303 size_t
1305 {
1306  return 1;
1307 }
1308 
1309 /** Set phi value.
1310  * DEPRECATED! Euler angle Phi of tool orientation.
1311  * @param new_phi new phi value
1312  */
1313 void
1315 {
1316  data->phi = new_phi;
1317 }
1318 
1319 /** Get theta value.
1320  * DEPRECATED! Euler angle Theta of tool orientation.
1321  * @return theta value
1322  */
1323 float
1325 {
1326  return data->theta;
1327 }
1328 
1329 /** Get maximum length of theta value.
1330  * @return length of theta value, can be length of the array or number of
1331  * maximum number of characters for a string
1332  */
1333 size_t
1335 {
1336  return 1;
1337 }
1338 
1339 /** Set theta value.
1340  * DEPRECATED! Euler angle Theta of tool orientation.
1341  * @param new_theta new theta value
1342  */
1343 void
1345 {
1346  data->theta = new_theta;
1347 }
1348 
1349 /** Get psi value.
1350  * DEPRECATED! Euler angle Psi of tool orientation.
1351  * @return psi value
1352  */
1353 float
1355 {
1356  return data->psi;
1357 }
1358 
1359 /** Get maximum length of psi value.
1360  * @return length of psi value, can be length of the array or number of
1361  * maximum number of characters for a string
1362  */
1363 size_t
1365 {
1366  return 1;
1367 }
1368 
1369 /** Set psi value.
1370  * DEPRECATED! Euler angle Psi of tool orientation.
1371  * @param new_psi new psi value
1372  */
1373 void
1375 {
1376  data->psi = new_psi;
1377 }
1378 
1379 /** Clone this message.
1380  * Produces a message of the same type as this message and copies the
1381  * data to the new message.
1382  * @return clone of this message
1383  */
1384 Message *
1386 {
1387  return new KatanaInterface::LinearGotoMessage(this);
1388 }
1389 /** @class KatanaInterface::LinearGotoKniMessage <interfaces/KatanaInterface.h>
1390  * LinearGotoKniMessage Fawkes BlackBoard Interface Message.
1391  *
1392 
1393  */
1394 
1395 
1396 /** Constructor with initial values.
1397  * @param ini_x initial value for x
1398  * @param ini_y initial value for y
1399  * @param ini_z initial value for z
1400  * @param ini_phi initial value for phi
1401  * @param ini_theta initial value for theta
1402  * @param ini_psi initial value for psi
1403  */
1404 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")
1405 {
1406  data_size = sizeof(LinearGotoKniMessage_data_t);
1407  data_ptr = malloc(data_size);
1408  memset(data_ptr, 0, data_size);
1409  data = (LinearGotoKniMessage_data_t *)data_ptr;
1411  data->x = ini_x;
1412  data->y = ini_y;
1413  data->z = ini_z;
1414  data->phi = ini_phi;
1415  data->theta = ini_theta;
1416  data->psi = ini_psi;
1417  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1418  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1419  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
1420  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
1421  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
1422  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
1423 }
1424 /** Constructor */
1426 {
1427  data_size = sizeof(LinearGotoKniMessage_data_t);
1428  data_ptr = malloc(data_size);
1429  memset(data_ptr, 0, data_size);
1430  data = (LinearGotoKniMessage_data_t *)data_ptr;
1432  add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
1433  add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
1434  add_fieldinfo(IFT_FLOAT, "z", 1, &data->z);
1435  add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
1436  add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta);
1437  add_fieldinfo(IFT_FLOAT, "psi", 1, &data->psi);
1438 }
1439 
1440 /** Destructor */
1442 {
1443  free(data_ptr);
1444 }
1445 
1446 /** Copy constructor.
1447  * @param m message to copy from
1448  */
1450 {
1451  data_size = m->data_size;
1452  data_ptr = malloc(data_size);
1453  memcpy(data_ptr, m->data_ptr, data_size);
1454  data = (LinearGotoKniMessage_data_t *)data_ptr;
1456 }
1457 
1458 /* Methods */
1459 /** Get x value.
1460  * X-Coordinate for tool position
1461  compared to base libkni coordinate system.
1462  * @return x value
1463  */
1464 float
1466 {
1467  return data->x;
1468 }
1469 
1470 /** Get maximum length of x value.
1471  * @return length of x value, can be length of the array or number of
1472  * maximum number of characters for a string
1473  */
1474 size_t
1476 {
1477  return 1;
1478 }
1479 
1480 /** Set x value.
1481  * X-Coordinate for tool position
1482  compared to base libkni coordinate system.
1483  * @param new_x new x value
1484  */
1485 void
1487 {
1488  data->x = new_x;
1489 }
1490 
1491 /** Get y value.
1492  * Y-Coordinate for tool position
1493  compared to base libkni coordinate system.
1494  * @return y value
1495  */
1496 float
1498 {
1499  return data->y;
1500 }
1501 
1502 /** Get maximum length of y value.
1503  * @return length of y value, can be length of the array or number of
1504  * maximum number of characters for a string
1505  */
1506 size_t
1508 {
1509  return 1;
1510 }
1511 
1512 /** Set y value.
1513  * Y-Coordinate for tool position
1514  compared to base libkni coordinate system.
1515  * @param new_y new y value
1516  */
1517 void
1519 {
1520  data->y = new_y;
1521 }
1522 
1523 /** Get z value.
1524  * Z-Coordinate for tool position
1525  compared to base libkni coordinate system.
1526  * @return z value
1527  */
1528 float
1530 {
1531  return data->z;
1532 }
1533 
1534 /** Get maximum length of z value.
1535  * @return length of z value, can be length of the array or number of
1536  * maximum number of characters for a string
1537  */
1538 size_t
1540 {
1541  return 1;
1542 }
1543 
1544 /** Set z value.
1545  * Z-Coordinate for tool position
1546  compared to base libkni coordinate system.
1547  * @param new_z new z value
1548  */
1549 void
1551 {
1552  data->z = new_z;
1553 }
1554 
1555 /** Get phi value.
1556  * Euler angle Phi of tool orientation.
1557  * @return phi value
1558  */
1559 float
1561 {
1562  return data->phi;
1563 }
1564 
1565 /** Get maximum length of phi value.
1566  * @return length of phi value, can be length of the array or number of
1567  * maximum number of characters for a string
1568  */
1569 size_t
1571 {
1572  return 1;
1573 }
1574 
1575 /** Set phi value.
1576  * Euler angle Phi of tool orientation.
1577  * @param new_phi new phi value
1578  */
1579 void
1581 {
1582  data->phi = new_phi;
1583 }
1584 
1585 /** Get theta value.
1586  * Euler angle Theta of tool orientation.
1587  * @return theta value
1588  */
1589 float
1591 {
1592  return data->theta;
1593 }
1594 
1595 /** Get maximum length of theta value.
1596  * @return length of theta value, can be length of the array or number of
1597  * maximum number of characters for a string
1598  */
1599 size_t
1601 {
1602  return 1;
1603 }
1604 
1605 /** Set theta value.
1606  * Euler angle Theta of tool orientation.
1607  * @param new_theta new theta value
1608  */
1609 void
1611 {
1612  data->theta = new_theta;
1613 }
1614 
1615 /** Get psi value.
1616  * Euler angle Psi of tool orientation.
1617  * @return psi value
1618  */
1619 float
1621 {
1622  return data->psi;
1623 }
1624 
1625 /** Get maximum length of psi value.
1626  * @return length of psi value, can be length of the array or number of
1627  * maximum number of characters for a string
1628  */
1629 size_t
1631 {
1632  return 1;
1633 }
1634 
1635 /** Set psi value.
1636  * Euler angle Psi of tool orientation.
1637  * @param new_psi new psi value
1638  */
1639 void
1641 {
1642  data->psi = new_psi;
1643 }
1644 
1645 /** Clone this message.
1646  * Produces a message of the same type as this message and copies the
1647  * data to the new message.
1648  * @return clone of this message
1649  */
1650 Message *
1652 {
1653  return new KatanaInterface::LinearGotoKniMessage(this);
1654 }
1655 /** @class KatanaInterface::ObjectGotoMessage <interfaces/KatanaInterface.h>
1656  * ObjectGotoMessage Fawkes BlackBoard Interface Message.
1657  *
1658 
1659  */
1660 
1661 
1662 /** Constructor with initial values.
1663  * @param ini_object initial value for object
1664  * @param ini_rot_x initial value for rot_x
1665  */
1666 KatanaInterface::ObjectGotoMessage::ObjectGotoMessage(const char * ini_object, const float ini_rot_x) : Message("ObjectGotoMessage")
1667 {
1668  data_size = sizeof(ObjectGotoMessage_data_t);
1669  data_ptr = malloc(data_size);
1670  memset(data_ptr, 0, data_size);
1671  data = (ObjectGotoMessage_data_t *)data_ptr;
1673  strncpy(data->object, ini_object, 32-1);
1674  data->object[32-1] = 0;
1675  data->rot_x = ini_rot_x;
1676  add_fieldinfo(IFT_STRING, "object", 32, data->object);
1677  add_fieldinfo(IFT_FLOAT, "rot_x", 1, &data->rot_x);
1678 }
1679 /** Constructor */
1681 {
1682  data_size = sizeof(ObjectGotoMessage_data_t);
1683  data_ptr = malloc(data_size);
1684  memset(data_ptr, 0, data_size);
1685  data = (ObjectGotoMessage_data_t *)data_ptr;
1687  add_fieldinfo(IFT_STRING, "object", 32, data->object);
1688  add_fieldinfo(IFT_FLOAT, "rot_x", 1, &data->rot_x);
1689 }
1690 
1691 /** Destructor */
1693 {
1694  free(data_ptr);
1695 }
1696 
1697 /** Copy constructor.
1698  * @param m message to copy from
1699  */
1701 {
1702  data_size = m->data_size;
1703  data_ptr = malloc(data_size);
1704  memcpy(data_ptr, m->data_ptr, data_size);
1705  data = (ObjectGotoMessage_data_t *)data_ptr;
1707 }
1708 
1709 /* Methods */
1710 /** Get object value.
1711  * Name of object
1712  * @return object value
1713  */
1714 char *
1716 {
1717  return data->object;
1718 }
1719 
1720 /** Get maximum length of object value.
1721  * @return length of object value, can be length of the array or number of
1722  * maximum number of characters for a string
1723  */
1724 size_t
1726 {
1727  return 32;
1728 }
1729 
1730 /** Set object value.
1731  * Name of object
1732  * @param new_object new object value
1733  */
1734 void
1736 {
1737  strncpy(data->object, new_object, sizeof(data->object)-1);
1738  data->object[sizeof(data->object)-1] = 0;
1739 }
1740 
1741 /** Get rot_x value.
1742  * Rotation of object on its x-axis
1743  * @return rot_x value
1744  */
1745 float
1747 {
1748  return data->rot_x;
1749 }
1750 
1751 /** Get maximum length of rot_x value.
1752  * @return length of rot_x value, can be length of the array or number of
1753  * maximum number of characters for a string
1754  */
1755 size_t
1757 {
1758  return 1;
1759 }
1760 
1761 /** Set rot_x value.
1762  * Rotation of object on its x-axis
1763  * @param new_rot_x new rot_x value
1764  */
1765 void
1767 {
1768  data->rot_x = new_rot_x;
1769 }
1770 
1771 /** Clone this message.
1772  * Produces a message of the same type as this message and copies the
1773  * data to the new message.
1774  * @return clone of this message
1775  */
1776 Message *
1778 {
1779  return new KatanaInterface::ObjectGotoMessage(this);
1780 }
1781 /** @class KatanaInterface::CalibrateMessage <interfaces/KatanaInterface.h>
1782  * CalibrateMessage Fawkes BlackBoard Interface Message.
1783  *
1784 
1785  */
1786 
1787 
1788 /** Constructor */
1790 {
1791  data_size = sizeof(CalibrateMessage_data_t);
1792  data_ptr = malloc(data_size);
1793  memset(data_ptr, 0, data_size);
1794  data = (CalibrateMessage_data_t *)data_ptr;
1796 }
1797 
1798 /** Destructor */
1800 {
1801  free(data_ptr);
1802 }
1803 
1804 /** Copy constructor.
1805  * @param m message to copy from
1806  */
1808 {
1809  data_size = m->data_size;
1810  data_ptr = malloc(data_size);
1811  memcpy(data_ptr, m->data_ptr, data_size);
1812  data = (CalibrateMessage_data_t *)data_ptr;
1814 }
1815 
1816 /* Methods */
1817 /** Clone this message.
1818  * Produces a message of the same type as this message and copies the
1819  * data to the new message.
1820  * @return clone of this message
1821  */
1822 Message *
1824 {
1825  return new KatanaInterface::CalibrateMessage(this);
1826 }
1827 /** @class KatanaInterface::OpenGripperMessage <interfaces/KatanaInterface.h>
1828  * OpenGripperMessage Fawkes BlackBoard Interface Message.
1829  *
1830 
1831  */
1832 
1833 
1834 /** Constructor */
1836 {
1837  data_size = sizeof(OpenGripperMessage_data_t);
1838  data_ptr = malloc(data_size);
1839  memset(data_ptr, 0, data_size);
1840  data = (OpenGripperMessage_data_t *)data_ptr;
1842 }
1843 
1844 /** Destructor */
1846 {
1847  free(data_ptr);
1848 }
1849 
1850 /** Copy constructor.
1851  * @param m message to copy from
1852  */
1854 {
1855  data_size = m->data_size;
1856  data_ptr = malloc(data_size);
1857  memcpy(data_ptr, m->data_ptr, data_size);
1858  data = (OpenGripperMessage_data_t *)data_ptr;
1860 }
1861 
1862 /* Methods */
1863 /** Clone this message.
1864  * Produces a message of the same type as this message and copies the
1865  * data to the new message.
1866  * @return clone of this message
1867  */
1868 Message *
1870 {
1871  return new KatanaInterface::OpenGripperMessage(this);
1872 }
1873 /** @class KatanaInterface::CloseGripperMessage <interfaces/KatanaInterface.h>
1874  * CloseGripperMessage Fawkes BlackBoard Interface Message.
1875  *
1876 
1877  */
1878 
1879 
1880 /** Constructor */
1882 {
1883  data_size = sizeof(CloseGripperMessage_data_t);
1884  data_ptr = malloc(data_size);
1885  memset(data_ptr, 0, data_size);
1886  data = (CloseGripperMessage_data_t *)data_ptr;
1888 }
1889 
1890 /** Destructor */
1892 {
1893  free(data_ptr);
1894 }
1895 
1896 /** Copy constructor.
1897  * @param m message to copy from
1898  */
1900 {
1901  data_size = m->data_size;
1902  data_ptr = malloc(data_size);
1903  memcpy(data_ptr, m->data_ptr, data_size);
1904  data = (CloseGripperMessage_data_t *)data_ptr;
1906 }
1907 
1908 /* Methods */
1909 /** Clone this message.
1910  * Produces a message of the same type as this message and copies the
1911  * data to the new message.
1912  * @return clone of this message
1913  */
1914 Message *
1916 {
1917  return new KatanaInterface::CloseGripperMessage(this);
1918 }
1919 /** @class KatanaInterface::SetEnabledMessage <interfaces/KatanaInterface.h>
1920  * SetEnabledMessage Fawkes BlackBoard Interface Message.
1921  *
1922 
1923  */
1924 
1925 
1926 /** Constructor with initial values.
1927  * @param ini_enabled initial value for enabled
1928  */
1929 KatanaInterface::SetEnabledMessage::SetEnabledMessage(const bool ini_enabled) : Message("SetEnabledMessage")
1930 {
1931  data_size = sizeof(SetEnabledMessage_data_t);
1932  data_ptr = malloc(data_size);
1933  memset(data_ptr, 0, data_size);
1934  data = (SetEnabledMessage_data_t *)data_ptr;
1936  data->enabled = ini_enabled;
1937  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
1938 }
1939 /** Constructor */
1941 {
1942  data_size = sizeof(SetEnabledMessage_data_t);
1943  data_ptr = malloc(data_size);
1944  memset(data_ptr, 0, data_size);
1945  data = (SetEnabledMessage_data_t *)data_ptr;
1947  add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
1948 }
1949 
1950 /** Destructor */
1952 {
1953  free(data_ptr);
1954 }
1955 
1956 /** Copy constructor.
1957  * @param m message to copy from
1958  */
1960 {
1961  data_size = m->data_size;
1962  data_ptr = malloc(data_size);
1963  memcpy(data_ptr, m->data_ptr, data_size);
1964  data = (SetEnabledMessage_data_t *)data_ptr;
1966 }
1967 
1968 /* Methods */
1969 /** Get enabled value.
1970  * Are motors enabled?
1971  * @return enabled value
1972  */
1973 bool
1975 {
1976  return data->enabled;
1977 }
1978 
1979 /** Get maximum length of enabled value.
1980  * @return length of enabled value, can be length of the array or number of
1981  * maximum number of characters for a string
1982  */
1983 size_t
1985 {
1986  return 1;
1987 }
1988 
1989 /** Set enabled value.
1990  * Are motors enabled?
1991  * @param new_enabled new enabled value
1992  */
1993 void
1995 {
1996  data->enabled = new_enabled;
1997 }
1998 
1999 /** Clone this message.
2000  * Produces a message of the same type as this message and copies the
2001  * data to the new message.
2002  * @return clone of this message
2003  */
2004 Message *
2006 {
2007  return new KatanaInterface::SetEnabledMessage(this);
2008 }
2009 /** @class KatanaInterface::SetMaxVelocityMessage <interfaces/KatanaInterface.h>
2010  * SetMaxVelocityMessage Fawkes BlackBoard Interface Message.
2011  *
2012 
2013  */
2014 
2015 
2016 /** Constructor with initial values.
2017  * @param ini_max_velocity initial value for max_velocity
2018  */
2019 KatanaInterface::SetMaxVelocityMessage::SetMaxVelocityMessage(const uint8_t ini_max_velocity) : Message("SetMaxVelocityMessage")
2020 {
2021  data_size = sizeof(SetMaxVelocityMessage_data_t);
2022  data_ptr = malloc(data_size);
2023  memset(data_ptr, 0, data_size);
2024  data = (SetMaxVelocityMessage_data_t *)data_ptr;
2026  data->max_velocity = ini_max_velocity;
2027  add_fieldinfo(IFT_BYTE, "max_velocity", 1, &data->max_velocity);
2028 }
2029 /** Constructor */
2031 {
2032  data_size = sizeof(SetMaxVelocityMessage_data_t);
2033  data_ptr = malloc(data_size);
2034  memset(data_ptr, 0, data_size);
2035  data = (SetMaxVelocityMessage_data_t *)data_ptr;
2037  add_fieldinfo(IFT_BYTE, "max_velocity", 1, &data->max_velocity);
2038 }
2039 
2040 /** Destructor */
2042 {
2043  free(data_ptr);
2044 }
2045 
2046 /** Copy constructor.
2047  * @param m message to copy from
2048  */
2050 {
2051  data_size = m->data_size;
2052  data_ptr = malloc(data_size);
2053  memcpy(data_ptr, m->data_ptr, data_size);
2054  data = (SetMaxVelocityMessage_data_t *)data_ptr;
2056 }
2057 
2058 /* Methods */
2059 /** Get max_velocity value.
2060  * Maximum velocity
2061  * @return max_velocity value
2062  */
2063 uint8_t
2065 {
2066  return data->max_velocity;
2067 }
2068 
2069 /** Get maximum length of max_velocity value.
2070  * @return length of max_velocity value, can be length of the array or number of
2071  * maximum number of characters for a string
2072  */
2073 size_t
2075 {
2076  return 1;
2077 }
2078 
2079 /** Set max_velocity value.
2080  * Maximum velocity
2081  * @param new_max_velocity new max_velocity value
2082  */
2083 void
2085 {
2086  data->max_velocity = new_max_velocity;
2087 }
2088 
2089 /** Clone this message.
2090  * Produces a message of the same type as this message and copies the
2091  * data to the new message.
2092  * @return clone of this message
2093  */
2094 Message *
2096 {
2097  return new KatanaInterface::SetMaxVelocityMessage(this);
2098 }
2099 /** @class KatanaInterface::SetPlannerParamsMessage <interfaces/KatanaInterface.h>
2100  * SetPlannerParamsMessage Fawkes BlackBoard Interface Message.
2101  *
2102 
2103  */
2104 
2105 
2106 /** Constructor with initial values.
2107  * @param ini_plannerparams initial value for plannerparams
2108  * @param ini_straight initial value for straight
2109  */
2110 KatanaInterface::SetPlannerParamsMessage::SetPlannerParamsMessage(const char * ini_plannerparams, const bool ini_straight) : Message("SetPlannerParamsMessage")
2111 {
2112  data_size = sizeof(SetPlannerParamsMessage_data_t);
2113  data_ptr = malloc(data_size);
2114  memset(data_ptr, 0, data_size);
2115  data = (SetPlannerParamsMessage_data_t *)data_ptr;
2117  strncpy(data->plannerparams, ini_plannerparams, 1024-1);
2118  data->plannerparams[1024-1] = 0;
2119  data->straight = ini_straight;
2120  add_fieldinfo(IFT_STRING, "plannerparams", 1024, data->plannerparams);
2121  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
2122 }
2123 /** Constructor */
2125 {
2126  data_size = sizeof(SetPlannerParamsMessage_data_t);
2127  data_ptr = malloc(data_size);
2128  memset(data_ptr, 0, data_size);
2129  data = (SetPlannerParamsMessage_data_t *)data_ptr;
2131  add_fieldinfo(IFT_STRING, "plannerparams", 1024, data->plannerparams);
2132  add_fieldinfo(IFT_BOOL, "straight", 1, &data->straight);
2133 }
2134 
2135 /** Destructor */
2137 {
2138  free(data_ptr);
2139 }
2140 
2141 /** Copy constructor.
2142  * @param m message to copy from
2143  */
2145 {
2146  data_size = m->data_size;
2147  data_ptr = malloc(data_size);
2148  memcpy(data_ptr, m->data_ptr, data_size);
2149  data = (SetPlannerParamsMessage_data_t *)data_ptr;
2151 }
2152 
2153 /* Methods */
2154 /** Get plannerparams value.
2155  * Planner parameters
2156  * @return plannerparams value
2157  */
2158 char *
2160 {
2161  return data->plannerparams;
2162 }
2163 
2164 /** Get maximum length of plannerparams value.
2165  * @return length of plannerparams value, can be length of the array or number of
2166  * maximum number of characters for a string
2167  */
2168 size_t
2170 {
2171  return 1024;
2172 }
2173 
2174 /** Set plannerparams value.
2175  * Planner parameters
2176  * @param new_plannerparams new plannerparams value
2177  */
2178 void
2180 {
2181  strncpy(data->plannerparams, new_plannerparams, sizeof(data->plannerparams)-1);
2182  data->plannerparams[sizeof(data->plannerparams)-1] = 0;
2183 }
2184 
2185 /** Get straight value.
2186  * Parameters for straight movement?
2187  * @return straight value
2188  */
2189 bool
2191 {
2192  return data->straight;
2193 }
2194 
2195 /** Get maximum length of straight value.
2196  * @return length of straight value, can be length of the array or number of
2197  * maximum number of characters for a string
2198  */
2199 size_t
2201 {
2202  return 1;
2203 }
2204 
2205 /** Set straight value.
2206  * Parameters for straight movement?
2207  * @param new_straight new straight value
2208  */
2209 void
2211 {
2212  data->straight = new_straight;
2213 }
2214 
2215 /** Clone this message.
2216  * Produces a message of the same type as this message and copies the
2217  * data to the new message.
2218  * @return clone of this message
2219  */
2220 Message *
2222 {
2224 }
2225 /** @class KatanaInterface::SetMotorEncoderMessage <interfaces/KatanaInterface.h>
2226  * SetMotorEncoderMessage Fawkes BlackBoard Interface Message.
2227  *
2228 
2229  */
2230 
2231 
2232 /** Constructor with initial values.
2233  * @param ini_nr initial value for nr
2234  * @param ini_enc initial value for enc
2235  */
2236 KatanaInterface::SetMotorEncoderMessage::SetMotorEncoderMessage(const uint32_t ini_nr, const uint32_t ini_enc) : Message("SetMotorEncoderMessage")
2237 {
2238  data_size = sizeof(SetMotorEncoderMessage_data_t);
2239  data_ptr = malloc(data_size);
2240  memset(data_ptr, 0, data_size);
2241  data = (SetMotorEncoderMessage_data_t *)data_ptr;
2243  data->nr = ini_nr;
2244  data->enc = ini_enc;
2245  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2246  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2247 }
2248 /** Constructor */
2250 {
2251  data_size = sizeof(SetMotorEncoderMessage_data_t);
2252  data_ptr = malloc(data_size);
2253  memset(data_ptr, 0, data_size);
2254  data = (SetMotorEncoderMessage_data_t *)data_ptr;
2256  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2257  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2258 }
2259 
2260 /** Destructor */
2262 {
2263  free(data_ptr);
2264 }
2265 
2266 /** Copy constructor.
2267  * @param m message to copy from
2268  */
2270 {
2271  data_size = m->data_size;
2272  data_ptr = malloc(data_size);
2273  memcpy(data_ptr, m->data_ptr, data_size);
2274  data = (SetMotorEncoderMessage_data_t *)data_ptr;
2276 }
2277 
2278 /* Methods */
2279 /** Get nr value.
2280  * Motor number
2281  * @return nr value
2282  */
2283 uint32_t
2285 {
2286  return data->nr;
2287 }
2288 
2289 /** Get maximum length of nr value.
2290  * @return length of nr value, can be length of the array or number of
2291  * maximum number of characters for a string
2292  */
2293 size_t
2295 {
2296  return 1;
2297 }
2298 
2299 /** Set nr value.
2300  * Motor number
2301  * @param new_nr new nr value
2302  */
2303 void
2305 {
2306  data->nr = new_nr;
2307 }
2308 
2309 /** Get enc value.
2310  * Encoder value
2311  * @return enc value
2312  */
2313 uint32_t
2315 {
2316  return data->enc;
2317 }
2318 
2319 /** Get maximum length of enc value.
2320  * @return length of enc value, can be length of the array or number of
2321  * maximum number of characters for a string
2322  */
2323 size_t
2325 {
2326  return 1;
2327 }
2328 
2329 /** Set enc value.
2330  * Encoder value
2331  * @param new_enc new enc value
2332  */
2333 void
2335 {
2336  data->enc = new_enc;
2337 }
2338 
2339 /** Clone this message.
2340  * Produces a message of the same type as this message and copies the
2341  * data to the new message.
2342  * @return clone of this message
2343  */
2344 Message *
2346 {
2347  return new KatanaInterface::SetMotorEncoderMessage(this);
2348 }
2349 /** @class KatanaInterface::MoveMotorEncoderMessage <interfaces/KatanaInterface.h>
2350  * MoveMotorEncoderMessage Fawkes BlackBoard Interface Message.
2351  *
2352 
2353  */
2354 
2355 
2356 /** Constructor with initial values.
2357  * @param ini_nr initial value for nr
2358  * @param ini_enc initial value for enc
2359  */
2360 KatanaInterface::MoveMotorEncoderMessage::MoveMotorEncoderMessage(const uint32_t ini_nr, const uint32_t ini_enc) : Message("MoveMotorEncoderMessage")
2361 {
2362  data_size = sizeof(MoveMotorEncoderMessage_data_t);
2363  data_ptr = malloc(data_size);
2364  memset(data_ptr, 0, data_size);
2365  data = (MoveMotorEncoderMessage_data_t *)data_ptr;
2367  data->nr = ini_nr;
2368  data->enc = ini_enc;
2369  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2370  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2371 }
2372 /** Constructor */
2374 {
2375  data_size = sizeof(MoveMotorEncoderMessage_data_t);
2376  data_ptr = malloc(data_size);
2377  memset(data_ptr, 0, data_size);
2378  data = (MoveMotorEncoderMessage_data_t *)data_ptr;
2380  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2381  add_fieldinfo(IFT_UINT32, "enc", 1, &data->enc);
2382 }
2383 
2384 /** Destructor */
2386 {
2387  free(data_ptr);
2388 }
2389 
2390 /** Copy constructor.
2391  * @param m message to copy from
2392  */
2394 {
2395  data_size = m->data_size;
2396  data_ptr = malloc(data_size);
2397  memcpy(data_ptr, m->data_ptr, data_size);
2398  data = (MoveMotorEncoderMessage_data_t *)data_ptr;
2400 }
2401 
2402 /* Methods */
2403 /** Get nr value.
2404  * Motor number
2405  * @return nr value
2406  */
2407 uint32_t
2409 {
2410  return data->nr;
2411 }
2412 
2413 /** Get maximum length of nr value.
2414  * @return length of nr value, can be length of the array or number of
2415  * maximum number of characters for a string
2416  */
2417 size_t
2419 {
2420  return 1;
2421 }
2422 
2423 /** Set nr value.
2424  * Motor number
2425  * @param new_nr new nr value
2426  */
2427 void
2429 {
2430  data->nr = new_nr;
2431 }
2432 
2433 /** Get enc value.
2434  * Encoder value
2435  * @return enc value
2436  */
2437 uint32_t
2439 {
2440  return data->enc;
2441 }
2442 
2443 /** Get maximum length of enc value.
2444  * @return length of enc value, can be length of the array or number of
2445  * maximum number of characters for a string
2446  */
2447 size_t
2449 {
2450  return 1;
2451 }
2452 
2453 /** Set enc value.
2454  * Encoder value
2455  * @param new_enc new enc value
2456  */
2457 void
2459 {
2460  data->enc = new_enc;
2461 }
2462 
2463 /** Clone this message.
2464  * Produces a message of the same type as this message and copies the
2465  * data to the new message.
2466  * @return clone of this message
2467  */
2468 Message *
2470 {
2472 }
2473 /** @class KatanaInterface::SetMotorAngleMessage <interfaces/KatanaInterface.h>
2474  * SetMotorAngleMessage Fawkes BlackBoard Interface Message.
2475  *
2476 
2477  */
2478 
2479 
2480 /** Constructor with initial values.
2481  * @param ini_nr initial value for nr
2482  * @param ini_angle initial value for angle
2483  */
2484 KatanaInterface::SetMotorAngleMessage::SetMotorAngleMessage(const uint32_t ini_nr, const float ini_angle) : Message("SetMotorAngleMessage")
2485 {
2486  data_size = sizeof(SetMotorAngleMessage_data_t);
2487  data_ptr = malloc(data_size);
2488  memset(data_ptr, 0, data_size);
2489  data = (SetMotorAngleMessage_data_t *)data_ptr;
2491  data->nr = ini_nr;
2492  data->angle = ini_angle;
2493  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2494  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2495 }
2496 /** Constructor */
2498 {
2499  data_size = sizeof(SetMotorAngleMessage_data_t);
2500  data_ptr = malloc(data_size);
2501  memset(data_ptr, 0, data_size);
2502  data = (SetMotorAngleMessage_data_t *)data_ptr;
2504  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2505  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2506 }
2507 
2508 /** Destructor */
2510 {
2511  free(data_ptr);
2512 }
2513 
2514 /** Copy constructor.
2515  * @param m message to copy from
2516  */
2518 {
2519  data_size = m->data_size;
2520  data_ptr = malloc(data_size);
2521  memcpy(data_ptr, m->data_ptr, data_size);
2522  data = (SetMotorAngleMessage_data_t *)data_ptr;
2524 }
2525 
2526 /* Methods */
2527 /** Get nr value.
2528  * Motor number
2529  * @return nr value
2530  */
2531 uint32_t
2533 {
2534  return data->nr;
2535 }
2536 
2537 /** Get maximum length of nr value.
2538  * @return length of nr value, can be length of the array or number of
2539  * maximum number of characters for a string
2540  */
2541 size_t
2543 {
2544  return 1;
2545 }
2546 
2547 /** Set nr value.
2548  * Motor number
2549  * @param new_nr new nr value
2550  */
2551 void
2553 {
2554  data->nr = new_nr;
2555 }
2556 
2557 /** Get angle value.
2558  * Angle value (positive: increase; negative: decrease)
2559  * @return angle value
2560  */
2561 float
2563 {
2564  return data->angle;
2565 }
2566 
2567 /** Get maximum length of angle value.
2568  * @return length of angle value, can be length of the array or number of
2569  * maximum number of characters for a string
2570  */
2571 size_t
2573 {
2574  return 1;
2575 }
2576 
2577 /** Set angle value.
2578  * Angle value (positive: increase; negative: decrease)
2579  * @param new_angle new angle value
2580  */
2581 void
2583 {
2584  data->angle = new_angle;
2585 }
2586 
2587 /** Clone this message.
2588  * Produces a message of the same type as this message and copies the
2589  * data to the new message.
2590  * @return clone of this message
2591  */
2592 Message *
2594 {
2595  return new KatanaInterface::SetMotorAngleMessage(this);
2596 }
2597 /** @class KatanaInterface::MoveMotorAngleMessage <interfaces/KatanaInterface.h>
2598  * MoveMotorAngleMessage Fawkes BlackBoard Interface Message.
2599  *
2600 
2601  */
2602 
2603 
2604 /** Constructor with initial values.
2605  * @param ini_nr initial value for nr
2606  * @param ini_angle initial value for angle
2607  */
2608 KatanaInterface::MoveMotorAngleMessage::MoveMotorAngleMessage(const uint32_t ini_nr, const float ini_angle) : Message("MoveMotorAngleMessage")
2609 {
2610  data_size = sizeof(MoveMotorAngleMessage_data_t);
2611  data_ptr = malloc(data_size);
2612  memset(data_ptr, 0, data_size);
2613  data = (MoveMotorAngleMessage_data_t *)data_ptr;
2615  data->nr = ini_nr;
2616  data->angle = ini_angle;
2617  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2618  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2619 }
2620 /** Constructor */
2622 {
2623  data_size = sizeof(MoveMotorAngleMessage_data_t);
2624  data_ptr = malloc(data_size);
2625  memset(data_ptr, 0, data_size);
2626  data = (MoveMotorAngleMessage_data_t *)data_ptr;
2628  add_fieldinfo(IFT_UINT32, "nr", 1, &data->nr);
2629  add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
2630 }
2631 
2632 /** Destructor */
2634 {
2635  free(data_ptr);
2636 }
2637 
2638 /** Copy constructor.
2639  * @param m message to copy from
2640  */
2642 {
2643  data_size = m->data_size;
2644  data_ptr = malloc(data_size);
2645  memcpy(data_ptr, m->data_ptr, data_size);
2646  data = (MoveMotorAngleMessage_data_t *)data_ptr;
2648 }
2649 
2650 /* Methods */
2651 /** Get nr value.
2652  * Motor number
2653  * @return nr value
2654  */
2655 uint32_t
2657 {
2658  return data->nr;
2659 }
2660 
2661 /** Get maximum length of nr value.
2662  * @return length of nr value, can be length of the array or number of
2663  * maximum number of characters for a string
2664  */
2665 size_t
2667 {
2668  return 1;
2669 }
2670 
2671 /** Set nr value.
2672  * Motor number
2673  * @param new_nr new nr value
2674  */
2675 void
2677 {
2678  data->nr = new_nr;
2679 }
2680 
2681 /** Get angle value.
2682  * Angle value (positive: increase; negative: decrease)
2683  * @return angle value
2684  */
2685 float
2687 {
2688  return data->angle;
2689 }
2690 
2691 /** Get maximum length of angle value.
2692  * @return length of angle value, can be length of the array or number of
2693  * maximum number of characters for a string
2694  */
2695 size_t
2697 {
2698  return 1;
2699 }
2700 
2701 /** Set angle value.
2702  * Angle value (positive: increase; negative: decrease)
2703  * @param new_angle new angle value
2704  */
2705 void
2707 {
2708  data->angle = new_angle;
2709 }
2710 
2711 /** Clone this message.
2712  * Produces a message of the same type as this message and copies the
2713  * data to the new message.
2714  * @return clone of this message
2715  */
2716 Message *
2718 {
2719  return new KatanaInterface::MoveMotorAngleMessage(this);
2720 }
2721 /** Check if message is valid and can be enqueued.
2722  * @param message Message to check
2723  * @return true if the message is valid, false otherwise.
2724  */
2725 bool
2727 {
2728  const StopMessage *m0 = dynamic_cast<const StopMessage *>(message);
2729  if ( m0 != NULL ) {
2730  return true;
2731  }
2732  const FlushMessage *m1 = dynamic_cast<const FlushMessage *>(message);
2733  if ( m1 != NULL ) {
2734  return true;
2735  }
2736  const ParkMessage *m2 = dynamic_cast<const ParkMessage *>(message);
2737  if ( m2 != NULL ) {
2738  return true;
2739  }
2740  const LinearGotoMessage *m3 = dynamic_cast<const LinearGotoMessage *>(message);
2741  if ( m3 != NULL ) {
2742  return true;
2743  }
2744  const LinearGotoKniMessage *m4 = dynamic_cast<const LinearGotoKniMessage *>(message);
2745  if ( m4 != NULL ) {
2746  return true;
2747  }
2748  const ObjectGotoMessage *m5 = dynamic_cast<const ObjectGotoMessage *>(message);
2749  if ( m5 != NULL ) {
2750  return true;
2751  }
2752  const CalibrateMessage *m6 = dynamic_cast<const CalibrateMessage *>(message);
2753  if ( m6 != NULL ) {
2754  return true;
2755  }
2756  const OpenGripperMessage *m7 = dynamic_cast<const OpenGripperMessage *>(message);
2757  if ( m7 != NULL ) {
2758  return true;
2759  }
2760  const CloseGripperMessage *m8 = dynamic_cast<const CloseGripperMessage *>(message);
2761  if ( m8 != NULL ) {
2762  return true;
2763  }
2764  const SetEnabledMessage *m9 = dynamic_cast<const SetEnabledMessage *>(message);
2765  if ( m9 != NULL ) {
2766  return true;
2767  }
2768  const SetMaxVelocityMessage *m10 = dynamic_cast<const SetMaxVelocityMessage *>(message);
2769  if ( m10 != NULL ) {
2770  return true;
2771  }
2772  const SetPlannerParamsMessage *m11 = dynamic_cast<const SetPlannerParamsMessage *>(message);
2773  if ( m11 != NULL ) {
2774  return true;
2775  }
2776  const SetMotorEncoderMessage *m12 = dynamic_cast<const SetMotorEncoderMessage *>(message);
2777  if ( m12 != NULL ) {
2778  return true;
2779  }
2780  const MoveMotorEncoderMessage *m13 = dynamic_cast<const MoveMotorEncoderMessage *>(message);
2781  if ( m13 != NULL ) {
2782  return true;
2783  }
2784  const SetMotorAngleMessage *m14 = dynamic_cast<const SetMotorAngleMessage *>(message);
2785  if ( m14 != NULL ) {
2786  return true;
2787  }
2788  const MoveMotorAngleMessage *m15 = dynamic_cast<const MoveMotorAngleMessage *>(message);
2789  if ( m15 != NULL ) {
2790  return true;
2791  }
2792  return false;
2793 }
2794 
2795 /// @cond INTERNALS
2796 EXPORT_INTERFACE(KatanaInterface)
2797 /// @endcond
2798 
2799 
2800 } // 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:125
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:41
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!...
Definition: message.h:130
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:48
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:49
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:78
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:135
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:126
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:640
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:224
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:35
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:46
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:410
boolean field
Definition: types.h:37
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:43
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.