gusimplewhiteboard
HalArmTarget.hpp
Go to the documentation of this file.
1/*
2 * file HalArmTarget.hpp
3 *
4 * This file was generated by classgenerator from hal_arm_target.gen.
5 * DO NOT CHANGE MANUALLY!
6 *
7 * Copyright © 2021 Dimitri Joukoff. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials
19 * provided with the distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgement:
23 *
24 * This product includes software developed by Dimitri Joukoff.
25 *
26 * 4. Neither the name of the author nor the names of contributors
27 * may be used to endorse or promote products derived from this
28 * software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
34 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *
42 * -----------------------------------------------------------------------
43 * This program is free software; you can redistribute it and/or
44 * modify it under the above terms or under the terms of the GNU
45 * General Public License as published by the Free Software Foundation;
46 * either version 2 of the License, or (at your option) any later version.
47 *
48 * This program is distributed in the hope that it will be useful,
49 * but WITHOUT ANY WARRANTY; without even the implied warranty of
50 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51 * GNU General Public License for more details.
52 *
53 * You should have received a copy of the GNU General Public License
54 * along with this program; if not, see http://www.gnu.org/licenses/
55 * or write to the Free Software Foundation, Inc., 51 Franklin Street,
56 * Fifth Floor, Boston, MA 02110-1301, USA.
57 *
58 */
59
60#ifndef guWhiteboard_HalArmTarget_h
61#define guWhiteboard_HalArmTarget_h
62
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
64#include <cstdlib>
65#include <string.h>
66#include <sstream>
67#endif
68
69#include <gu_util.h>
70#include "wb_hal_arm_target.h"
71
72#undef guWhiteboard_HalArmTarget_DEFINED
73#define guWhiteboard_HalArmTarget_DEFINED
74
75#undef HalArmTarget_DEFINED
76#define HalArmTarget_DEFINED
77
78namespace guWhiteboard {
79
83 class HalArmTarget: public wb_hal_arm_target {
84
85 private:
86
90 void init(int32_t t_target_movement_time = INT_MAX, int16_t t_target_shoulderpitch = 0, int16_t t_target_shoulderroll = 0, int16_t t_target_elbowroll = 0, int16_t t_target_elbowyaw = 0, int16_t t_target_wristyaw = 0, uint8_t t_target_arm = LEFT_ARM, uint8_t t_target_hand = 0, uint8_t t_target_shoulderpitchstiffness = 0, uint8_t t_target_shoulderrollstiffness = 0, uint8_t t_target_elbowrollstiffness = 0, uint8_t t_target_elbowyawstiffness = 0, uint8_t t_target_wristyawstiffness = 0, uint8_t t_target_handstiffness = 0, uint8_t t_target_pliability = 0, unsigned int t_target_shoulderpitch_active = true, unsigned int t_target_shoulderroll_active = true, unsigned int t_target_elbowroll_active = true, unsigned int t_target_elbowyaw_active = true, unsigned int t_target_wrist_active = true, unsigned int t_target_hand_active = true, unsigned int t_target_arm_at_goal = false, unsigned int t_target_arm_stop = false) {
91 set_target_movement_time(t_target_movement_time);
92 set_target_shoulderpitch(t_target_shoulderpitch);
93 set_target_shoulderroll(t_target_shoulderroll);
94 set_target_elbowroll(t_target_elbowroll);
95 set_target_elbowyaw(t_target_elbowyaw);
96 set_target_wristyaw(t_target_wristyaw);
97 set_target_arm(t_target_arm);
98 set_target_hand(t_target_hand);
99 set_target_shoulderpitchstiffness(t_target_shoulderpitchstiffness);
100 set_target_shoulderrollstiffness(t_target_shoulderrollstiffness);
101 set_target_elbowrollstiffness(t_target_elbowrollstiffness);
102 set_target_elbowyawstiffness(t_target_elbowyawstiffness);
103 set_target_wristyawstiffness(t_target_wristyawstiffness);
104 set_target_handstiffness(t_target_handstiffness);
105 set_target_pliability(t_target_pliability);
106 set_target_shoulderpitch_active(t_target_shoulderpitch_active);
107 set_target_shoulderroll_active(t_target_shoulderroll_active);
108 set_target_elbowroll_active(t_target_elbowroll_active);
109 set_target_elbowyaw_active(t_target_elbowyaw_active);
110 set_target_wrist_active(t_target_wrist_active);
111 set_target_hand_active(t_target_hand_active);
112 set_target_arm_at_goal(t_target_arm_at_goal);
113 set_target_arm_stop(t_target_arm_stop);
114 }
115
116 public:
117
121 HalArmTarget(int32_t t_target_movement_time = INT_MAX, int16_t t_target_shoulderpitch = 0, int16_t t_target_shoulderroll = 0, int16_t t_target_elbowroll = 0, int16_t t_target_elbowyaw = 0, int16_t t_target_wristyaw = 0, uint8_t t_target_arm = LEFT_ARM, uint8_t t_target_hand = 0, uint8_t t_target_shoulderpitchstiffness = 0, uint8_t t_target_shoulderrollstiffness = 0, uint8_t t_target_elbowrollstiffness = 0, uint8_t t_target_elbowyawstiffness = 0, uint8_t t_target_wristyawstiffness = 0, uint8_t t_target_handstiffness = 0, uint8_t t_target_pliability = 0, unsigned int t_target_shoulderpitch_active = true, unsigned int t_target_shoulderroll_active = true, unsigned int t_target_elbowroll_active = true, unsigned int t_target_elbowyaw_active = true, unsigned int t_target_wrist_active = true, unsigned int t_target_hand_active = true, unsigned int t_target_arm_at_goal = false, unsigned int t_target_arm_stop = false) {
122 this->init(t_target_movement_time, t_target_shoulderpitch, t_target_shoulderroll, t_target_elbowroll, t_target_elbowyaw, t_target_wristyaw, t_target_arm, t_target_hand, t_target_shoulderpitchstiffness, t_target_shoulderrollstiffness, t_target_elbowrollstiffness, t_target_elbowyawstiffness, t_target_wristyawstiffness, t_target_handstiffness, t_target_pliability, t_target_shoulderpitch_active, t_target_shoulderroll_active, t_target_elbowroll_active, t_target_elbowyaw_active, t_target_wrist_active, t_target_hand_active, t_target_arm_at_goal, t_target_arm_stop);
123 }
124
129 this->init(t_other.target_movement_time(), t_other.target_shoulderpitch(), t_other.target_shoulderroll(), t_other.target_elbowroll(), t_other.target_elbowyaw(), t_other.target_wristyaw(), t_other.target_arm(), t_other.target_hand(), t_other.target_shoulderpitchstiffness(), t_other.target_shoulderrollstiffness(), t_other.target_elbowrollstiffness(), t_other.target_elbowyawstiffness(), t_other.target_wristyawstiffness(), t_other.target_handstiffness(), t_other.target_pliability(), t_other.target_shoulderpitch_active(), t_other.target_shoulderroll_active(), t_other.target_elbowroll_active(), t_other.target_elbowyaw_active(), t_other.target_wrist_active(), t_other.target_hand_active(), t_other.target_arm_at_goal(), t_other.target_arm_stop());
130 }
131
137 }
138
143 this->init(t_other.target_movement_time(), t_other.target_shoulderpitch(), t_other.target_shoulderroll(), t_other.target_elbowroll(), t_other.target_elbowyaw(), t_other.target_wristyaw(), t_other.target_arm(), t_other.target_hand(), t_other.target_shoulderpitchstiffness(), t_other.target_shoulderrollstiffness(), t_other.target_elbowrollstiffness(), t_other.target_elbowyawstiffness(), t_other.target_wristyawstiffness(), t_other.target_handstiffness(), t_other.target_pliability(), t_other.target_shoulderpitch_active(), t_other.target_shoulderroll_active(), t_other.target_elbowroll_active(), t_other.target_elbowyaw_active(), t_other.target_wrist_active(), t_other.target_hand_active(), t_other.target_arm_at_goal(), t_other.target_arm_stop());
144 return *this;
145 }
146
152 return *this;
153 }
154
155 bool operator ==(const HalArmTarget &t_other) const
156 {
157 return target_movement_time() == t_other.target_movement_time()
158 && target_shoulderpitch() == t_other.target_shoulderpitch()
159 && target_shoulderroll() == t_other.target_shoulderroll()
160 && target_elbowroll() == t_other.target_elbowroll()
161 && target_elbowyaw() == t_other.target_elbowyaw()
162 && target_wristyaw() == t_other.target_wristyaw()
163 && target_arm() == t_other.target_arm()
164 && target_hand() == t_other.target_hand()
165 && target_shoulderpitchstiffness() == t_other.target_shoulderpitchstiffness()
166 && target_shoulderrollstiffness() == t_other.target_shoulderrollstiffness()
167 && target_elbowrollstiffness() == t_other.target_elbowrollstiffness()
168 && target_elbowyawstiffness() == t_other.target_elbowyawstiffness()
169 && target_wristyawstiffness() == t_other.target_wristyawstiffness()
170 && target_handstiffness() == t_other.target_handstiffness()
171 && target_pliability() == t_other.target_pliability()
172 && target_shoulderpitch_active() == t_other.target_shoulderpitch_active()
173 && target_shoulderroll_active() == t_other.target_shoulderroll_active()
174 && target_elbowroll_active() == t_other.target_elbowroll_active()
175 && target_elbowyaw_active() == t_other.target_elbowyaw_active()
176 && target_wrist_active() == t_other.target_wrist_active()
177 && target_hand_active() == t_other.target_hand_active()
178 && target_arm_at_goal() == t_other.target_arm_at_goal()
179 && target_arm_stop() == t_other.target_arm_stop();
180 }
181
182 bool operator !=(const HalArmTarget &t_other) const
183 {
184 return !(*this == t_other);
185 }
186
187 bool operator ==(const wb_hal_arm_target &t_other) const
188 {
189 return *this == HalArmTarget(t_other);
190 }
191
192 bool operator !=(const wb_hal_arm_target &t_other) const
193 {
194 return !(*this == t_other);
195 }
196
198 {
200 }
201
202 const int32_t & target_movement_time() const
203 {
205 }
206
207 void set_target_movement_time(const int32_t &t_newValue)
208 {
210 }
211
213 {
215 }
216
217 const int16_t & target_shoulderpitch() const
218 {
220 }
221
222 void set_target_shoulderpitch(const int16_t &t_newValue)
223 {
225 }
226
228 {
230 }
231
232 const int16_t & target_shoulderroll() const
233 {
235 }
236
237 void set_target_shoulderroll(const int16_t &t_newValue)
238 {
240 }
241
243 {
245 }
246
247 const int16_t & target_elbowroll() const
248 {
250 }
251
252 void set_target_elbowroll(const int16_t &t_newValue)
253 {
255 }
256
257 int16_t & target_elbowyaw()
258 {
260 }
261
262 const int16_t & target_elbowyaw() const
263 {
265 }
266
267 void set_target_elbowyaw(const int16_t &t_newValue)
268 {
270 }
271
272 int16_t & target_wristyaw()
273 {
275 }
276
277 const int16_t & target_wristyaw() const
278 {
280 }
281
282 void set_target_wristyaw(const int16_t &t_newValue)
283 {
285 }
286
287 uint8_t & target_arm()
288 {
290 }
291
292 const uint8_t & target_arm() const
293 {
295 }
296
297 void set_target_arm(const uint8_t &t_newValue)
298 {
300 }
301
302 uint8_t & target_hand()
303 {
305 }
306
307 const uint8_t & target_hand() const
308 {
310 }
311
312 void set_target_hand(const uint8_t &t_newValue)
313 {
315 }
316
318 {
320 }
321
322 const uint8_t & target_shoulderpitchstiffness() const
323 {
325 }
326
327 void set_target_shoulderpitchstiffness(const uint8_t &t_newValue)
328 {
330 }
331
333 {
335 }
336
337 const uint8_t & target_shoulderrollstiffness() const
338 {
340 }
341
342 void set_target_shoulderrollstiffness(const uint8_t &t_newValue)
343 {
345 }
346
348 {
350 }
351
352 const uint8_t & target_elbowrollstiffness() const
353 {
355 }
356
357 void set_target_elbowrollstiffness(const uint8_t &t_newValue)
358 {
360 }
361
363 {
365 }
366
367 const uint8_t & target_elbowyawstiffness() const
368 {
370 }
371
372 void set_target_elbowyawstiffness(const uint8_t &t_newValue)
373 {
375 }
376
378 {
380 }
381
382 const uint8_t & target_wristyawstiffness() const
383 {
385 }
386
387 void set_target_wristyawstiffness(const uint8_t &t_newValue)
388 {
390 }
391
393 {
395 }
396
397 const uint8_t & target_handstiffness() const
398 {
400 }
401
402 void set_target_handstiffness(const uint8_t &t_newValue)
403 {
405 }
406
408 {
410 }
411
412 const uint8_t & target_pliability() const
413 {
415 }
416
417 void set_target_pliability(const uint8_t &t_newValue)
418 {
420 }
421
422 unsigned int target_shoulderpitch_active() const
423 {
425 }
426
427 void set_target_shoulderpitch_active(const unsigned int &t_newValue)
428 {
430 }
431
432 unsigned int target_shoulderroll_active() const
433 {
435 }
436
437 void set_target_shoulderroll_active(const unsigned int &t_newValue)
438 {
440 }
441
442 unsigned int target_elbowroll_active() const
443 {
445 }
446
447 void set_target_elbowroll_active(const unsigned int &t_newValue)
448 {
450 }
451
452 unsigned int target_elbowyaw_active() const
453 {
455 }
456
457 void set_target_elbowyaw_active(const unsigned int &t_newValue)
458 {
460 }
461
462 unsigned int target_wrist_active() const
463 {
465 }
466
467 void set_target_wrist_active(const unsigned int &t_newValue)
468 {
470 }
471
472 unsigned int target_hand_active() const
473 {
475 }
476
477 void set_target_hand_active(const unsigned int &t_newValue)
478 {
480 }
481
482 unsigned int target_arm_at_goal() const
483 {
485 }
486
487 void set_target_arm_at_goal(const unsigned int &t_newValue)
488 {
490 }
491
492 unsigned int target_arm_stop() const
493 {
495 }
496
497 void set_target_arm_stop(const unsigned int &t_newValue)
498 {
500 }
501
502#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
506 HalArmTarget(const std::string &t_str) {
507 this->init();
508 this->from_string(t_str);
509 }
510
511 std::string description() {
512#ifdef USE_WB_HAL_ARM_TARGET_C_CONVERSION
514 wb_hal_arm_target_description(this, buffer, sizeof(buffer));
515 std::string descr = buffer;
516 return descr;
517#else
518 std::ostringstream ss;
519 ss << "target_movement_time=" << static_cast<signed>(this->target_movement_time());
520 ss << ", ";
521 ss << "target_shoulderpitch=" << static_cast<signed>(this->target_shoulderpitch());
522 ss << ", ";
523 ss << "target_shoulderroll=" << static_cast<signed>(this->target_shoulderroll());
524 ss << ", ";
525 ss << "target_elbowroll=" << static_cast<signed>(this->target_elbowroll());
526 ss << ", ";
527 ss << "target_elbowyaw=" << static_cast<signed>(this->target_elbowyaw());
528 ss << ", ";
529 ss << "target_wristyaw=" << static_cast<signed>(this->target_wristyaw());
530 ss << ", ";
531 ss << "target_arm=" << static_cast<unsigned>(this->target_arm());
532 ss << ", ";
533 ss << "target_hand=" << static_cast<unsigned>(this->target_hand());
534 ss << ", ";
535 ss << "target_shoulderpitchstiffness=" << static_cast<unsigned>(this->target_shoulderpitchstiffness());
536 ss << ", ";
537 ss << "target_shoulderrollstiffness=" << static_cast<unsigned>(this->target_shoulderrollstiffness());
538 ss << ", ";
539 ss << "target_elbowrollstiffness=" << static_cast<unsigned>(this->target_elbowrollstiffness());
540 ss << ", ";
541 ss << "target_elbowyawstiffness=" << static_cast<unsigned>(this->target_elbowyawstiffness());
542 ss << ", ";
543 ss << "target_wristyawstiffness=" << static_cast<unsigned>(this->target_wristyawstiffness());
544 ss << ", ";
545 ss << "target_handstiffness=" << static_cast<unsigned>(this->target_handstiffness());
546 ss << ", ";
547 ss << "target_pliability=" << static_cast<unsigned>(this->target_pliability());
548 ss << ", ";
549 ss << "target_shoulderpitch_active=" << this->target_shoulderpitch_active();
550 ss << ", ";
551 ss << "target_shoulderroll_active=" << this->target_shoulderroll_active();
552 ss << ", ";
553 ss << "target_elbowroll_active=" << this->target_elbowroll_active();
554 ss << ", ";
555 ss << "target_elbowyaw_active=" << this->target_elbowyaw_active();
556 ss << ", ";
557 ss << "target_wrist_active=" << this->target_wrist_active();
558 ss << ", ";
559 ss << "target_hand_active=" << this->target_hand_active();
560 ss << ", ";
561 ss << "target_arm_at_goal=" << this->target_arm_at_goal();
562 ss << ", ";
563 ss << "target_arm_stop=" << this->target_arm_stop();
564 return ss.str();
565#endif
566 }
567
568 std::string to_string() {
569#ifdef USE_WB_HAL_ARM_TARGET_C_CONVERSION
571 wb_hal_arm_target_to_string(this, buffer, sizeof(buffer));
572 std::string toString = buffer;
573 return toString;
574#else
575 std::ostringstream ss;
576 ss << static_cast<signed>(this->target_movement_time());
577 ss << ", ";
578 ss << static_cast<signed>(this->target_shoulderpitch());
579 ss << ", ";
580 ss << static_cast<signed>(this->target_shoulderroll());
581 ss << ", ";
582 ss << static_cast<signed>(this->target_elbowroll());
583 ss << ", ";
584 ss << static_cast<signed>(this->target_elbowyaw());
585 ss << ", ";
586 ss << static_cast<signed>(this->target_wristyaw());
587 ss << ", ";
588 ss << static_cast<unsigned>(this->target_arm());
589 ss << ", ";
590 ss << static_cast<unsigned>(this->target_hand());
591 ss << ", ";
592 ss << static_cast<unsigned>(this->target_shoulderpitchstiffness());
593 ss << ", ";
594 ss << static_cast<unsigned>(this->target_shoulderrollstiffness());
595 ss << ", ";
596 ss << static_cast<unsigned>(this->target_elbowrollstiffness());
597 ss << ", ";
598 ss << static_cast<unsigned>(this->target_elbowyawstiffness());
599 ss << ", ";
600 ss << static_cast<unsigned>(this->target_wristyawstiffness());
601 ss << ", ";
602 ss << static_cast<unsigned>(this->target_handstiffness());
603 ss << ", ";
604 ss << static_cast<unsigned>(this->target_pliability());
605 ss << ", ";
606 ss << this->target_shoulderpitch_active();
607 ss << ", ";
608 ss << this->target_shoulderroll_active();
609 ss << ", ";
610 ss << this->target_elbowroll_active();
611 ss << ", ";
612 ss << this->target_elbowyaw_active();
613 ss << ", ";
614 ss << this->target_wrist_active();
615 ss << ", ";
616 ss << this->target_hand_active();
617 ss << ", ";
618 ss << this->target_arm_at_goal();
619 ss << ", ";
620 ss << this->target_arm_stop();
621 return ss.str();
622#endif
623 }
624
625#ifdef USE_WB_HAL_ARM_TARGET_C_CONVERSION
626 void from_string(const std::string &t_str) {
627 wb_hal_arm_target_from_string(this, t_str.c_str());
628#else
629 void from_string(const std::string &t_str) {
630 char * str_cstr = const_cast<char *>(t_str.c_str());
631 size_t temp_length = strlen(str_cstr);
632 int length = (temp_length <= INT_MAX) ? static_cast<int>(static_cast<ssize_t>(temp_length)) : -1;
633 if (length < 1 || length > HAL_ARM_TARGET_DESC_BUFFER_SIZE) {
634 return;
635 }
636 char var_str_buffer[HAL_ARM_TARGET_DESC_BUFFER_SIZE + 1];
637 char* var_str = &var_str_buffer[0];
638 char key_buffer[30];
639 char* key = &key_buffer[0];
640 int bracecount = 0;
641 int startVar = 0;
642 int index = 0;
643 int startKey = 0;
644 int endKey = -1;
645 int varIndex = 0;
646 if (index == 0 && str_cstr[0] == '{') {
647 index = 1;
648 }
649 startVar = index;
650 startKey = startVar;
651 do {
652 for (int i = index; i < length; i++) {
653 index = i + 1;
654 if (bracecount == 0 && str_cstr[i] == '=') {
655 endKey = i - 1;
656 startVar = index;
657 continue;
658 }
659 if (bracecount == 0 && isspace(str_cstr[i])) {
660 startVar = index;
661 if (endKey == -1) {
662 startKey = index;
663 }
664 continue;
665 }
666 if (bracecount == 0 && str_cstr[i] == ',') {
667 index = i - 1;
668 break;
669 }
670 if (str_cstr[i] == '{') {
671 bracecount++;
672 continue;
673 }
674 if (str_cstr[i] == '}') {
675 bracecount--;
676 if (bracecount < 0) {
677 index = i - 1;
678 break;
679 }
680 }
681 if (i == length - 1) {
682 index = i;
683 }
684 }
685 if (endKey >= startKey && endKey - startKey < length) {
686 strncpy(key, str_cstr + startKey, static_cast<size_t>((endKey - startKey) + 1));
687 key[(endKey - startKey) + 1] = 0;
688 } else {
689 key[0] = 0;
690 }
691 strncpy(var_str, str_cstr + startVar, static_cast<size_t>((index - startVar) + 1));
692 var_str[(index - startVar) + 1] = 0;
693 bracecount = 0;
694 index += 2;
695 startVar = index;
696 startKey = startVar;
697 endKey = -1;
698 if (strlen(key) > 0) {
699 if (0 == strcmp("target_movement_time", key)) {
700 varIndex = 0;
701 } else if (0 == strcmp("target_shoulderpitch", key)) {
702 varIndex = 1;
703 } else if (0 == strcmp("target_shoulderroll", key)) {
704 varIndex = 2;
705 } else if (0 == strcmp("target_elbowroll", key)) {
706 varIndex = 3;
707 } else if (0 == strcmp("target_elbowyaw", key)) {
708 varIndex = 4;
709 } else if (0 == strcmp("target_wristyaw", key)) {
710 varIndex = 5;
711 } else if (0 == strcmp("target_arm", key)) {
712 varIndex = 6;
713 } else if (0 == strcmp("target_hand", key)) {
714 varIndex = 7;
715 } else if (0 == strcmp("target_shoulderpitchstiffness", key)) {
716 varIndex = 8;
717 } else if (0 == strcmp("target_shoulderrollstiffness", key)) {
718 varIndex = 9;
719 } else if (0 == strcmp("target_elbowrollstiffness", key)) {
720 varIndex = 10;
721 } else if (0 == strcmp("target_elbowyawstiffness", key)) {
722 varIndex = 11;
723 } else if (0 == strcmp("target_wristyawstiffness", key)) {
724 varIndex = 12;
725 } else if (0 == strcmp("target_handstiffness", key)) {
726 varIndex = 13;
727 } else if (0 == strcmp("target_pliability", key)) {
728 varIndex = 14;
729 } else if (0 == strcmp("target_shoulderpitch_active", key)) {
730 varIndex = 15;
731 } else if (0 == strcmp("target_shoulderroll_active", key)) {
732 varIndex = 16;
733 } else if (0 == strcmp("target_elbowroll_active", key)) {
734 varIndex = 17;
735 } else if (0 == strcmp("target_elbowyaw_active", key)) {
736 varIndex = 18;
737 } else if (0 == strcmp("target_wrist_active", key)) {
738 varIndex = 19;
739 } else if (0 == strcmp("target_hand_active", key)) {
740 varIndex = 20;
741 } else if (0 == strcmp("target_arm_at_goal", key)) {
742 varIndex = 21;
743 } else if (0 == strcmp("target_arm_stop", key)) {
744 varIndex = 22;
745 } else {
746 varIndex = -1;
747 }
748 }
749 switch (varIndex) {
750 case -1: { break; }
751 case 0:
752 {
753 this->set_target_movement_time(static_cast<int32_t>(atoi(var_str)));
754 break;
755 }
756 case 1:
757 {
758 this->set_target_shoulderpitch(static_cast<int16_t>(atoi(var_str)));
759 break;
760 }
761 case 2:
762 {
763 this->set_target_shoulderroll(static_cast<int16_t>(atoi(var_str)));
764 break;
765 }
766 case 3:
767 {
768 this->set_target_elbowroll(static_cast<int16_t>(atoi(var_str)));
769 break;
770 }
771 case 4:
772 {
773 this->set_target_elbowyaw(static_cast<int16_t>(atoi(var_str)));
774 break;
775 }
776 case 5:
777 {
778 this->set_target_wristyaw(static_cast<int16_t>(atoi(var_str)));
779 break;
780 }
781 case 6:
782 {
783 this->set_target_arm(static_cast<uint8_t>(atoi(var_str)));
784 break;
785 }
786 case 7:
787 {
788 this->set_target_hand(static_cast<uint8_t>(atoi(var_str)));
789 break;
790 }
791 case 8:
792 {
793 this->set_target_shoulderpitchstiffness(static_cast<uint8_t>(atoi(var_str)));
794 break;
795 }
796 case 9:
797 {
798 this->set_target_shoulderrollstiffness(static_cast<uint8_t>(atoi(var_str)));
799 break;
800 }
801 case 10:
802 {
803 this->set_target_elbowrollstiffness(static_cast<uint8_t>(atoi(var_str)));
804 break;
805 }
806 case 11:
807 {
808 this->set_target_elbowyawstiffness(static_cast<uint8_t>(atoi(var_str)));
809 break;
810 }
811 case 12:
812 {
813 this->set_target_wristyawstiffness(static_cast<uint8_t>(atoi(var_str)));
814 break;
815 }
816 case 13:
817 {
818 this->set_target_handstiffness(static_cast<uint8_t>(atoi(var_str)));
819 break;
820 }
821 case 14:
822 {
823 this->set_target_pliability(static_cast<uint8_t>(atoi(var_str)));
824 break;
825 }
826 case 15:
827 {
828 this->set_target_shoulderpitch_active(static_cast<unsigned int>(atoi(var_str)));
829 break;
830 }
831 case 16:
832 {
833 this->set_target_shoulderroll_active(static_cast<unsigned int>(atoi(var_str)));
834 break;
835 }
836 case 17:
837 {
838 this->set_target_elbowroll_active(static_cast<unsigned int>(atoi(var_str)));
839 break;
840 }
841 case 18:
842 {
843 this->set_target_elbowyaw_active(static_cast<unsigned int>(atoi(var_str)));
844 break;
845 }
846 case 19:
847 {
848 this->set_target_wrist_active(static_cast<unsigned int>(atoi(var_str)));
849 break;
850 }
851 case 20:
852 {
853 this->set_target_hand_active(static_cast<unsigned int>(atoi(var_str)));
854 break;
855 }
856 case 21:
857 {
858 this->set_target_arm_at_goal(static_cast<unsigned int>(atoi(var_str)));
859 break;
860 }
861 case 22:
862 {
863 this->set_target_arm_stop(static_cast<unsigned int>(atoi(var_str)));
864 break;
865 }
866 }
867 if (varIndex >= 0) {
868 varIndex++;
869 }
870 } while(index < length);
871#endif
872 }
873#endif
874
875#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
880 std::string valueDescription() {
881#ifdef USE_WB_HAL_ARM_TARGET_C_CONVERSION
882 char buffer[HAL_ARM_TARGET_DESC_BUFFER_SIZE+22];
883 wb_hal_arm_target_value_description(this, buffer, sizeof(buffer));
884 std::string descr = buffer;
885 return descr;
886#else
887 std::stringstream ss;
888 ss << static_cast<int>(target_shoulderpitch()) << " | "
889 << static_cast<int>(target_shoulderroll()) << " | "
890 << static_cast<int>(target_elbowroll()) << " | "
891 << static_cast<int>(target_elbowyaw()) << " | "
892 << static_cast<int>(target_wristyaw()) << " | "
893 << static_cast<int>(target_hand()) << " | "
894 << static_cast<int>(target_shoulderpitchstiffness()) << " | "
895 << static_cast<int>(target_shoulderrollstiffness()) << " | "
896 << static_cast<int>(target_elbowrollstiffness()) << " | "
897 << static_cast<int>(target_elbowyawstiffness()) << " | "
898 << static_cast<int>(target_wristyawstiffness()) << " | "
899 << static_cast<int>(target_handstiffness()) << " | "
900 << static_cast<int>(target_shoulderpitch_active()) << " | "
901 << static_cast<int>(target_shoulderroll_active()) << " | "
902 << static_cast<int>(target_elbowroll_active()) << " | "
903 << static_cast<int>(target_elbowyaw_active()) << " | "
904 << static_cast<int>(target_wrist_active()) << " | "
905 << static_cast<int>(target_hand_active()) << " | "
906 << static_cast<int>(target_movement_time()) << " | "
907 << static_cast<int>(target_pliability()) << " | "
908 << static_cast<int>(target_arm_at_goal()) << " | "
909 << static_cast<int>(target_arm_stop());
910 return ss.str();
911 }
912#endif
913#endif
914
915 //MARK: Arm - General
924 void tieToArm(uint8_t arm)
925 {
926 set_target_arm(arm);
927 }
928
929 //MARK: Arm - Movements
930
943 float shoulderroll,
944 float elbowroll,
945 float elbowyaw,
946 float wristyaw,
947 float hand,
948 int32_t time = INT_MAX)
949 {
952 wristyaw, hand);
954 }
955
968 float shoulderroll,
969 float elbowroll,
970 float elbowyaw,
971 float wristyaw,
972 float hand,
973 int32_t time = INT_MAX)
974 {
977 wristyaw, hand);
979 }
980
987 void stop() {
989 }
990
991
997 void ready() {
998 set_target_arm_stop(false);
999 }
1000
1001
1012 void isAtGoal(bool goalReached)
1013 {
1014 set_target_arm_at_goal(goalReached);
1015 }
1016
1029 bool atGoal()
1030 {
1031 return target_arm_at_goal();
1032 }
1033
1047 {
1048 int16_t shoulderpitchMargin = static_cast<int16_t>(abs(target_shoulderpitch() - status.target_shoulderpitch()));
1049 int16_t shoulderrollMargin = static_cast<int16_t>(abs(target_shoulderroll() - status.target_shoulderroll()));
1050 int16_t elbowrollMargin = static_cast<int16_t>(abs(target_elbowroll() - status.target_elbowroll()));
1051 int16_t elbowyawMargin = static_cast<int16_t>(abs(target_elbowyaw() - status.target_elbowyaw()));
1052 //#ifdef NAO_V3
1053 // int16_t wristyawMargin = static_cast<int16_t>(abs(target_wristyaw - status.target_wristyaw()));
1054 // uint8_t handMargin = static_cast<uint8_t>(abs(target_hand() - status.target_hand()));
1055 if ( (shoulderpitchMargin <= tolerance.target_shoulderpitch())
1056 && (shoulderrollMargin <= tolerance.target_shoulderroll())
1057 && (elbowrollMargin <= tolerance.target_elbowroll())
1058 && (elbowyawMargin <= tolerance.target_elbowyaw())
1059 //#ifdef NAO_V3
1060 // && (wristyawMargin <= tolerance.target_wristyaw())
1061 // && (handMargin <= tolerance.target_hand())
1062 )
1063 {
1064 return true;
1065 }
1066 return false;
1067 }
1068
1069 //MARK: Arm - Pose
1070
1082 float shoulderroll,
1083 float elbowroll,
1084 float elbowyaw,
1085 float wristyaw,
1086 float hand)
1087 {
1093 set_hand(hand);
1094 }
1095
1107 float shoulderroll,
1108 float elbowroll,
1109 float elbowyaw,
1110 float wristyaw,
1111 float hand)
1112 {
1118 set_hand(hand);
1119 }
1120
1121
1128 void mirrorArm(const HalArmTarget &other)
1129 {
1130 // Roll and Yaw angles need to be mirrored, others just copied.
1131 set_target_shoulderpitch(other.target_shoulderpitch());
1132 set_target_shoulderroll(-other.target_shoulderroll());
1133 set_target_elbowroll(-other.target_elbowroll());
1134 set_target_elbowyaw(-other.target_elbowyaw());
1135 set_target_wristyaw(-other.target_wristyaw());
1136 set_target_hand(other.target_hand());
1137 set_target_shoulderpitchstiffness(other.target_shoulderpitchstiffness());
1138 set_target_shoulderrollstiffness(other.target_shoulderrollstiffness());
1139 set_target_elbowrollstiffness(other.target_elbowrollstiffness());
1140 set_target_elbowyawstiffness(other.target_elbowyawstiffness());
1141 set_target_wristyawstiffness(other.target_wristyawstiffness());
1142 set_target_handstiffness(other.target_handstiffness());
1143 set_target_shoulderpitch_active(other.target_shoulderpitch_active());
1144 set_target_shoulderroll_active(other.target_shoulderroll_active());
1145 set_target_elbowroll_active(other.target_elbowroll_active());
1146 set_target_elbowyaw_active(other.target_elbowyaw_active());
1147 set_target_wrist_active(other.target_wrist_active());
1148 set_target_hand_active(other.target_hand_active());
1149 set_target_movement_time(other.target_movement_time());
1150 set_target_pliability(other.target_pliability());
1151 }
1152
1159 void copyPose(const HalArmTarget &other)
1160 {
1161 set_target_shoulderpitch(other.target_shoulderpitch());
1162 set_target_shoulderroll(other.target_shoulderroll());
1163 set_target_elbowroll(other.target_elbowroll());
1164 set_target_elbowyaw(other.target_elbowyaw());
1165 set_target_wristyaw(other.target_wristyaw());
1166 set_target_hand(other.target_hand());
1167 }
1168
1175 void mirrorPose(const HalArmTarget &other)
1176 {
1177 set_target_shoulderpitch(other.target_shoulderpitch());
1178 set_target_shoulderroll(-other.target_shoulderroll());
1179 set_target_elbowroll(-other.target_elbowroll());
1180 set_target_elbowyaw(-other.target_elbowyaw());
1181 set_target_wristyaw(-other.target_wristyaw());
1182 set_target_hand(other.target_hand());
1183 }
1184
1193 bool hasSamePose(const HalArmTarget &other)
1194 {
1195 if (
1196 target_shoulderpitch() == other.target_shoulderpitch()
1197 && target_shoulderroll() == other.target_shoulderroll()
1198 && target_elbowroll() == other.target_elbowroll()
1199 && target_elbowyaw() == other.target_elbowyaw()
1200 && target_wristyaw() == other.target_wristyaw()
1201 && target_hand() == other.target_hand()
1202 )
1203 {
1204 return true;
1205 }
1206 return false;
1207 }
1208
1218 {
1219 if (
1220 target_shoulderpitch() == other.target_shoulderpitch()
1221 && target_shoulderroll() == -other.target_shoulderroll()
1222 && target_elbowroll() == -other.target_elbowroll()
1223 && target_elbowyaw() == -other.target_elbowyaw()
1224 && target_wristyaw() == -other.target_wristyaw()
1225 && target_hand() == other.target_hand()
1226 )
1227 {
1228 return true;
1229 }
1230 return false;
1231 }
1232
1233 //MARK: Arm - Stiffness
1234
1241 {
1247 set_handstiffness(1.0f);
1248 }
1249
1257 {
1263 set_handstiffness(0.6f);
1264 }
1265
1273 void setArmStiffness(float stiffness)
1274 {
1275 if ((stiffness <= 1.0f) && (stiffness >=0.0f)) {
1276 set_shoulderpitchstiffness(stiffness);
1277 set_shoulderrollstiffness(stiffness);
1278 set_elbowrollstiffness(stiffness);
1279 set_elbowyawstiffness(stiffness);
1280 set_wristyawstiffness(stiffness);
1281 set_handstiffness(stiffness);
1282 }
1283 }
1284
1291 {
1297 set_handstiffness(0.0f);
1298 }
1299
1300
1307 void copyStiffness(const HalArmTarget &other)
1308 {
1309 set_target_shoulderpitchstiffness(other.target_shoulderpitchstiffness());
1310 set_target_shoulderrollstiffness(other.target_shoulderrollstiffness());
1311 set_target_elbowrollstiffness(other.target_elbowrollstiffness());
1312 set_target_elbowyawstiffness(other.target_elbowyawstiffness());
1313 set_target_wristyawstiffness(other.target_wristyawstiffness());
1314 set_target_handstiffness(other.target_handstiffness());
1315 }
1316
1317
1318
1327 {
1328 if (
1329 target_shoulderpitchstiffness() == other.target_shoulderpitchstiffness()
1330 && target_shoulderrollstiffness() == other.target_shoulderrollstiffness()
1331 && target_elbowrollstiffness() == other.target_elbowrollstiffness()
1332 && target_elbowyawstiffness() == other.target_elbowyawstiffness()
1333 && target_wristyawstiffness() == other.target_wristyawstiffness()
1334 && target_handstiffness() == other.target_handstiffness()
1335 )
1336 {
1337 return true;
1338 }
1339 return false;
1340 }
1341
1342 //MARK: Arm - Pliability
1343
1354 {
1361 }
1362
1375 {
1382 }
1383
1384
1391 bool elbowyaw, bool wristyaw, bool hand)
1392 {
1399 }
1400
1407 }
1408
1415 }
1416
1423 }
1424
1425 //MARK: CUSTOM SETTERS (Converting floats into Integer representations)
1427 void set_shoulderpitch_DEG(float setting) {
1428 set_target_shoulderpitch(static_cast<int16_t>(setting * 10.0f));
1429 }
1430
1431 void set_shoulderroll_DEG(float setting) {
1432 set_target_shoulderroll(static_cast<int16_t>(setting * 10.0f));
1433 }
1434
1435 void set_elbowroll_DEG(float setting) {
1436 set_target_elbowroll(static_cast<int16_t>(setting * 10.0f));
1437 }
1438
1439 void set_elbowyaw_DEG(float setting) {
1440 set_target_elbowyaw(static_cast<int16_t>(setting * 10.0f));
1441 }
1442
1443 void set_wristyaw_DEG(float setting) {
1444 set_target_wristyaw(static_cast<int16_t>(setting * 10.0f));
1445 }
1446
1448 void set_shoulderpitch_RAD(float setting) {
1449 set_target_shoulderpitch(static_cast<int16_t>(setting* DEG_OVER_RAD_10));
1450 }
1451
1452 void set_shoulderroll_RAD(float setting) {
1453 set_target_shoulderroll(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1454 }
1455
1456 void set_elbowroll_RAD(float setting) {
1457 set_target_elbowroll(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1458 }
1459
1460 void set_elbowyaw_RAD(float setting) {
1461 set_target_elbowyaw(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1462 }
1463
1464 void set_wristyaw_RAD(float setting) {
1465 set_target_wristyaw(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1466 }
1467
1469 void set_hand(float setting) {
1470 set_target_hand(static_cast<uint8_t>(setting * 100.0f));
1471 }
1472
1474 void set_shoulderpitchstiffness(float setting) {
1475 set_target_shoulderpitchstiffness(static_cast<uint8_t>(setting * 100.0f));
1476 }
1477
1478 void set_shoulderrollstiffness(float setting) {
1479 set_target_shoulderrollstiffness(static_cast<uint8_t>(setting * 100.0f));
1480 }
1481
1482 void set_elbowrollstiffness(float setting) {
1483 set_target_elbowrollstiffness(static_cast<uint8_t>(setting * 100.0f));
1484 }
1485
1486 void set_elbowyawstiffness(float setting) {
1487 set_target_elbowyawstiffness(static_cast<uint8_t>(setting * 100.0f));
1488 }
1489
1490 void set_wristyawstiffness(float setting) {
1491 set_target_wristyawstiffness(static_cast<uint8_t>(setting * 100.0f));
1492 }
1493
1494 void set_handstiffness(float setting) {
1495 set_target_handstiffness(static_cast<uint8_t>(setting * 100.0f));
1496 }
1497
1498
1500 // void set_movement_time(int32_t time) {
1501 // set_target_movement_time(time);
1502 // }
1503
1504 //MARK: CUSTOM GETTERS (Converting Integer representations back to floats)
1507 return static_cast<float>(target_shoulderpitch() * 0.1f);
1508 }
1509
1511 return static_cast<float>(target_shoulderroll() * 0.1f);
1512 }
1513
1515 return static_cast<float>(target_elbowroll() * 0.1f);
1516 }
1517
1519 return static_cast<float>(target_elbowyaw() * 0.1f);
1520 }
1521
1523 return static_cast<float>(target_wristyaw() * 0.1f);
1524 }
1525
1528 return static_cast<float>(target_shoulderpitch()) * RAD_OVER_DEG_10;
1529 }
1530
1532 return static_cast<float>(target_shoulderroll()) * RAD_OVER_DEG_10;
1533 }
1534
1536 return static_cast<float>(target_elbowroll()) * RAD_OVER_DEG_10;
1537 }
1538
1540 return static_cast<float>(target_elbowyaw()) * RAD_OVER_DEG_10;
1541 }
1542
1544 return static_cast<float>(target_wristyaw()) * RAD_OVER_DEG_10;
1545 }
1546
1548 float get_hand() {
1549 return static_cast<float>(target_hand()) * 0.01f;
1550 }
1551
1554 return static_cast<float>(target_shoulderpitchstiffness()) * 0.01f;
1555 }
1556
1558 return static_cast<float>(target_shoulderrollstiffness()) * 0.01f;
1559 }
1560
1562 return static_cast<float>(target_elbowrollstiffness()) * 0.01f;
1563 }
1564
1566 return static_cast<float>(target_elbowyawstiffness()) * 0.01f;
1567 }
1568
1570 return static_cast<float>(target_wristyawstiffness()) * 0.01f;
1571 }
1572
1574 return static_cast<float>(target_handstiffness()) * 0.01f;
1575 }
1576 };
1577
1578}
1579
1580#endif
Class for moving a SINGLE robotic arm with up to 6 degrees of freedom using local coords of each join...
const int16_t & target_shoulderpitch() const
void set_shoulderpitch_RAD(float setting)
Movement Setters (Radians)
void set_target_hand_active(const unsigned int &t_newValue)
unsigned int target_arm_stop() const
bool atTargetLocation(HalArmTarget status, HalArmTarget tolerance)
Client side test to determine if arm is at the target location, allowing for specified tolerances.
void set_shoulderpitchstiffness(float setting)
Stiffness Setters.
void set_target_wrist_active(const unsigned int &t_newValue)
void set_target_shoulderroll_active(const unsigned int &t_newValue)
void set_elbowrollstiffness(float setting)
void set_target_shoulderpitchstiffness(const uint8_t &t_newValue)
void set_target_arm_at_goal(const unsigned int &t_newValue)
void setArmStiffness(float stiffness)
Convenience function to set uniform stiffness on all arm joints to a custom value.
const int16_t & target_elbowroll() const
void setArmStiffnessNormal()
Convenience function to set the stiffness of all the arm's joints to what Aldebaran considers 'normal...
const uint8_t & target_hand() const
void stop()
Command the arm to stop at its current location and not act on motion commands until ready() is calle...
void setPose_Rad(float shoulderpitch, float shoulderroll, float elbowroll, float elbowyaw, float wristyaw, float hand)
Set Pose in radians.
bool operator==(const HalArmTarget &t_other) const
void set_target_elbowroll(const int16_t &t_newValue)
uint8_t & target_wristyawstiffness()
void set_target_elbowrollstiffness(const uint8_t &t_newValue)
void set_wristyawstiffness(float setting)
std::string valueDescription()
WHITEBOARD_POSTER_STRING_CONVERSION.
void set_elbowroll_RAD(float setting)
unsigned int target_hand_active() const
const uint8_t & target_wristyawstiffness() const
void from_string(const std::string &t_str)
void set_target_movement_time(const int32_t &t_newValue)
unsigned int target_elbowyaw_active() const
void set_target_elbowyawstiffness(const uint8_t &t_newValue)
uint8_t & target_shoulderrollstiffness()
void set_elbowyaw_DEG(float setting)
HalArmTarget & operator=(const HalArmTarget &t_other)
Copy Assignment Operator.
bool atGoal()
Arm at Goal Getter Clients/Machines should use this getter to test if the DCM has reported that the a...
void set_target_wristyaw(const int16_t &t_newValue)
void set_target_hand(const uint8_t &t_newValue)
const int16_t & target_shoulderroll() const
uint8_t & target_elbowrollstiffness()
const uint8_t & target_elbowrollstiffness() const
void ready()
Set arm to ready state (Default) The arm will act on motion commands.
void tieToArm(uint8_t arm)
USE_WB_HAL_ARM_TARGET_C_CONVERSION WHITEBOARD_POSTER_STRING_CONVERSION.
uint8_t & target_shoulderpitchstiffness()
uint8_t & target_elbowyawstiffness()
const uint8_t & target_pliability() const
void setArmStiffnessOff()
Convenience function to turn off stiffness in all the arm's joints (0.0f).
void copyStiffness(const HalArmTarget &other)
Convenience function to copy stiffness settings from one HalArmTarget object to another.
void set_handstiffness(float setting)
HalArmTarget(const std::string &t_str)
String Constructor.
const uint8_t & target_elbowyawstiffness() const
void set_elbowyawstiffness(float setting)
void copyPose(const HalArmTarget &other)
Convenience function to copy pose settings from one HalArmTarget object to another.
void set_wristyaw_RAD(float setting)
void setArmPliability(bool shoulderpitch, bool shoulderroll, bool elbowroll, bool elbowyaw, bool wristyaw, bool hand)
Individually set the active/passive state of each joint.
void set_shoulderroll_RAD(float setting)
void set_target_wristyawstiffness(const uint8_t &t_newValue)
void setPose_Deg(float shoulderpitch, float shoulderroll, float elbowroll, float elbowyaw, float wristyaw, float hand)
Set Pose in degrees.
float get_hand()
Hand Movement Getter.
void set_target_arm_stop(const unsigned int &t_newValue)
HalArmTarget(int32_t t_target_movement_time=INT_MAX, int16_t t_target_shoulderpitch=0, int16_t t_target_shoulderroll=0, int16_t t_target_elbowroll=0, int16_t t_target_elbowyaw=0, int16_t t_target_wristyaw=0, uint8_t t_target_arm=(static_cast< uint8_t >(0)), uint8_t t_target_hand=0, uint8_t t_target_shoulderpitchstiffness=0, uint8_t t_target_shoulderrollstiffness=0, uint8_t t_target_elbowrollstiffness=0, uint8_t t_target_elbowyawstiffness=0, uint8_t t_target_wristyawstiffness=0, uint8_t t_target_handstiffness=0, uint8_t t_target_pliability=0, unsigned int t_target_shoulderpitch_active=true, unsigned int t_target_shoulderroll_active=true, unsigned int t_target_elbowroll_active=true, unsigned int t_target_elbowyaw_active=true, unsigned int t_target_wrist_active=true, unsigned int t_target_hand_active=true, unsigned int t_target_arm_at_goal=false, unsigned int t_target_arm_stop=false)
Create a new HalArmTarget.
void from_string(const std::string &str)
Parser for recreating this class (NYI)
void set_shoulderroll_DEG(float setting)
void set_target_elbowyaw_active(const unsigned int &t_newValue)
void set_target_shoulderrollstiffness(const uint8_t &t_newValue)
void set_shoulderpitch_DEG(float setting)
Movement Setters (Degrees)
unsigned int target_wrist_active() const
void set_target_handstiffness(const uint8_t &t_newValue)
const uint8_t & target_shoulderrollstiffness() const
const uint8_t & target_handstiffness() const
void set_hand(float setting)
Hand Movement Setter.
void set_wristyaw_DEG(float setting)
void set_target_pliability(const uint8_t &t_newValue)
void goToWithTime_Rad(float shoulderpitch, float shoulderroll, float elbowroll, float elbowyaw, float wristyaw, float hand, int32_t time=INT_MAX)
move to position in radians over a given time
bool hasSamePose(const HalArmTarget &other)
Tests if this HalArmTarget object has the same pose settings as the other HalArmTarget object.
void set_target_arm(const uint8_t &t_newValue)
void mirrorPose(const HalArmTarget &other)
Convenience function to mirror pose settings about the XZ plane from one HalArmTarget object to anoth...
HalArmTarget(const uint8_t &target_arm=0, const float shoulderpitch=0, const float shoulderroll=0, const float elbowroll=0, const float elbowyaw=0, const float wristyaw=0, const float hand_PCT=0, const float shoulderpitchstiffness=0, const float shoulderrollstiffness=0, const float elbowrollstiffness=0, const float elbowyawstiffness=0, const float wristyawstiffness=0, const float handstiffness=0, const bool shoulderpitch_active=true, const bool shoulderroll_active=true, const bool elbowroll_active=true, const bool elbowyaw_active=true, const bool wrist_active=true, const bool hand_active=true, const int32_t movement_time=1000000, const uint8_t pliability=10, const bool arm_stop=false, const bool inRadians=false)
Constructor, defaults to LEFT_ARM.
void set_target_shoulderroll(const int16_t &t_newValue)
void set_elbowroll_DEG(float setting)
bool isArmAllActive()
Are all of the arm's joints set to active.
float get_shoulderpitchstiffness()
Stiffness Getters.
void set_target_shoulderpitch_active(const unsigned int &t_newValue)
unsigned int target_elbowroll_active() const
void setArmPassive()
Set arm to be Passive Manually moving the arm causes the arm to remain in the new position.
void goToWithTime_Deg(float shoulderpitch, float shoulderroll, float elbowroll, float elbowyaw, float wristyaw, float hand, int32_t time=INT_MAX)
move to position expressed in degrees over a given time
void set_target_elbowroll_active(const unsigned int &t_newValue)
void set_target_shoulderpitch(const int16_t &t_newValue)
const uint8_t & target_shoulderpitchstiffness() const
bool hasSameMirroredPose(const HalArmTarget &other)
Tests if this HalArmTarget object has the same mirrored pose settings as the other HalArmTarget objec...
const int32_t & target_movement_time() const
bool hasSameStiffness(const HalArmTarget &other)
Tests if this HalArmTarget object has the same stiffness settings as the other HalArmTarget object.
void setArmActive()
Set arm to be Active (DEDAULT DCM state) The arm is active and manual movements will be resisted,...
float get_shoulderpitch_RAD()
Movement Getters (Radians)
const uint8_t & target_arm() const
void set_elbowyaw_RAD(float setting)
unsigned int target_arm_at_goal() const
unsigned int target_shoulderpitch_active() const
void isAtGoal(bool goalReached)
Arm at Goal Setter Clients/Machines should not use this method.
void setArmStiffnessMax()
Convenience function to set the stiffness of all the arm's joints to the maximum (1....
HalArmTarget(const struct wb_hal_arm_target &t_other)
Copy Constructor.
const int16_t & target_elbowyaw() const
unsigned int target_shoulderroll_active() const
void set_shoulderrollstiffness(float setting)
HalArmTarget(const HalArmTarget &t_other)
Copy Constructor.
bool isArmPassive()
Are any of the arm's joints set to passive.
void mirrorArm(const HalArmTarget &other)
Convenience function to mirror arm settings about the XZ plane from one HalArmTarget object to anothe...
const int16_t & target_wristyaw() const
void set_target_elbowyaw(const int16_t &t_newValue)
bool isArmAllPassive()
Are all of the arm's joints set to passive.
float get_shoulderpitch_DEG()
Movement Getters (Degrees)
bool operator!=(const HalArmTarget &t_other) const
/file APM_Interface.h
WHITEBOARD_POSTER_STRING_CONVERSION.
unsigned int target_arm_at_goal
Control Message: Not used.
uint8_t target_wristyawstiffness
target wrist yaw stiffness as a percentage
int16_t target_shoulderpitch
target shoulder pitch angle in 10ths of degrees
int16_t target_elbowroll
target elbow roll angle in 10ths of degrees
unsigned int target_elbowroll_active
Is the elbowroll Active (true[DEFAULT]) or Passive (false)
unsigned int target_hand_active
Is the hand Active (true[DEFAULT]) or Passive (false)
uint8_t target_handstiffness
target hand grasper stiffness as a percentage
unsigned int target_shoulderroll_active
Is the shoulderroll Active (true[DEFAULT]) or Passive (false)
uint8_t target_pliability
target arm's pliability when in Passive Mode.
unsigned int target_wrist_active
Is the wrist Active (true[DEFAULT]) or Passive (false)
uint8_t target_shoulderpitchstiffness
target shoulder pitch stiffness as a percentage
unsigned int target_shoulderpitch_active
Is the shoulderpitch Active (true[DEFAULT]) or Passive (false).
uint8_t target_arm
target arm number: This property is used strictly for accounting purposes when the struct is stored w...
uint8_t target_elbowrollstiffness
target elbow roll stiffness as a percentage
unsigned int target_arm_stop
Control Message: Stop the arm at its current location.
uint8_t target_elbowyawstiffness
target elbow yaw stiffness as a percentage
int16_t target_shoulderroll
target shoulder roll angle angle in 10ths of degrees
unsigned int target_elbowyaw_active
Is the elbowyaw Active (true[DEFAULT]) or Passive (false)
uint8_t target_hand
target hand grasper opening as a percentage: 0 gripper will be clasped shut, 100 gripper will be full...
int16_t target_wristyaw
target wrist yaw angle in 10ths of degrees
int32_t target_movement_time
The elapsed time, in mSec, in which the movement should be completed.
uint8_t target_shoulderrollstiffness
target shoulder roll stiffness as a percentage
int16_t target_elbowyaw
target elbow yaw angle in 10ths of degrees
target_shoulderpitch target_elbowroll target_wristyaw target_hand target_shoulderrollstiffness target_elbowyawstiffness target_handstiffness int16_t int16_t int16_t int16_t int16_t wristyaw
target_shoulderpitch target_elbowroll target_wristyaw target_hand target_shoulderrollstiffness target_elbowyawstiffness target_handstiffness int16_t int16_t int16_t int16_t elbowyaw
target_shoulderpitch target_elbowroll target_wristyaw target_hand target_shoulderrollstiffness target_elbowyawstiffness target_handstiffness int16_t shoulderpitch
target_shoulderpitch target_elbowroll target_wristyaw target_hand target_shoulderrollstiffness target_elbowyawstiffness target_handstiffness int16_t int16_t int16_t elbowroll
target_shoulderpitch target_elbowroll target_wristyaw target_hand target_shoulderrollstiffness target_elbowyawstiffness target_handstiffness int16_t int16_t shoulderroll
target_shoulderpitch target_elbowroll target_wristyaw target_hand target_shoulderrollstiffness target_elbowyawstiffness target_handstiffness int16_t int16_t int16_t int16_t int16_t uint8_t hand
struct wb_hal_arm_target * wb_hal_arm_target_from_string(struct wb_hal_arm_target *self, const char *str)
Convert from a string.
const char * wb_hal_arm_target_value_description(const struct wb_hal_arm_target *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_hal_arm_target_description(const struct wb_hal_arm_target *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_hal_arm_target_to_string(const struct wb_hal_arm_target *self, char *toString, size_t bufferSize)
Convert to a string.
#define HAL_ARM_TARGET_TO_STRING_BUFFER_SIZE
#define HAL_ARM_TARGET_DESC_BUFFER_SIZE
#define LEFT_ARM