Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
NaoSensorInterface.cpp
1 
2 /***************************************************************************
3  * NaoSensorInterface.cpp - Fawkes BlackBoard Interface - NaoSensorInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2008 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/NaoSensorInterface.h>
25 
26 #include <core/exceptions/software.h>
27 
28 #include <cstring>
29 #include <cstdlib>
30 
31 namespace fawkes {
32 
33 /** @class NaoSensorInterface <interfaces/NaoSensorInterface.h>
34  * NaoSensorInterface Fawkes BlackBoard Interface.
35  *
36  This interface provides access to Nao sensors.
37 
38  * @ingroup FawkesInterfaces
39  */
40 
41 
42 
43 /** Constructor */
44 NaoSensorInterface::NaoSensorInterface() : Interface()
45 {
46  data_size = sizeof(NaoSensorInterface_data_t);
47  data_ptr = malloc(data_size);
48  data = (NaoSensorInterface_data_t *)data_ptr;
49  data_ts = (interface_data_ts_t *)data_ptr;
50  memset(data_ptr, 0, data_size);
51  add_fieldinfo(IFT_FLOAT, "accel_x", 1, &data->accel_x);
52  add_fieldinfo(IFT_FLOAT, "accel_y", 1, &data->accel_y);
53  add_fieldinfo(IFT_FLOAT, "accel_z", 1, &data->accel_z);
54  add_fieldinfo(IFT_FLOAT, "gyro_x", 1, &data->gyro_x);
55  add_fieldinfo(IFT_FLOAT, "gyro_y", 1, &data->gyro_y);
56  add_fieldinfo(IFT_FLOAT, "gyro_ref", 1, &data->gyro_ref);
57  add_fieldinfo(IFT_FLOAT, "angle_x", 1, &data->angle_x);
58  add_fieldinfo(IFT_FLOAT, "angle_y", 1, &data->angle_y);
59  add_fieldinfo(IFT_FLOAT, "l_fsr_fl", 1, &data->l_fsr_fl);
60  add_fieldinfo(IFT_FLOAT, "l_fsr_fr", 1, &data->l_fsr_fr);
61  add_fieldinfo(IFT_FLOAT, "l_fsr_rl", 1, &data->l_fsr_rl);
62  add_fieldinfo(IFT_FLOAT, "l_fsr_rr", 1, &data->l_fsr_rr);
63  add_fieldinfo(IFT_FLOAT, "r_fsr_fl", 1, &data->r_fsr_fl);
64  add_fieldinfo(IFT_FLOAT, "r_fsr_fr", 1, &data->r_fsr_fr);
65  add_fieldinfo(IFT_FLOAT, "r_fsr_rl", 1, &data->r_fsr_rl);
66  add_fieldinfo(IFT_FLOAT, "r_fsr_rr", 1, &data->r_fsr_rr);
67  add_fieldinfo(IFT_FLOAT, "l_total_weight", 1, &data->l_total_weight);
68  add_fieldinfo(IFT_FLOAT, "r_total_weight", 1, &data->r_total_weight);
69  add_fieldinfo(IFT_FLOAT, "l_cop_x", 1, &data->l_cop_x);
70  add_fieldinfo(IFT_FLOAT, "l_cop_y", 1, &data->l_cop_y);
71  add_fieldinfo(IFT_FLOAT, "r_cop_x", 1, &data->r_cop_x);
72  add_fieldinfo(IFT_FLOAT, "r_cop_y", 1, &data->r_cop_y);
73  add_fieldinfo(IFT_FLOAT, "ultrasonic_distance_left", 4, &data->ultrasonic_distance_left);
74  add_fieldinfo(IFT_FLOAT, "ultrasonic_distance_right", 4, &data->ultrasonic_distance_right);
75  add_fieldinfo(IFT_ENUM, "ultrasonic_direction", 1, &data->ultrasonic_direction, "UltrasonicDirection");
76  add_fieldinfo(IFT_UINT8, "l_foot_bumper_l", 1, &data->l_foot_bumper_l);
77  add_fieldinfo(IFT_UINT8, "l_foot_bumper_r", 1, &data->l_foot_bumper_r);
78  add_fieldinfo(IFT_UINT8, "r_foot_bumper_l", 1, &data->r_foot_bumper_l);
79  add_fieldinfo(IFT_UINT8, "r_foot_bumper_r", 1, &data->r_foot_bumper_r);
80  add_fieldinfo(IFT_UINT8, "head_touch_front", 1, &data->head_touch_front);
81  add_fieldinfo(IFT_UINT8, "head_touch_middle", 1, &data->head_touch_middle);
82  add_fieldinfo(IFT_UINT8, "head_touch_rear", 1, &data->head_touch_rear);
83  add_fieldinfo(IFT_UINT8, "chest_button", 1, &data->chest_button);
84  add_fieldinfo(IFT_FLOAT, "battery_charge", 1, &data->battery_charge);
85  add_messageinfo("EmitUltrasonicWaveMessage");
86  add_messageinfo("StartUltrasonicMessage");
87  add_messageinfo("StopUltrasonicMessage");
88  unsigned char tmp_hash[] = {0x41, 0x41, 0x54, 0x94, 0xca, 0xe8, 0x3d, 0x7a, 0xb8, 0xaa, 0xc2, 0x4e, 0x2c, 0xac, 0xcb, 0x15};
89  set_hash(tmp_hash);
90 }
91 
92 /** Destructor */
93 NaoSensorInterface::~NaoSensorInterface()
94 {
95  free(data_ptr);
96 }
97 /** Convert UltrasonicDirection constant to string.
98  * @param value value to convert to string
99  * @return constant value as string.
100  */
101 const char *
103 {
104  switch (value) {
105  case USD_NONE: return "USD_NONE";
106  case USD_LEFT_LEFT: return "USD_LEFT_LEFT";
107  case USD_LEFT_RIGHT: return "USD_LEFT_RIGHT";
108  case USD_RIGHT_RIGHT: return "USD_RIGHT_RIGHT";
109  case USD_RIGHT_LEFT: return "USD_RIGHT_LEFT";
110  case USD_BOTH_BOTH: return "USD_BOTH_BOTH";
111  default: return "UNKNOWN";
112  }
113 }
114 /* Methods */
115 /** Get accel_x value.
116  * Accelerometer x
117  * @return accel_x value
118  */
119 float
121 {
122  return data->accel_x;
123 }
124 
125 /** Get maximum length of accel_x value.
126  * @return length of accel_x value, can be length of the array or number of
127  * maximum number of characters for a string
128  */
129 size_t
131 {
132  return 1;
133 }
134 
135 /** Set accel_x value.
136  * Accelerometer x
137  * @param new_accel_x new accel_x value
138  */
139 void
140 NaoSensorInterface::set_accel_x(const float new_accel_x)
141 {
142  data->accel_x = new_accel_x;
143  data_changed = true;
144 }
145 
146 /** Get accel_y value.
147  * Accelerometer y
148  * @return accel_y value
149  */
150 float
152 {
153  return data->accel_y;
154 }
155 
156 /** Get maximum length of accel_y value.
157  * @return length of accel_y value, can be length of the array or number of
158  * maximum number of characters for a string
159  */
160 size_t
162 {
163  return 1;
164 }
165 
166 /** Set accel_y value.
167  * Accelerometer y
168  * @param new_accel_y new accel_y value
169  */
170 void
171 NaoSensorInterface::set_accel_y(const float new_accel_y)
172 {
173  data->accel_y = new_accel_y;
174  data_changed = true;
175 }
176 
177 /** Get accel_z value.
178  * Accelerometer z
179  * @return accel_z value
180  */
181 float
183 {
184  return data->accel_z;
185 }
186 
187 /** Get maximum length of accel_z value.
188  * @return length of accel_z value, can be length of the array or number of
189  * maximum number of characters for a string
190  */
191 size_t
193 {
194  return 1;
195 }
196 
197 /** Set accel_z value.
198  * Accelerometer z
199  * @param new_accel_z new accel_z value
200  */
201 void
202 NaoSensorInterface::set_accel_z(const float new_accel_z)
203 {
204  data->accel_z = new_accel_z;
205  data_changed = true;
206 }
207 
208 /** Get gyro_x value.
209  * Gyrometer x
210  * @return gyro_x value
211  */
212 float
214 {
215  return data->gyro_x;
216 }
217 
218 /** Get maximum length of gyro_x value.
219  * @return length of gyro_x value, can be length of the array or number of
220  * maximum number of characters for a string
221  */
222 size_t
224 {
225  return 1;
226 }
227 
228 /** Set gyro_x value.
229  * Gyrometer x
230  * @param new_gyro_x new gyro_x value
231  */
232 void
233 NaoSensorInterface::set_gyro_x(const float new_gyro_x)
234 {
235  data->gyro_x = new_gyro_x;
236  data_changed = true;
237 }
238 
239 /** Get gyro_y value.
240  * Gyrometer y
241  * @return gyro_y value
242  */
243 float
245 {
246  return data->gyro_y;
247 }
248 
249 /** Get maximum length of gyro_y value.
250  * @return length of gyro_y value, can be length of the array or number of
251  * maximum number of characters for a string
252  */
253 size_t
255 {
256  return 1;
257 }
258 
259 /** Set gyro_y value.
260  * Gyrometer y
261  * @param new_gyro_y new gyro_y value
262  */
263 void
264 NaoSensorInterface::set_gyro_y(const float new_gyro_y)
265 {
266  data->gyro_y = new_gyro_y;
267  data_changed = true;
268 }
269 
270 /** Get gyro_ref value.
271  * Gyrometer reference
272  * @return gyro_ref value
273  */
274 float
276 {
277  return data->gyro_ref;
278 }
279 
280 /** Get maximum length of gyro_ref value.
281  * @return length of gyro_ref value, can be length of the array or number of
282  * maximum number of characters for a string
283  */
284 size_t
286 {
287  return 1;
288 }
289 
290 /** Set gyro_ref value.
291  * Gyrometer reference
292  * @param new_gyro_ref new gyro_ref value
293  */
294 void
295 NaoSensorInterface::set_gyro_ref(const float new_gyro_ref)
296 {
297  data->gyro_ref = new_gyro_ref;
298  data_changed = true;
299 }
300 
301 /** Get angle_x value.
302  * Angle x
303  * @return angle_x value
304  */
305 float
307 {
308  return data->angle_x;
309 }
310 
311 /** Get maximum length of angle_x value.
312  * @return length of angle_x value, can be length of the array or number of
313  * maximum number of characters for a string
314  */
315 size_t
317 {
318  return 1;
319 }
320 
321 /** Set angle_x value.
322  * Angle x
323  * @param new_angle_x new angle_x value
324  */
325 void
326 NaoSensorInterface::set_angle_x(const float new_angle_x)
327 {
328  data->angle_x = new_angle_x;
329  data_changed = true;
330 }
331 
332 /** Get angle_y value.
333  * Angle y
334  * @return angle_y value
335  */
336 float
338 {
339  return data->angle_y;
340 }
341 
342 /** Get maximum length of angle_y value.
343  * @return length of angle_y value, can be length of the array or number of
344  * maximum number of characters for a string
345  */
346 size_t
348 {
349  return 1;
350 }
351 
352 /** Set angle_y value.
353  * Angle y
354  * @param new_angle_y new angle_y value
355  */
356 void
357 NaoSensorInterface::set_angle_y(const float new_angle_y)
358 {
359  data->angle_y = new_angle_y;
360  data_changed = true;
361 }
362 
363 /** Get l_fsr_fl value.
364  * Left FSR front left
365  * @return l_fsr_fl value
366  */
367 float
369 {
370  return data->l_fsr_fl;
371 }
372 
373 /** Get maximum length of l_fsr_fl value.
374  * @return length of l_fsr_fl value, can be length of the array or number of
375  * maximum number of characters for a string
376  */
377 size_t
379 {
380  return 1;
381 }
382 
383 /** Set l_fsr_fl value.
384  * Left FSR front left
385  * @param new_l_fsr_fl new l_fsr_fl value
386  */
387 void
388 NaoSensorInterface::set_l_fsr_fl(const float new_l_fsr_fl)
389 {
390  data->l_fsr_fl = new_l_fsr_fl;
391  data_changed = true;
392 }
393 
394 /** Get l_fsr_fr value.
395  * Left FSR front right
396  * @return l_fsr_fr value
397  */
398 float
400 {
401  return data->l_fsr_fr;
402 }
403 
404 /** Get maximum length of l_fsr_fr value.
405  * @return length of l_fsr_fr value, can be length of the array or number of
406  * maximum number of characters for a string
407  */
408 size_t
410 {
411  return 1;
412 }
413 
414 /** Set l_fsr_fr value.
415  * Left FSR front right
416  * @param new_l_fsr_fr new l_fsr_fr value
417  */
418 void
419 NaoSensorInterface::set_l_fsr_fr(const float new_l_fsr_fr)
420 {
421  data->l_fsr_fr = new_l_fsr_fr;
422  data_changed = true;
423 }
424 
425 /** Get l_fsr_rl value.
426  * Left FSR rear left
427  * @return l_fsr_rl value
428  */
429 float
431 {
432  return data->l_fsr_rl;
433 }
434 
435 /** Get maximum length of l_fsr_rl value.
436  * @return length of l_fsr_rl value, can be length of the array or number of
437  * maximum number of characters for a string
438  */
439 size_t
441 {
442  return 1;
443 }
444 
445 /** Set l_fsr_rl value.
446  * Left FSR rear left
447  * @param new_l_fsr_rl new l_fsr_rl value
448  */
449 void
450 NaoSensorInterface::set_l_fsr_rl(const float new_l_fsr_rl)
451 {
452  data->l_fsr_rl = new_l_fsr_rl;
453  data_changed = true;
454 }
455 
456 /** Get l_fsr_rr value.
457  * Left FSR rear right
458  * @return l_fsr_rr value
459  */
460 float
462 {
463  return data->l_fsr_rr;
464 }
465 
466 /** Get maximum length of l_fsr_rr value.
467  * @return length of l_fsr_rr value, can be length of the array or number of
468  * maximum number of characters for a string
469  */
470 size_t
472 {
473  return 1;
474 }
475 
476 /** Set l_fsr_rr value.
477  * Left FSR rear right
478  * @param new_l_fsr_rr new l_fsr_rr value
479  */
480 void
481 NaoSensorInterface::set_l_fsr_rr(const float new_l_fsr_rr)
482 {
483  data->l_fsr_rr = new_l_fsr_rr;
484  data_changed = true;
485 }
486 
487 /** Get r_fsr_fl value.
488  * Right FSR front left
489  * @return r_fsr_fl value
490  */
491 float
493 {
494  return data->r_fsr_fl;
495 }
496 
497 /** Get maximum length of r_fsr_fl value.
498  * @return length of r_fsr_fl value, can be length of the array or number of
499  * maximum number of characters for a string
500  */
501 size_t
503 {
504  return 1;
505 }
506 
507 /** Set r_fsr_fl value.
508  * Right FSR front left
509  * @param new_r_fsr_fl new r_fsr_fl value
510  */
511 void
512 NaoSensorInterface::set_r_fsr_fl(const float new_r_fsr_fl)
513 {
514  data->r_fsr_fl = new_r_fsr_fl;
515  data_changed = true;
516 }
517 
518 /** Get r_fsr_fr value.
519  * Right FSR front right
520  * @return r_fsr_fr value
521  */
522 float
524 {
525  return data->r_fsr_fr;
526 }
527 
528 /** Get maximum length of r_fsr_fr value.
529  * @return length of r_fsr_fr value, can be length of the array or number of
530  * maximum number of characters for a string
531  */
532 size_t
534 {
535  return 1;
536 }
537 
538 /** Set r_fsr_fr value.
539  * Right FSR front right
540  * @param new_r_fsr_fr new r_fsr_fr value
541  */
542 void
543 NaoSensorInterface::set_r_fsr_fr(const float new_r_fsr_fr)
544 {
545  data->r_fsr_fr = new_r_fsr_fr;
546  data_changed = true;
547 }
548 
549 /** Get r_fsr_rl value.
550  * Right FSR rear left
551  * @return r_fsr_rl value
552  */
553 float
555 {
556  return data->r_fsr_rl;
557 }
558 
559 /** Get maximum length of r_fsr_rl value.
560  * @return length of r_fsr_rl value, can be length of the array or number of
561  * maximum number of characters for a string
562  */
563 size_t
565 {
566  return 1;
567 }
568 
569 /** Set r_fsr_rl value.
570  * Right FSR rear left
571  * @param new_r_fsr_rl new r_fsr_rl value
572  */
573 void
574 NaoSensorInterface::set_r_fsr_rl(const float new_r_fsr_rl)
575 {
576  data->r_fsr_rl = new_r_fsr_rl;
577  data_changed = true;
578 }
579 
580 /** Get r_fsr_rr value.
581  * Right FSR rear right
582  * @return r_fsr_rr value
583  */
584 float
586 {
587  return data->r_fsr_rr;
588 }
589 
590 /** Get maximum length of r_fsr_rr value.
591  * @return length of r_fsr_rr value, can be length of the array or number of
592  * maximum number of characters for a string
593  */
594 size_t
596 {
597  return 1;
598 }
599 
600 /** Set r_fsr_rr value.
601  * Right FSR rear right
602  * @param new_r_fsr_rr new r_fsr_rr value
603  */
604 void
605 NaoSensorInterface::set_r_fsr_rr(const float new_r_fsr_rr)
606 {
607  data->r_fsr_rr = new_r_fsr_rr;
608  data_changed = true;
609 }
610 
611 /** Get l_total_weight value.
612  * Total weight on left foot
613  * @return l_total_weight value
614  */
615 float
617 {
618  return data->l_total_weight;
619 }
620 
621 /** Get maximum length of l_total_weight value.
622  * @return length of l_total_weight value, can be length of the array or number of
623  * maximum number of characters for a string
624  */
625 size_t
627 {
628  return 1;
629 }
630 
631 /** Set l_total_weight value.
632  * Total weight on left foot
633  * @param new_l_total_weight new l_total_weight value
634  */
635 void
636 NaoSensorInterface::set_l_total_weight(const float new_l_total_weight)
637 {
638  data->l_total_weight = new_l_total_weight;
639  data_changed = true;
640 }
641 
642 /** Get r_total_weight value.
643  * Total weight on right foot
644  * @return r_total_weight value
645  */
646 float
648 {
649  return data->r_total_weight;
650 }
651 
652 /** Get maximum length of r_total_weight value.
653  * @return length of r_total_weight value, can be length of the array or number of
654  * maximum number of characters for a string
655  */
656 size_t
658 {
659  return 1;
660 }
661 
662 /** Set r_total_weight value.
663  * Total weight on right foot
664  * @param new_r_total_weight new r_total_weight value
665  */
666 void
667 NaoSensorInterface::set_r_total_weight(const float new_r_total_weight)
668 {
669  data->r_total_weight = new_r_total_weight;
670  data_changed = true;
671 }
672 
673 /** Get l_cop_x value.
674  * Center of pressure X for left foot.
675  * @return l_cop_x value
676  */
677 float
679 {
680  return data->l_cop_x;
681 }
682 
683 /** Get maximum length of l_cop_x value.
684  * @return length of l_cop_x value, can be length of the array or number of
685  * maximum number of characters for a string
686  */
687 size_t
689 {
690  return 1;
691 }
692 
693 /** Set l_cop_x value.
694  * Center of pressure X for left foot.
695  * @param new_l_cop_x new l_cop_x value
696  */
697 void
698 NaoSensorInterface::set_l_cop_x(const float new_l_cop_x)
699 {
700  data->l_cop_x = new_l_cop_x;
701  data_changed = true;
702 }
703 
704 /** Get l_cop_y value.
705  * Center of pressure Y for left foot.
706  * @return l_cop_y value
707  */
708 float
710 {
711  return data->l_cop_y;
712 }
713 
714 /** Get maximum length of l_cop_y value.
715  * @return length of l_cop_y value, can be length of the array or number of
716  * maximum number of characters for a string
717  */
718 size_t
720 {
721  return 1;
722 }
723 
724 /** Set l_cop_y value.
725  * Center of pressure Y for left foot.
726  * @param new_l_cop_y new l_cop_y value
727  */
728 void
729 NaoSensorInterface::set_l_cop_y(const float new_l_cop_y)
730 {
731  data->l_cop_y = new_l_cop_y;
732  data_changed = true;
733 }
734 
735 /** Get r_cop_x value.
736  * Center of pressure X for right foot.
737  * @return r_cop_x value
738  */
739 float
741 {
742  return data->r_cop_x;
743 }
744 
745 /** Get maximum length of r_cop_x value.
746  * @return length of r_cop_x value, can be length of the array or number of
747  * maximum number of characters for a string
748  */
749 size_t
751 {
752  return 1;
753 }
754 
755 /** Set r_cop_x value.
756  * Center of pressure X for right foot.
757  * @param new_r_cop_x new r_cop_x value
758  */
759 void
760 NaoSensorInterface::set_r_cop_x(const float new_r_cop_x)
761 {
762  data->r_cop_x = new_r_cop_x;
763  data_changed = true;
764 }
765 
766 /** Get r_cop_y value.
767  * Center of pressure Y for right foot.
768  * @return r_cop_y value
769  */
770 float
772 {
773  return data->r_cop_y;
774 }
775 
776 /** Get maximum length of r_cop_y value.
777  * @return length of r_cop_y value, can be length of the array or number of
778  * maximum number of characters for a string
779  */
780 size_t
782 {
783  return 1;
784 }
785 
786 /** Set r_cop_y value.
787  * Center of pressure Y for right foot.
788  * @param new_r_cop_y new r_cop_y value
789  */
790 void
791 NaoSensorInterface::set_r_cop_y(const float new_r_cop_y)
792 {
793  data->r_cop_y = new_r_cop_y;
794  data_changed = true;
795 }
796 
797 /** Get ultrasonic_distance_left value.
798  *
799  First four ultrasonic sensor readings from left receiver. Distance
800  to detected object is in meters.
801 
802  * @return ultrasonic_distance_left value
803  */
804 float *
806 {
807  return data->ultrasonic_distance_left;
808 }
809 
810 /** Get ultrasonic_distance_left value at given index.
811  *
812  First four ultrasonic sensor readings from left receiver. Distance
813  to detected object is in meters.
814 
815  * @param index index of value
816  * @return ultrasonic_distance_left value
817  * @exception Exception thrown if index is out of bounds
818  */
819 float
821 {
822  if (index > 4) {
823  throw Exception("Index value %u out of bounds (0..4)", index);
824  }
825  return data->ultrasonic_distance_left[index];
826 }
827 
828 /** Get maximum length of ultrasonic_distance_left value.
829  * @return length of ultrasonic_distance_left value, can be length of the array or number of
830  * maximum number of characters for a string
831  */
832 size_t
834 {
835  return 4;
836 }
837 
838 /** Set ultrasonic_distance_left value.
839  *
840  First four ultrasonic sensor readings from left receiver. Distance
841  to detected object is in meters.
842 
843  * @param new_ultrasonic_distance_left new ultrasonic_distance_left value
844  */
845 void
846 NaoSensorInterface::set_ultrasonic_distance_left(const float * new_ultrasonic_distance_left)
847 {
848  memcpy(data->ultrasonic_distance_left, new_ultrasonic_distance_left, sizeof(float) * 4);
849  data_changed = true;
850 }
851 
852 /** Set ultrasonic_distance_left value at given index.
853  *
854  First four ultrasonic sensor readings from left receiver. Distance
855  to detected object is in meters.
856 
857  * @param new_ultrasonic_distance_left new ultrasonic_distance_left value
858  * @param index index for of the value
859  */
860 void
861 NaoSensorInterface::set_ultrasonic_distance_left(unsigned int index, const float new_ultrasonic_distance_left)
862 {
863  if (index > 4) {
864  throw Exception("Index value %u out of bounds (0..4)", index);
865  }
866  data->ultrasonic_distance_left[index] = new_ultrasonic_distance_left;
867  data_changed = true;
868 }
869 /** Get ultrasonic_distance_right value.
870  *
871  First four ultrasonic sensor readings from right receiver. Distance
872  to detected object is in meters.
873 
874  * @return ultrasonic_distance_right value
875  */
876 float *
878 {
879  return data->ultrasonic_distance_right;
880 }
881 
882 /** Get ultrasonic_distance_right value at given index.
883  *
884  First four ultrasonic sensor readings from right receiver. Distance
885  to detected object is in meters.
886 
887  * @param index index of value
888  * @return ultrasonic_distance_right value
889  * @exception Exception thrown if index is out of bounds
890  */
891 float
893 {
894  if (index > 4) {
895  throw Exception("Index value %u out of bounds (0..4)", index);
896  }
897  return data->ultrasonic_distance_right[index];
898 }
899 
900 /** Get maximum length of ultrasonic_distance_right value.
901  * @return length of ultrasonic_distance_right value, can be length of the array or number of
902  * maximum number of characters for a string
903  */
904 size_t
906 {
907  return 4;
908 }
909 
910 /** Set ultrasonic_distance_right value.
911  *
912  First four ultrasonic sensor readings from right receiver. Distance
913  to detected object is in meters.
914 
915  * @param new_ultrasonic_distance_right new ultrasonic_distance_right value
916  */
917 void
918 NaoSensorInterface::set_ultrasonic_distance_right(const float * new_ultrasonic_distance_right)
919 {
920  memcpy(data->ultrasonic_distance_right, new_ultrasonic_distance_right, sizeof(float) * 4);
921  data_changed = true;
922 }
923 
924 /** Set ultrasonic_distance_right value at given index.
925  *
926  First four ultrasonic sensor readings from right receiver. Distance
927  to detected object is in meters.
928 
929  * @param new_ultrasonic_distance_right new ultrasonic_distance_right value
930  * @param index index for of the value
931  */
932 void
933 NaoSensorInterface::set_ultrasonic_distance_right(unsigned int index, const float new_ultrasonic_distance_right)
934 {
935  if (index > 4) {
936  throw Exception("Index value %u out of bounds (0..4)", index);
937  }
938  data->ultrasonic_distance_right[index] = new_ultrasonic_distance_right;
939  data_changed = true;
940 }
941 /** Get ultrasonic_direction value.
942  *
943  Direction that was used to gather the ultrasonic readings.
944 
945  * @return ultrasonic_direction value
946  */
949 {
950  return (NaoSensorInterface::UltrasonicDirection)data->ultrasonic_direction;
951 }
952 
953 /** Get maximum length of ultrasonic_direction value.
954  * @return length of ultrasonic_direction value, can be length of the array or number of
955  * maximum number of characters for a string
956  */
957 size_t
959 {
960  return 1;
961 }
962 
963 /** Set ultrasonic_direction value.
964  *
965  Direction that was used to gather the ultrasonic readings.
966 
967  * @param new_ultrasonic_direction new ultrasonic_direction value
968  */
969 void
971 {
972  data->ultrasonic_direction = new_ultrasonic_direction;
973  data_changed = true;
974 }
975 
976 /** Get l_foot_bumper_l value.
977  * Left foot bumper left side
978  * @return l_foot_bumper_l value
979  */
980 uint8_t
982 {
983  return data->l_foot_bumper_l;
984 }
985 
986 /** Get maximum length of l_foot_bumper_l value.
987  * @return length of l_foot_bumper_l value, can be length of the array or number of
988  * maximum number of characters for a string
989  */
990 size_t
992 {
993  return 1;
994 }
995 
996 /** Set l_foot_bumper_l value.
997  * Left foot bumper left side
998  * @param new_l_foot_bumper_l new l_foot_bumper_l value
999  */
1000 void
1001 NaoSensorInterface::set_l_foot_bumper_l(const uint8_t new_l_foot_bumper_l)
1002 {
1003  data->l_foot_bumper_l = new_l_foot_bumper_l;
1004  data_changed = true;
1005 }
1006 
1007 /** Get l_foot_bumper_r value.
1008  * Left foot bumper right side
1009  * @return l_foot_bumper_r value
1010  */
1011 uint8_t
1013 {
1014  return data->l_foot_bumper_r;
1015 }
1016 
1017 /** Get maximum length of l_foot_bumper_r value.
1018  * @return length of l_foot_bumper_r value, can be length of the array or number of
1019  * maximum number of characters for a string
1020  */
1021 size_t
1023 {
1024  return 1;
1025 }
1026 
1027 /** Set l_foot_bumper_r value.
1028  * Left foot bumper right side
1029  * @param new_l_foot_bumper_r new l_foot_bumper_r value
1030  */
1031 void
1032 NaoSensorInterface::set_l_foot_bumper_r(const uint8_t new_l_foot_bumper_r)
1033 {
1034  data->l_foot_bumper_r = new_l_foot_bumper_r;
1035  data_changed = true;
1036 }
1037 
1038 /** Get r_foot_bumper_l value.
1039  * Right foot bumper left side
1040  * @return r_foot_bumper_l value
1041  */
1042 uint8_t
1044 {
1045  return data->r_foot_bumper_l;
1046 }
1047 
1048 /** Get maximum length of r_foot_bumper_l value.
1049  * @return length of r_foot_bumper_l value, can be length of the array or number of
1050  * maximum number of characters for a string
1051  */
1052 size_t
1054 {
1055  return 1;
1056 }
1057 
1058 /** Set r_foot_bumper_l value.
1059  * Right foot bumper left side
1060  * @param new_r_foot_bumper_l new r_foot_bumper_l value
1061  */
1062 void
1063 NaoSensorInterface::set_r_foot_bumper_l(const uint8_t new_r_foot_bumper_l)
1064 {
1065  data->r_foot_bumper_l = new_r_foot_bumper_l;
1066  data_changed = true;
1067 }
1068 
1069 /** Get r_foot_bumper_r value.
1070  * Right foot bumper right side
1071  * @return r_foot_bumper_r value
1072  */
1073 uint8_t
1075 {
1076  return data->r_foot_bumper_r;
1077 }
1078 
1079 /** Get maximum length of r_foot_bumper_r value.
1080  * @return length of r_foot_bumper_r value, can be length of the array or number of
1081  * maximum number of characters for a string
1082  */
1083 size_t
1085 {
1086  return 1;
1087 }
1088 
1089 /** Set r_foot_bumper_r value.
1090  * Right foot bumper right side
1091  * @param new_r_foot_bumper_r new r_foot_bumper_r value
1092  */
1093 void
1094 NaoSensorInterface::set_r_foot_bumper_r(const uint8_t new_r_foot_bumper_r)
1095 {
1096  data->r_foot_bumper_r = new_r_foot_bumper_r;
1097  data_changed = true;
1098 }
1099 
1100 /** Get head_touch_front value.
1101  * Front part of head touch sensor (only Academics robot)
1102  * @return head_touch_front value
1103  */
1104 uint8_t
1106 {
1107  return data->head_touch_front;
1108 }
1109 
1110 /** Get maximum length of head_touch_front value.
1111  * @return length of head_touch_front value, can be length of the array or number of
1112  * maximum number of characters for a string
1113  */
1114 size_t
1116 {
1117  return 1;
1118 }
1119 
1120 /** Set head_touch_front value.
1121  * Front part of head touch sensor (only Academics robot)
1122  * @param new_head_touch_front new head_touch_front value
1123  */
1124 void
1125 NaoSensorInterface::set_head_touch_front(const uint8_t new_head_touch_front)
1126 {
1127  data->head_touch_front = new_head_touch_front;
1128  data_changed = true;
1129 }
1130 
1131 /** Get head_touch_middle value.
1132  * Middle part of head touch sensor (only Academics robot)
1133  * @return head_touch_middle value
1134  */
1135 uint8_t
1137 {
1138  return data->head_touch_middle;
1139 }
1140 
1141 /** Get maximum length of head_touch_middle value.
1142  * @return length of head_touch_middle value, can be length of the array or number of
1143  * maximum number of characters for a string
1144  */
1145 size_t
1147 {
1148  return 1;
1149 }
1150 
1151 /** Set head_touch_middle value.
1152  * Middle part of head touch sensor (only Academics robot)
1153  * @param new_head_touch_middle new head_touch_middle value
1154  */
1155 void
1156 NaoSensorInterface::set_head_touch_middle(const uint8_t new_head_touch_middle)
1157 {
1158  data->head_touch_middle = new_head_touch_middle;
1159  data_changed = true;
1160 }
1161 
1162 /** Get head_touch_rear value.
1163  * Rear part of head touch sensor (only Academics robot)
1164  * @return head_touch_rear value
1165  */
1166 uint8_t
1168 {
1169  return data->head_touch_rear;
1170 }
1171 
1172 /** Get maximum length of head_touch_rear value.
1173  * @return length of head_touch_rear value, can be length of the array or number of
1174  * maximum number of characters for a string
1175  */
1176 size_t
1178 {
1179  return 1;
1180 }
1181 
1182 /** Set head_touch_rear value.
1183  * Rear part of head touch sensor (only Academics robot)
1184  * @param new_head_touch_rear new head_touch_rear value
1185  */
1186 void
1187 NaoSensorInterface::set_head_touch_rear(const uint8_t new_head_touch_rear)
1188 {
1189  data->head_touch_rear = new_head_touch_rear;
1190  data_changed = true;
1191 }
1192 
1193 /** Get chest_button value.
1194  * Chest button state
1195  * @return chest_button value
1196  */
1197 uint8_t
1199 {
1200  return data->chest_button;
1201 }
1202 
1203 /** Get maximum length of chest_button value.
1204  * @return length of chest_button value, can be length of the array or number of
1205  * maximum number of characters for a string
1206  */
1207 size_t
1209 {
1210  return 1;
1211 }
1212 
1213 /** Set chest_button value.
1214  * Chest button state
1215  * @param new_chest_button new chest_button value
1216  */
1217 void
1218 NaoSensorInterface::set_chest_button(const uint8_t new_chest_button)
1219 {
1220  data->chest_button = new_chest_button;
1221  data_changed = true;
1222 }
1223 
1224 /** Get battery_charge value.
1225  * Battery charge
1226  * @return battery_charge value
1227  */
1228 float
1230 {
1231  return data->battery_charge;
1232 }
1233 
1234 /** Get maximum length of battery_charge value.
1235  * @return length of battery_charge value, can be length of the array or number of
1236  * maximum number of characters for a string
1237  */
1238 size_t
1240 {
1241  return 1;
1242 }
1243 
1244 /** Set battery_charge value.
1245  * Battery charge
1246  * @param new_battery_charge new battery_charge value
1247  */
1248 void
1249 NaoSensorInterface::set_battery_charge(const float new_battery_charge)
1250 {
1251  data->battery_charge = new_battery_charge;
1252  data_changed = true;
1253 }
1254 
1255 /* =========== message create =========== */
1256 Message *
1257 NaoSensorInterface::create_message(const char *type) const
1258 {
1259  if ( strncmp("EmitUltrasonicWaveMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
1260  return new EmitUltrasonicWaveMessage();
1261  } else if ( strncmp("StartUltrasonicMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
1262  return new StartUltrasonicMessage();
1263  } else if ( strncmp("StopUltrasonicMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
1264  return new StopUltrasonicMessage();
1265  } else {
1266  throw UnknownTypeException("The given type '%s' does not match any known "
1267  "message type for this interface type.", type);
1268  }
1269 }
1270 
1271 
1272 /** Copy values from other interface.
1273  * @param other other interface to copy values from
1274  */
1275 void
1277 {
1278  const NaoSensorInterface *oi = dynamic_cast<const NaoSensorInterface *>(other);
1279  if (oi == NULL) {
1280  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
1281  type(), other->type());
1282  }
1283  memcpy(data, oi->data, sizeof(NaoSensorInterface_data_t));
1284 }
1285 
1286 const char *
1287 NaoSensorInterface::enum_tostring(const char *enumtype, int val) const
1288 {
1289  if (strcmp(enumtype, "UltrasonicDirection") == 0) {
1291  }
1292  throw UnknownTypeException("Unknown enum type %s", enumtype);
1293 }
1294 
1295 /* =========== messages =========== */
1296 /** @class NaoSensorInterface::EmitUltrasonicWaveMessage <interfaces/NaoSensorInterface.h>
1297  * EmitUltrasonicWaveMessage Fawkes BlackBoard Interface Message.
1298  *
1299 
1300  */
1301 
1302 
1303 /** Constructor with initial values.
1304  * @param ini_ultrasonic_direction initial value for ultrasonic_direction
1305  */
1307 {
1308  data_size = sizeof(EmitUltrasonicWaveMessage_data_t);
1309  data_ptr = malloc(data_size);
1310  memset(data_ptr, 0, data_size);
1311  data = (EmitUltrasonicWaveMessage_data_t *)data_ptr;
1313  data->ultrasonic_direction = ini_ultrasonic_direction;
1314  add_fieldinfo(IFT_ENUM, "ultrasonic_direction", 1, &data->ultrasonic_direction, "UltrasonicDirection");
1315 }
1316 /** Constructor */
1318 {
1319  data_size = sizeof(EmitUltrasonicWaveMessage_data_t);
1320  data_ptr = malloc(data_size);
1321  memset(data_ptr, 0, data_size);
1322  data = (EmitUltrasonicWaveMessage_data_t *)data_ptr;
1324  add_fieldinfo(IFT_ENUM, "ultrasonic_direction", 1, &data->ultrasonic_direction, "UltrasonicDirection");
1325 }
1326 
1327 /** Destructor */
1329 {
1330  free(data_ptr);
1331 }
1332 
1333 /** Copy constructor.
1334  * @param m message to copy from
1335  */
1337 {
1338  data_size = m->data_size;
1339  data_ptr = malloc(data_size);
1340  memcpy(data_ptr, m->data_ptr, data_size);
1341  data = (EmitUltrasonicWaveMessage_data_t *)data_ptr;
1343 }
1344 
1345 /* Methods */
1346 /** Get ultrasonic_direction value.
1347  *
1348  Direction that was used to gather the ultrasonic readings.
1349 
1350  * @return ultrasonic_direction value
1351  */
1354 {
1355  return (NaoSensorInterface::UltrasonicDirection)data->ultrasonic_direction;
1356 }
1357 
1358 /** Get maximum length of ultrasonic_direction value.
1359  * @return length of ultrasonic_direction value, can be length of the array or number of
1360  * maximum number of characters for a string
1361  */
1362 size_t
1364 {
1365  return 1;
1366 }
1367 
1368 /** Set ultrasonic_direction value.
1369  *
1370  Direction that was used to gather the ultrasonic readings.
1371 
1372  * @param new_ultrasonic_direction new ultrasonic_direction value
1373  */
1374 void
1376 {
1377  data->ultrasonic_direction = new_ultrasonic_direction;
1378 }
1379 
1380 /** Clone this message.
1381  * Produces a message of the same type as this message and copies the
1382  * data to the new message.
1383  * @return clone of this message
1384  */
1385 Message *
1387 {
1389 }
1390 /** @class NaoSensorInterface::StartUltrasonicMessage <interfaces/NaoSensorInterface.h>
1391  * StartUltrasonicMessage Fawkes BlackBoard Interface Message.
1392  *
1393 
1394  */
1395 
1396 
1397 /** Constructor with initial values.
1398  * @param ini_ultrasonic_direction initial value for ultrasonic_direction
1399  */
1401 {
1402  data_size = sizeof(StartUltrasonicMessage_data_t);
1403  data_ptr = malloc(data_size);
1404  memset(data_ptr, 0, data_size);
1405  data = (StartUltrasonicMessage_data_t *)data_ptr;
1407  data->ultrasonic_direction = ini_ultrasonic_direction;
1408  add_fieldinfo(IFT_ENUM, "ultrasonic_direction", 1, &data->ultrasonic_direction, "UltrasonicDirection");
1409 }
1410 /** Constructor */
1412 {
1413  data_size = sizeof(StartUltrasonicMessage_data_t);
1414  data_ptr = malloc(data_size);
1415  memset(data_ptr, 0, data_size);
1416  data = (StartUltrasonicMessage_data_t *)data_ptr;
1418  add_fieldinfo(IFT_ENUM, "ultrasonic_direction", 1, &data->ultrasonic_direction, "UltrasonicDirection");
1419 }
1420 
1421 /** Destructor */
1423 {
1424  free(data_ptr);
1425 }
1426 
1427 /** Copy constructor.
1428  * @param m message to copy from
1429  */
1431 {
1432  data_size = m->data_size;
1433  data_ptr = malloc(data_size);
1434  memcpy(data_ptr, m->data_ptr, data_size);
1435  data = (StartUltrasonicMessage_data_t *)data_ptr;
1437 }
1438 
1439 /* Methods */
1440 /** Get ultrasonic_direction value.
1441  *
1442  Direction that was used to gather the ultrasonic readings.
1443 
1444  * @return ultrasonic_direction value
1445  */
1448 {
1449  return (NaoSensorInterface::UltrasonicDirection)data->ultrasonic_direction;
1450 }
1451 
1452 /** Get maximum length of ultrasonic_direction value.
1453  * @return length of ultrasonic_direction value, can be length of the array or number of
1454  * maximum number of characters for a string
1455  */
1456 size_t
1458 {
1459  return 1;
1460 }
1461 
1462 /** Set ultrasonic_direction value.
1463  *
1464  Direction that was used to gather the ultrasonic readings.
1465 
1466  * @param new_ultrasonic_direction new ultrasonic_direction value
1467  */
1468 void
1470 {
1471  data->ultrasonic_direction = new_ultrasonic_direction;
1472 }
1473 
1474 /** Clone this message.
1475  * Produces a message of the same type as this message and copies the
1476  * data to the new message.
1477  * @return clone of this message
1478  */
1479 Message *
1481 {
1483 }
1484 /** @class NaoSensorInterface::StopUltrasonicMessage <interfaces/NaoSensorInterface.h>
1485  * StopUltrasonicMessage Fawkes BlackBoard Interface Message.
1486  *
1487 
1488  */
1489 
1490 
1491 /** Constructor */
1493 {
1494  data_size = sizeof(StopUltrasonicMessage_data_t);
1495  data_ptr = malloc(data_size);
1496  memset(data_ptr, 0, data_size);
1497  data = (StopUltrasonicMessage_data_t *)data_ptr;
1499 }
1500 
1501 /** Destructor */
1503 {
1504  free(data_ptr);
1505 }
1506 
1507 /** Copy constructor.
1508  * @param m message to copy from
1509  */
1511 {
1512  data_size = m->data_size;
1513  data_ptr = malloc(data_size);
1514  memcpy(data_ptr, m->data_ptr, data_size);
1515  data = (StopUltrasonicMessage_data_t *)data_ptr;
1517 }
1518 
1519 /* Methods */
1520 /** Clone this message.
1521  * Produces a message of the same type as this message and copies the
1522  * data to the new message.
1523  * @return clone of this message
1524  */
1525 Message *
1527 {
1529 }
1530 /** Check if message is valid and can be enqueued.
1531  * @param message Message to check
1532  * @return true if the message is valid, false otherwise.
1533  */
1534 bool
1536 {
1537  const EmitUltrasonicWaveMessage *m0 = dynamic_cast<const EmitUltrasonicWaveMessage *>(message);
1538  if ( m0 != NULL ) {
1539  return true;
1540  }
1541  const StartUltrasonicMessage *m1 = dynamic_cast<const StartUltrasonicMessage *>(message);
1542  if ( m1 != NULL ) {
1543  return true;
1544  }
1545  const StopUltrasonicMessage *m2 = dynamic_cast<const StopUltrasonicMessage *>(message);
1546  if ( m2 != NULL ) {
1547  return true;
1548  }
1549  return false;
1550 }
1551 
1552 /// @cond INTERNALS
1553 EXPORT_INTERFACE(NaoSensorInterface)
1554 /// @endcond
1555 
1556 
1557 } // end namespace fawkes
size_t maxlenof_ultrasonic_distance_left() const
Get maximum length of ultrasonic_distance_left value.
size_t maxlenof_r_fsr_fr() const
Get maximum length of r_fsr_fr value.
float r_fsr_fr() const
Get r_fsr_fr value.
float accel_x() const
Get accel_x value.
size_t maxlenof_ultrasonic_direction() const
Get maximum length of ultrasonic_direction value.
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:114
void set_l_fsr_rl(const float new_l_fsr_rl)
Set l_fsr_rl value.
float accel_y() const
Get accel_y value.
size_t maxlenof_r_foot_bumper_r() const
Get maximum length of r_foot_bumper_r value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:43
float l_fsr_rl() const
Get l_fsr_rl value.
float l_fsr_fr() const
Get l_fsr_fr value.
void set_r_foot_bumper_r(const uint8_t new_r_foot_bumper_r)
Set r_foot_bumper_r value.
float r_fsr_rr() const
Get r_fsr_rr value.
void set_accel_x(const float new_accel_x)
Set accel_x value.
size_t maxlenof_gyro_y() const
Get maximum length of gyro_y value.
size_t maxlenof_l_cop_x() const
Get maximum length of l_cop_x value.
StopUltrasonicMessage Fawkes BlackBoard Interface Message.
float r_fsr_fl() const
Get r_fsr_fl value.
void set_l_fsr_fl(const float new_l_fsr_fl)
Set l_fsr_fl value.
size_t maxlenof_l_fsr_rl() const
Get maximum length of l_fsr_rl value.
size_t maxlenof_r_fsr_rr() const
Get maximum length of r_fsr_rr value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
UltrasonicDirection ultrasonic_direction() const
Get ultrasonic_direction value.
size_t maxlenof_l_fsr_rr() const
Get maximum length of l_fsr_rr value.
void set_hash(unsigned char *ihash)
Set hash.
Definition: interface.cpp:312
void set_head_touch_front(const uint8_t new_head_touch_front)
Set head_touch_front value.
float r_cop_x() const
Get r_cop_x value.
void set_chest_button(const uint8_t new_chest_button)
Set chest_button value.
float gyro_ref() const
Get gyro_ref value.
void set_accel_z(const float new_accel_z)
Set accel_z value.
8 bit unsigned integer field
Definition: types.h:36
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
Definition: message.h:119
Right emitter and right receiver.
unsigned int data_size
Minimal data size to hold data storage.
Definition: interface.h:207
void set_l_fsr_rr(const float new_l_fsr_rr)
Set l_fsr_rr value.
size_t maxlenof_l_foot_bumper_l() const
Get maximum length of l_foot_bumper_l value.
Right emitter and left receiver.
size_t maxlenof_angle_y() const
Get maximum length of angle_y value.
virtual Message * clone() const
Clone this message.
void set_ultrasonic_direction(const UltrasonicDirection new_ultrasonic_direction)
Set ultrasonic_direction value.
size_t maxlenof_accel_z() const
Get maximum length of accel_z value.
float * ultrasonic_distance_left() const
Get ultrasonic_distance_left value.
uint8_t l_foot_bumper_r() const
Get l_foot_bumper_r value.
void set_l_total_weight(const float new_l_total_weight)
Set l_total_weight value.
size_t maxlenof_accel_y() const
Get maximum length of accel_y value.
float angle_x() const
Get angle_x value.
StartUltrasonicMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_r_cop_y() const
Get maximum length of r_cop_y value.
void set_r_total_weight(const float new_r_total_weight)
Set r_total_weight value.
uint8_t l_foot_bumper_l() const
Get l_foot_bumper_l value.
float gyro_x() const
Get gyro_x value.
void set_ultrasonic_direction(const UltrasonicDirection new_ultrasonic_direction)
Set ultrasonic_direction value.
float * ultrasonic_distance_right() const
Get ultrasonic_distance_right value.
size_t maxlenof_gyro_x() const
Get maximum length of gyro_x value.
NaoSensorInterface Fawkes BlackBoard Interface.
void set_l_cop_y(const float new_l_cop_y)
Set l_cop_y value.
size_t maxlenof_head_touch_middle() const
Get maximum length of head_touch_middle value.
size_t maxlenof_ultrasonic_direction() const
Get maximum length of ultrasonic_direction value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
void set_gyro_y(const float new_gyro_y)
Set gyro_y value.
float l_cop_y() const
Get l_cop_y value.
void set_battery_charge(const float new_battery_charge)
Set battery_charge value.
UltrasonicDirection ultrasonic_direction() const
Get ultrasonic_direction value.
float angle_y() const
Get angle_y value.
uint8_t r_foot_bumper_r() const
Get r_foot_bumper_r value.
size_t maxlenof_r_fsr_rl() const
Get maximum length of r_fsr_rl value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:123
uint8_t head_touch_middle() const
Get head_touch_middle value.
size_t maxlenof_accel_x() const
Get maximum length of accel_x value.
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:115
size_t maxlenof_ultrasonic_direction() const
Get maximum length of ultrasonic_direction value.
void set_r_fsr_fr(const float new_r_fsr_fr)
Set r_fsr_fr value.
size_t maxlenof_chest_button() const
Get maximum length of chest_button value.
size_t maxlenof_gyro_ref() const
Get maximum length of gyro_ref value.
size_t maxlenof_l_foot_bumper_r() const
Get maximum length of l_foot_bumper_r value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
Definition: interface.cpp:368
void set_ultrasonic_distance_right(unsigned int index, const float new_ultrasonic_distance_right)
Set ultrasonic_distance_right value at given index.
virtual void copy_values(const Interface *other)
Copy values from other interface.
bool data_changed
Indicator if data has changed.
Definition: interface.h:208
void set_r_fsr_fl(const float new_r_fsr_fl)
Set r_fsr_fl value.
UltrasonicDirection
This determines the chosen sender/receiver.
void set_r_cop_y(const float new_r_cop_y)
Set r_cop_y value.
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:206
Base class for exceptions in Fawkes.
Definition: exception.h:36
void set_gyro_x(const float new_gyro_x)
Set gyro_x value.
Both emitters and both receivers.
uint8_t head_touch_front() const
Get head_touch_front value.
void set_angle_y(const float new_angle_y)
Set angle_y value.
Left emitter and left receiver.
void set_accel_y(const float new_accel_y)
Set accel_y value.
size_t maxlenof_r_foot_bumper_l() const
Get maximum length of r_foot_bumper_l value.
void set_l_foot_bumper_r(const uint8_t new_l_foot_bumper_r)
Set l_foot_bumper_r value.
size_t maxlenof_l_cop_y() const
Get maximum length of l_cop_y value.
const char * tostring_UltrasonicDirection(UltrasonicDirection value) const
Convert UltrasonicDirection constant to string.
float l_cop_x() const
Get l_cop_x value.
size_t maxlenof_r_cop_x() const
Get maximum length of r_cop_x value.
float l_fsr_fl() const
Get l_fsr_fl value.
size_t maxlenof_l_total_weight() const
Get maximum length of l_total_weight value.
void set_l_cop_x(const float new_l_cop_x)
Set l_cop_x value.
float accel_z() const
Get accel_z value.
void set_r_foot_bumper_l(const uint8_t new_r_foot_bumper_l)
Set r_foot_bumper_l value.
void set_l_fsr_fr(const float new_l_fsr_fr)
Set l_fsr_fr value.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0)
Add an entry to the field info list.
Definition: interface.cpp:332
void set_head_touch_rear(const uint8_t new_head_touch_rear)
Set head_touch_rear value.
float field
Definition: types.h:43
size_t maxlenof_ultrasonic_distance_right() const
Get maximum length of ultrasonic_distance_right value.
uint8_t head_touch_rear() const
Get head_touch_rear value.
size_t maxlenof_angle_x() const
Get maximum length of angle_x value.
void set_l_foot_bumper_l(const uint8_t new_l_foot_bumper_l)
Set l_foot_bumper_l value.
size_t maxlenof_l_fsr_fl() const
Get maximum length of l_fsr_fl value.
size_t maxlenof_head_touch_front() const
Get maximum length of head_touch_front value.
size_t maxlenof_head_touch_rear() const
Get maximum length of head_touch_rear value.
virtual Message * create_message(const char *type) const
Create message based on type name.
float gyro_y() const
Get gyro_y value.
uint8_t r_foot_bumper_l() const
Get r_foot_bumper_l value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
float battery_charge() const
Get battery_charge value.
size_t maxlenof_l_fsr_fr() const
Get maximum length of l_fsr_fr value.
void set_r_fsr_rl(const float new_r_fsr_rl)
Set r_fsr_rl value.
size_t maxlenof_battery_charge() const
Get maximum length of battery_charge value.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0)
Add an entry to the info list.
Definition: message.cpp:435
EmitUltrasonicWaveMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_r_fsr_fl() const
Get maximum length of r_fsr_fl value.
void set_ultrasonic_distance_left(unsigned int index, const float new_ultrasonic_distance_left)
Set ultrasonic_distance_left value at given index.
void set_r_fsr_rr(const float new_r_fsr_rr)
Set r_fsr_rr value.
UltrasonicDirection ultrasonic_direction() const
Get ultrasonic_direction value.
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
Definition: interface.h:216
float r_cop_y() const
Get r_cop_y value.
size_t maxlenof_r_total_weight() const
Get maximum length of r_total_weight value.
No transmission received, yet.
float l_total_weight() const
Get l_total_weight value.
virtual Message * clone() const
Clone this message.
float r_total_weight() const
Get r_total_weight value.
const char * type() const
Get type of interface.
Definition: interface.cpp:635
float l_fsr_rr() const
Get l_fsr_rr value.
void set_r_cop_x(const float new_r_cop_x)
Set r_cop_x value.
virtual Message * clone() const
Clone this message.
void set_ultrasonic_direction(const UltrasonicDirection new_ultrasonic_direction)
Set ultrasonic_direction value.
field with interface specific enum type
Definition: types.h:47
float r_fsr_rl() const
Get r_fsr_rl value.
void set_head_touch_middle(const uint8_t new_head_touch_middle)
Set head_touch_middle value.
Left emitter and right receiver.
uint8_t chest_button() const
Get chest_button value.
void set_angle_x(const float new_angle_x)
Set angle_x value.
void set_gyro_ref(const float new_gyro_ref)
Set gyro_ref value.