gusimplewhiteboard
HalLegTarget.hpp
Go to the documentation of this file.
1/*
2 * file HalLegTarget.hpp
3 *
4 * This file was generated by classgenerator from hal_leg_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_HalLegTarget_h
61#define guWhiteboard_HalLegTarget_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_leg_target.h"
71
72#undef guWhiteboard_HalLegTarget_DEFINED
73#define guWhiteboard_HalLegTarget_DEFINED
74
75#undef HalLegTarget_DEFINED
76#define HalLegTarget_DEFINED
77
78namespace guWhiteboard {
79
83 class HalLegTarget: public wb_hal_leg_target {
84
85 private:
86
90 void init(int32_t t_target_movement_time = INT_MAX, int16_t t_target_hipyawpitch = 0, int16_t t_target_hiproll = 0, int16_t t_target_hippitch = 0, int16_t t_target_kneepitch = 0, int16_t t_target_anklepitch = 0, int16_t t_target_ankleroll = 0, uint8_t t_target_leg = LEFT_LEG, uint8_t t_target_hipyawpitchstiffness = 0, uint8_t t_target_hiprollstiffness = 0, uint8_t t_target_hippitchstiffness = 0, uint8_t t_target_kneepitchstiffness = 0, uint8_t t_target_anklepitchstiffness = 0, uint8_t t_target_anklerollstiffness = 0, uint8_t t_target_pliability = 0, unsigned int t_target_hipyawpitch_active = true, unsigned int t_target_hiproll_active = true, unsigned int t_target_hippitch_active = true, unsigned int t_target_kneepitch_active = true, unsigned int t_target_anklepitch_active = true, unsigned int t_target_ankleroll_active = true, unsigned int t_target_leg_at_goal = false, unsigned int t_target_leg_stop = false) {
91 set_target_movement_time(t_target_movement_time);
92 set_target_hipyawpitch(t_target_hipyawpitch);
93 set_target_hiproll(t_target_hiproll);
94 set_target_hippitch(t_target_hippitch);
95 set_target_kneepitch(t_target_kneepitch);
96 set_target_anklepitch(t_target_anklepitch);
97 set_target_ankleroll(t_target_ankleroll);
98 set_target_leg(t_target_leg);
99 set_target_hipyawpitchstiffness(t_target_hipyawpitchstiffness);
100 set_target_hiprollstiffness(t_target_hiprollstiffness);
101 set_target_hippitchstiffness(t_target_hippitchstiffness);
102 set_target_kneepitchstiffness(t_target_kneepitchstiffness);
103 set_target_anklepitchstiffness(t_target_anklepitchstiffness);
104 set_target_anklerollstiffness(t_target_anklerollstiffness);
105 set_target_pliability(t_target_pliability);
106 set_target_hipyawpitch_active(t_target_hipyawpitch_active);
107 set_target_hiproll_active(t_target_hiproll_active);
108 set_target_hippitch_active(t_target_hippitch_active);
109 set_target_kneepitch_active(t_target_kneepitch_active);
110 set_target_anklepitch_active(t_target_anklepitch_active);
111 set_target_ankleroll_active(t_target_ankleroll_active);
112 set_target_leg_at_goal(t_target_leg_at_goal);
113 set_target_leg_stop(t_target_leg_stop);
114 }
115
116 public:
117
121 HalLegTarget(int32_t t_target_movement_time = INT_MAX, int16_t t_target_hipyawpitch = 0, int16_t t_target_hiproll = 0, int16_t t_target_hippitch = 0, int16_t t_target_kneepitch = 0, int16_t t_target_anklepitch = 0, int16_t t_target_ankleroll = 0, uint8_t t_target_leg = LEFT_LEG, uint8_t t_target_hipyawpitchstiffness = 0, uint8_t t_target_hiprollstiffness = 0, uint8_t t_target_hippitchstiffness = 0, uint8_t t_target_kneepitchstiffness = 0, uint8_t t_target_anklepitchstiffness = 0, uint8_t t_target_anklerollstiffness = 0, uint8_t t_target_pliability = 0, unsigned int t_target_hipyawpitch_active = true, unsigned int t_target_hiproll_active = true, unsigned int t_target_hippitch_active = true, unsigned int t_target_kneepitch_active = true, unsigned int t_target_anklepitch_active = true, unsigned int t_target_ankleroll_active = true, unsigned int t_target_leg_at_goal = false, unsigned int t_target_leg_stop = false) {
122 this->init(t_target_movement_time, t_target_hipyawpitch, t_target_hiproll, t_target_hippitch, t_target_kneepitch, t_target_anklepitch, t_target_ankleroll, t_target_leg, t_target_hipyawpitchstiffness, t_target_hiprollstiffness, t_target_hippitchstiffness, t_target_kneepitchstiffness, t_target_anklepitchstiffness, t_target_anklerollstiffness, t_target_pliability, t_target_hipyawpitch_active, t_target_hiproll_active, t_target_hippitch_active, t_target_kneepitch_active, t_target_anklepitch_active, t_target_ankleroll_active, t_target_leg_at_goal, t_target_leg_stop);
123 }
124
129 this->init(t_other.target_movement_time(), t_other.target_hipyawpitch(), t_other.target_hiproll(), t_other.target_hippitch(), t_other.target_kneepitch(), t_other.target_anklepitch(), t_other.target_ankleroll(), t_other.target_leg(), t_other.target_hipyawpitchstiffness(), t_other.target_hiprollstiffness(), t_other.target_hippitchstiffness(), t_other.target_kneepitchstiffness(), t_other.target_anklepitchstiffness(), t_other.target_anklerollstiffness(), t_other.target_pliability(), t_other.target_hipyawpitch_active(), t_other.target_hiproll_active(), t_other.target_hippitch_active(), t_other.target_kneepitch_active(), t_other.target_anklepitch_active(), t_other.target_ankleroll_active(), t_other.target_leg_at_goal(), t_other.target_leg_stop());
130 }
131
137 }
138
143 this->init(t_other.target_movement_time(), t_other.target_hipyawpitch(), t_other.target_hiproll(), t_other.target_hippitch(), t_other.target_kneepitch(), t_other.target_anklepitch(), t_other.target_ankleroll(), t_other.target_leg(), t_other.target_hipyawpitchstiffness(), t_other.target_hiprollstiffness(), t_other.target_hippitchstiffness(), t_other.target_kneepitchstiffness(), t_other.target_anklepitchstiffness(), t_other.target_anklerollstiffness(), t_other.target_pliability(), t_other.target_hipyawpitch_active(), t_other.target_hiproll_active(), t_other.target_hippitch_active(), t_other.target_kneepitch_active(), t_other.target_anklepitch_active(), t_other.target_ankleroll_active(), t_other.target_leg_at_goal(), t_other.target_leg_stop());
144 return *this;
145 }
146
152 return *this;
153 }
154
155 bool operator ==(const HalLegTarget &t_other) const
156 {
157 return target_movement_time() == t_other.target_movement_time()
158 && target_hipyawpitch() == t_other.target_hipyawpitch()
159 && target_hiproll() == t_other.target_hiproll()
160 && target_hippitch() == t_other.target_hippitch()
161 && target_kneepitch() == t_other.target_kneepitch()
162 && target_anklepitch() == t_other.target_anklepitch()
163 && target_ankleroll() == t_other.target_ankleroll()
164 && target_leg() == t_other.target_leg()
165 && target_hipyawpitchstiffness() == t_other.target_hipyawpitchstiffness()
166 && target_hiprollstiffness() == t_other.target_hiprollstiffness()
167 && target_hippitchstiffness() == t_other.target_hippitchstiffness()
168 && target_kneepitchstiffness() == t_other.target_kneepitchstiffness()
169 && target_anklepitchstiffness() == t_other.target_anklepitchstiffness()
170 && target_anklerollstiffness() == t_other.target_anklerollstiffness()
171 && target_pliability() == t_other.target_pliability()
172 && target_hipyawpitch_active() == t_other.target_hipyawpitch_active()
173 && target_hiproll_active() == t_other.target_hiproll_active()
174 && target_hippitch_active() == t_other.target_hippitch_active()
175 && target_kneepitch_active() == t_other.target_kneepitch_active()
176 && target_anklepitch_active() == t_other.target_anklepitch_active()
177 && target_ankleroll_active() == t_other.target_ankleroll_active()
178 && target_leg_at_goal() == t_other.target_leg_at_goal()
179 && target_leg_stop() == t_other.target_leg_stop();
180 }
181
182 bool operator !=(const HalLegTarget &t_other) const
183 {
184 return !(*this == t_other);
185 }
186
187 bool operator ==(const wb_hal_leg_target &t_other) const
188 {
189 return *this == HalLegTarget(t_other);
190 }
191
192 bool operator !=(const wb_hal_leg_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_hipyawpitch() const
218 {
220 }
221
222 void set_target_hipyawpitch(const int16_t &t_newValue)
223 {
225 }
226
227 int16_t & target_hiproll()
228 {
230 }
231
232 const int16_t & target_hiproll() const
233 {
235 }
236
237 void set_target_hiproll(const int16_t &t_newValue)
238 {
240 }
241
242 int16_t & target_hippitch()
243 {
245 }
246
247 const int16_t & target_hippitch() const
248 {
250 }
251
252 void set_target_hippitch(const int16_t &t_newValue)
253 {
255 }
256
258 {
260 }
261
262 const int16_t & target_kneepitch() const
263 {
265 }
266
267 void set_target_kneepitch(const int16_t &t_newValue)
268 {
270 }
271
273 {
275 }
276
277 const int16_t & target_anklepitch() const
278 {
280 }
281
282 void set_target_anklepitch(const int16_t &t_newValue)
283 {
285 }
286
288 {
290 }
291
292 const int16_t & target_ankleroll() const
293 {
295 }
296
297 void set_target_ankleroll(const int16_t &t_newValue)
298 {
300 }
301
302 uint8_t & target_leg()
303 {
305 }
306
307 const uint8_t & target_leg() const
308 {
310 }
311
312 void set_target_leg(const uint8_t &t_newValue)
313 {
315 }
316
318 {
320 }
321
322 const uint8_t & target_hipyawpitchstiffness() const
323 {
325 }
326
327 void set_target_hipyawpitchstiffness(const uint8_t &t_newValue)
328 {
330 }
331
333 {
335 }
336
337 const uint8_t & target_hiprollstiffness() const
338 {
340 }
341
342 void set_target_hiprollstiffness(const uint8_t &t_newValue)
343 {
345 }
346
348 {
350 }
351
352 const uint8_t & target_hippitchstiffness() const
353 {
355 }
356
357 void set_target_hippitchstiffness(const uint8_t &t_newValue)
358 {
360 }
361
363 {
365 }
366
367 const uint8_t & target_kneepitchstiffness() const
368 {
370 }
371
372 void set_target_kneepitchstiffness(const uint8_t &t_newValue)
373 {
375 }
376
378 {
380 }
381
382 const uint8_t & target_anklepitchstiffness() const
383 {
385 }
386
387 void set_target_anklepitchstiffness(const uint8_t &t_newValue)
388 {
390 }
391
393 {
395 }
396
397 const uint8_t & target_anklerollstiffness() const
398 {
400 }
401
402 void set_target_anklerollstiffness(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_hipyawpitch_active() const
423 {
425 }
426
427 void set_target_hipyawpitch_active(const unsigned int &t_newValue)
428 {
430 }
431
432 unsigned int target_hiproll_active() const
433 {
435 }
436
437 void set_target_hiproll_active(const unsigned int &t_newValue)
438 {
440 }
441
442 unsigned int target_hippitch_active() const
443 {
445 }
446
447 void set_target_hippitch_active(const unsigned int &t_newValue)
448 {
450 }
451
452 unsigned int target_kneepitch_active() const
453 {
455 }
456
457 void set_target_kneepitch_active(const unsigned int &t_newValue)
458 {
460 }
461
462 unsigned int target_anklepitch_active() const
463 {
465 }
466
467 void set_target_anklepitch_active(const unsigned int &t_newValue)
468 {
470 }
471
472 unsigned int target_ankleroll_active() const
473 {
475 }
476
477 void set_target_ankleroll_active(const unsigned int &t_newValue)
478 {
480 }
481
482 unsigned int target_leg_at_goal() const
483 {
485 }
486
487 void set_target_leg_at_goal(const unsigned int &t_newValue)
488 {
490 }
491
492 unsigned int target_leg_stop() const
493 {
495 }
496
497 void set_target_leg_stop(const unsigned int &t_newValue)
498 {
500 }
501
502#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
506 HalLegTarget(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_LEG_TARGET_C_CONVERSION
514 wb_hal_leg_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_hipyawpitch=" << static_cast<signed>(this->target_hipyawpitch());
522 ss << ", ";
523 ss << "target_hiproll=" << static_cast<signed>(this->target_hiproll());
524 ss << ", ";
525 ss << "target_hippitch=" << static_cast<signed>(this->target_hippitch());
526 ss << ", ";
527 ss << "target_kneepitch=" << static_cast<signed>(this->target_kneepitch());
528 ss << ", ";
529 ss << "target_anklepitch=" << static_cast<signed>(this->target_anklepitch());
530 ss << ", ";
531 ss << "target_ankleroll=" << static_cast<signed>(this->target_ankleroll());
532 ss << ", ";
533 ss << "target_leg=" << static_cast<unsigned>(this->target_leg());
534 ss << ", ";
535 ss << "target_hipyawpitchstiffness=" << static_cast<unsigned>(this->target_hipyawpitchstiffness());
536 ss << ", ";
537 ss << "target_hiprollstiffness=" << static_cast<unsigned>(this->target_hiprollstiffness());
538 ss << ", ";
539 ss << "target_hippitchstiffness=" << static_cast<unsigned>(this->target_hippitchstiffness());
540 ss << ", ";
541 ss << "target_kneepitchstiffness=" << static_cast<unsigned>(this->target_kneepitchstiffness());
542 ss << ", ";
543 ss << "target_anklepitchstiffness=" << static_cast<unsigned>(this->target_anklepitchstiffness());
544 ss << ", ";
545 ss << "target_anklerollstiffness=" << static_cast<unsigned>(this->target_anklerollstiffness());
546 ss << ", ";
547 ss << "target_pliability=" << static_cast<unsigned>(this->target_pliability());
548 ss << ", ";
549 ss << "target_hipyawpitch_active=" << this->target_hipyawpitch_active();
550 ss << ", ";
551 ss << "target_hiproll_active=" << this->target_hiproll_active();
552 ss << ", ";
553 ss << "target_hippitch_active=" << this->target_hippitch_active();
554 ss << ", ";
555 ss << "target_kneepitch_active=" << this->target_kneepitch_active();
556 ss << ", ";
557 ss << "target_anklepitch_active=" << this->target_anklepitch_active();
558 ss << ", ";
559 ss << "target_ankleroll_active=" << this->target_ankleroll_active();
560 ss << ", ";
561 ss << "target_leg_at_goal=" << this->target_leg_at_goal();
562 ss << ", ";
563 ss << "target_leg_stop=" << this->target_leg_stop();
564 return ss.str();
565#endif
566 }
567
568 std::string to_string() {
569#ifdef USE_WB_HAL_LEG_TARGET_C_CONVERSION
571 wb_hal_leg_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_hipyawpitch());
579 ss << ", ";
580 ss << static_cast<signed>(this->target_hiproll());
581 ss << ", ";
582 ss << static_cast<signed>(this->target_hippitch());
583 ss << ", ";
584 ss << static_cast<signed>(this->target_kneepitch());
585 ss << ", ";
586 ss << static_cast<signed>(this->target_anklepitch());
587 ss << ", ";
588 ss << static_cast<signed>(this->target_ankleroll());
589 ss << ", ";
590 ss << static_cast<unsigned>(this->target_leg());
591 ss << ", ";
592 ss << static_cast<unsigned>(this->target_hipyawpitchstiffness());
593 ss << ", ";
594 ss << static_cast<unsigned>(this->target_hiprollstiffness());
595 ss << ", ";
596 ss << static_cast<unsigned>(this->target_hippitchstiffness());
597 ss << ", ";
598 ss << static_cast<unsigned>(this->target_kneepitchstiffness());
599 ss << ", ";
600 ss << static_cast<unsigned>(this->target_anklepitchstiffness());
601 ss << ", ";
602 ss << static_cast<unsigned>(this->target_anklerollstiffness());
603 ss << ", ";
604 ss << static_cast<unsigned>(this->target_pliability());
605 ss << ", ";
606 ss << this->target_hipyawpitch_active();
607 ss << ", ";
608 ss << this->target_hiproll_active();
609 ss << ", ";
610 ss << this->target_hippitch_active();
611 ss << ", ";
612 ss << this->target_kneepitch_active();
613 ss << ", ";
614 ss << this->target_anklepitch_active();
615 ss << ", ";
616 ss << this->target_ankleroll_active();
617 ss << ", ";
618 ss << this->target_leg_at_goal();
619 ss << ", ";
620 ss << this->target_leg_stop();
621 return ss.str();
622#endif
623 }
624
625#ifdef USE_WB_HAL_LEG_TARGET_C_CONVERSION
626 void from_string(const std::string &t_str) {
627 wb_hal_leg_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_LEG_TARGET_DESC_BUFFER_SIZE) {
634 return;
635 }
636 char var_str_buffer[HAL_LEG_TARGET_DESC_BUFFER_SIZE + 1];
637 char* var_str = &var_str_buffer[0];
638 char key_buffer[28];
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_hipyawpitch", key)) {
702 varIndex = 1;
703 } else if (0 == strcmp("target_hiproll", key)) {
704 varIndex = 2;
705 } else if (0 == strcmp("target_hippitch", key)) {
706 varIndex = 3;
707 } else if (0 == strcmp("target_kneepitch", key)) {
708 varIndex = 4;
709 } else if (0 == strcmp("target_anklepitch", key)) {
710 varIndex = 5;
711 } else if (0 == strcmp("target_ankleroll", key)) {
712 varIndex = 6;
713 } else if (0 == strcmp("target_leg", key)) {
714 varIndex = 7;
715 } else if (0 == strcmp("target_hipyawpitchstiffness", key)) {
716 varIndex = 8;
717 } else if (0 == strcmp("target_hiprollstiffness", key)) {
718 varIndex = 9;
719 } else if (0 == strcmp("target_hippitchstiffness", key)) {
720 varIndex = 10;
721 } else if (0 == strcmp("target_kneepitchstiffness", key)) {
722 varIndex = 11;
723 } else if (0 == strcmp("target_anklepitchstiffness", key)) {
724 varIndex = 12;
725 } else if (0 == strcmp("target_anklerollstiffness", key)) {
726 varIndex = 13;
727 } else if (0 == strcmp("target_pliability", key)) {
728 varIndex = 14;
729 } else if (0 == strcmp("target_hipyawpitch_active", key)) {
730 varIndex = 15;
731 } else if (0 == strcmp("target_hiproll_active", key)) {
732 varIndex = 16;
733 } else if (0 == strcmp("target_hippitch_active", key)) {
734 varIndex = 17;
735 } else if (0 == strcmp("target_kneepitch_active", key)) {
736 varIndex = 18;
737 } else if (0 == strcmp("target_anklepitch_active", key)) {
738 varIndex = 19;
739 } else if (0 == strcmp("target_ankleroll_active", key)) {
740 varIndex = 20;
741 } else if (0 == strcmp("target_leg_at_goal", key)) {
742 varIndex = 21;
743 } else if (0 == strcmp("target_leg_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_hipyawpitch(static_cast<int16_t>(atoi(var_str)));
759 break;
760 }
761 case 2:
762 {
763 this->set_target_hiproll(static_cast<int16_t>(atoi(var_str)));
764 break;
765 }
766 case 3:
767 {
768 this->set_target_hippitch(static_cast<int16_t>(atoi(var_str)));
769 break;
770 }
771 case 4:
772 {
773 this->set_target_kneepitch(static_cast<int16_t>(atoi(var_str)));
774 break;
775 }
776 case 5:
777 {
778 this->set_target_anklepitch(static_cast<int16_t>(atoi(var_str)));
779 break;
780 }
781 case 6:
782 {
783 this->set_target_ankleroll(static_cast<int16_t>(atoi(var_str)));
784 break;
785 }
786 case 7:
787 {
788 this->set_target_leg(static_cast<uint8_t>(atoi(var_str)));
789 break;
790 }
791 case 8:
792 {
793 this->set_target_hipyawpitchstiffness(static_cast<uint8_t>(atoi(var_str)));
794 break;
795 }
796 case 9:
797 {
798 this->set_target_hiprollstiffness(static_cast<uint8_t>(atoi(var_str)));
799 break;
800 }
801 case 10:
802 {
803 this->set_target_hippitchstiffness(static_cast<uint8_t>(atoi(var_str)));
804 break;
805 }
806 case 11:
807 {
808 this->set_target_kneepitchstiffness(static_cast<uint8_t>(atoi(var_str)));
809 break;
810 }
811 case 12:
812 {
813 this->set_target_anklepitchstiffness(static_cast<uint8_t>(atoi(var_str)));
814 break;
815 }
816 case 13:
817 {
818 this->set_target_anklerollstiffness(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_hipyawpitch_active(static_cast<unsigned int>(atoi(var_str)));
829 break;
830 }
831 case 16:
832 {
833 this->set_target_hiproll_active(static_cast<unsigned int>(atoi(var_str)));
834 break;
835 }
836 case 17:
837 {
838 this->set_target_hippitch_active(static_cast<unsigned int>(atoi(var_str)));
839 break;
840 }
841 case 18:
842 {
843 this->set_target_kneepitch_active(static_cast<unsigned int>(atoi(var_str)));
844 break;
845 }
846 case 19:
847 {
848 this->set_target_anklepitch_active(static_cast<unsigned int>(atoi(var_str)));
849 break;
850 }
851 case 20:
852 {
853 this->set_target_ankleroll_active(static_cast<unsigned int>(atoi(var_str)));
854 break;
855 }
856 case 21:
857 {
858 this->set_target_leg_at_goal(static_cast<unsigned int>(atoi(var_str)));
859 break;
860 }
861 case 22:
862 {
863 this->set_target_leg_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_LEG_TARGET_C_CONVERSION
882 char buffer[HAL_LEG_TARGET_DESC_BUFFER_SIZE+22];
883 wb_hal_leg_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_hipyawpitch()) << " | "
889 << static_cast<int>(target_hiproll()) << " | "
890 << static_cast<int>(target_hippitch()) << " | "
891 << static_cast<int>(target_kneepitch()) << " | "
892 << static_cast<int>(target_anklepitch()) << " | "
893 << static_cast<int>(target_ankleroll()) << " | "
894 << static_cast<int>(target_hipyawpitchstiffness()) << " | "
895 << static_cast<int>(target_hiprollstiffness()) << " | "
896 << static_cast<int>(target_hippitchstiffness()) << " | "
897 << static_cast<int>(target_kneepitchstiffness()) << " | "
898 << static_cast<int>(target_anklepitchstiffness()) << " | "
899 << static_cast<int>(target_anklerollstiffness()) << " | "
900 << static_cast<int>(target_hipyawpitch_active()) << " | "
901 << static_cast<int>(target_hiproll_active()) << " | "
902 << static_cast<int>(target_hippitch_active()) << " | "
903 << static_cast<int>(target_kneepitch_active()) << " | "
904 << static_cast<int>(target_anklepitch_active()) << " | "
905 << static_cast<int>(target_ankleroll_active()) << " | "
906 << static_cast<int>(target_movement_time()) << " | "
907 << static_cast<int>(target_pliability()) << " | "
908 << static_cast<int>(target_leg_at_goal()) << " | "
909 << static_cast<int>(target_leg_stop());
910 return ss.str();
911 }
912#endif
913#endif
914
915 //MARK: Leg - General
924 void tieToLeg(uint8_t leg)
925 {
926 set_target_leg(leg);
927 }
928
929 //MARK: Leg - Movements
930
943 float hiproll,
944 float hippitch,
945 float kneepitch,
946 float anklepitch,
947 float ankleroll,
948 int32_t time = INT_MAX)
949 {
954 }
955
968 float hiproll,
969 float hippitch,
970 float kneepitch,
971 float anklepitch,
972 float ankleroll,
973 int32_t time = INT_MAX)
974 {
979 }
980
987 void stop() {
989 }
990
991
997 void ready() {
998 set_target_leg_stop(false);
999 }
1000
1001
1012 void isAtGoal(bool goalReached)
1013 {
1014 set_target_leg_at_goal(goalReached);
1015 }
1016
1029 bool atGoal()
1030 {
1031 return target_leg_at_goal();
1032 }
1033
1047 {
1048 int16_t hipyawpitchMargin = static_cast<int16_t>(abs(target_hipyawpitch() - status.target_hipyawpitch()));
1049 int16_t hiprollMargin = static_cast<int16_t>(abs(target_hiproll() - status.target_hiproll()));
1050 int16_t hippitchMargin = static_cast<int16_t>(abs(target_hippitch() - status.target_hippitch()));
1051 int16_t kneepitchMargin = static_cast<int16_t>(abs(target_kneepitch() - status.target_kneepitch()));
1052 int16_t anklepitchMargin = static_cast<int16_t>(abs(target_anklepitch() - status.target_anklepitch()));
1053 int16_t anklerollMargin = static_cast<int16_t>(abs(target_ankleroll() - status.target_ankleroll()));
1054 if ( (hipyawpitchMargin <= tolerance.target_hipyawpitch())
1055 && (hiprollMargin <= tolerance.target_hiproll())
1056 && (hippitchMargin <= tolerance.target_hippitch())
1057 && (kneepitchMargin <= tolerance.target_kneepitch())
1058 && (anklepitchMargin <= tolerance.target_anklepitch())
1059 && (anklerollMargin <= tolerance.target_ankleroll())
1060 )
1061 {
1062 return true;
1063 }
1064 return false;
1065 }
1066
1067 //MARK: Leg - Pose
1068
1080 float hiproll,
1081 float hippitch,
1082 float kneepitch,
1083 float anklepitch,
1084 float ankleroll)
1085 {
1092 }
1093
1105 float hiproll,
1106 float hippitch,
1107 float kneepitch,
1108 float anklepitch,
1109 float ankleroll)
1110 {
1117 }
1118
1119
1126 void mirrorLeg(const HalLegTarget &other)
1127 {
1128 // Roll and Yaw angles need to be mirrored, others just copied.
1129 set_target_hipyawpitch(other.target_hipyawpitch());
1130 set_target_hiproll(-other.target_hiproll());
1131 set_target_hippitch(other.target_hippitch());
1132 set_target_kneepitch(other.target_kneepitch());
1133 set_target_anklepitch(other.target_anklepitch());
1134 set_target_ankleroll(-other.target_ankleroll());
1135 set_target_hipyawpitchstiffness(other.target_hipyawpitchstiffness());
1136 set_target_hiprollstiffness(other.target_hiprollstiffness());
1137 set_target_hippitchstiffness(other.target_hippitchstiffness());
1138 set_target_kneepitchstiffness(other.target_kneepitchstiffness());
1139 set_target_anklepitchstiffness(other.target_anklepitchstiffness());
1140 set_target_anklerollstiffness(other.target_anklerollstiffness());
1141 set_target_hipyawpitch_active(other.target_hipyawpitch_active());
1142 set_target_hiproll_active(other.target_hiproll_active());
1143 set_target_hippitch_active(other.target_hippitch_active());
1144 set_target_kneepitch_active(other.target_kneepitch_active());
1145 set_target_anklepitch_active(other.target_anklepitch_active());
1146 set_target_ankleroll_active(other.target_ankleroll_active());
1147 set_target_movement_time(other.target_movement_time());
1148 set_target_pliability(other.target_pliability());
1149 }
1150
1157 void copyPose(const HalLegTarget &other)
1158 {
1159 set_target_hipyawpitch(other.target_hipyawpitch());
1160 set_target_hiproll(other.target_hiproll());
1161 set_target_hippitch(other.target_hippitch());
1162 set_target_kneepitch(other.target_kneepitch());
1163 set_target_anklepitch(other.target_anklepitch());
1164 set_target_ankleroll(other.target_ankleroll());
1165 }
1166
1173 void mirrorPose(const HalLegTarget &other)
1174 {
1175 // Roll and Yaw angles need to be mirrored, others just copied.
1176 set_target_hipyawpitch(-other.target_hipyawpitch());
1177 set_target_hiproll(-other.target_hiproll());
1178 set_target_hippitch(other.target_hippitch());
1179 set_target_kneepitch(other.target_kneepitch());
1180 set_target_anklepitch(other.target_anklepitch());
1181 set_target_ankleroll(-other.target_ankleroll());
1182 }
1183
1192 bool hasSamePose(const HalLegTarget &other)
1193 {
1194 if (
1195 target_hipyawpitch() == other.target_hipyawpitch()
1196 && target_hiproll() == other.target_hiproll()
1197 && target_hippitch() == other.target_hippitch()
1198 && target_kneepitch() == other.target_kneepitch()
1199 && target_anklepitch() == other.target_anklepitch()
1200 && target_ankleroll() == other.target_ankleroll()
1201 )
1202 {
1203 return true;
1204 }
1205 return false;
1206 }
1207
1217 {
1218 if (
1219 target_hipyawpitch() == other.target_hipyawpitch()
1220 && target_hiproll() == -other.target_hiproll()
1221 && target_hippitch() == other.target_hippitch()
1222 && target_kneepitch() == other.target_kneepitch()
1223 && target_anklepitch() == other.target_anklepitch()
1224 && target_ankleroll() == -other.target_ankleroll()
1225 )
1226 {
1227 return true;
1228 }
1229 return false;
1230 }
1231
1232 //MARK: Leg - Stiffness
1233
1240 {
1247 }
1248
1256 {
1263 }
1264
1272 void setLegStiffness(float stiffness)
1273 {
1274 if ((stiffness <= 1.0f) && (stiffness >=0.0f)) {
1275 set_hipyawpitchstiffness(stiffness);
1276 set_hiprollstiffness(stiffness);
1277 set_hippitchstiffness(stiffness);
1278 set_kneepitchstiffness(stiffness);
1279 set_anklepitchstiffness(stiffness);
1280 set_anklerollstiffness(stiffness);
1281 }
1282 }
1283
1290 {
1297 }
1298
1299
1306 void copyStiffness(const HalLegTarget &other)
1307 {
1308 set_target_hipyawpitchstiffness(other.target_hipyawpitchstiffness());
1309 set_target_hiprollstiffness(other.target_hiprollstiffness());
1310 set_target_hippitchstiffness(other.target_hippitchstiffness());
1311 set_target_kneepitchstiffness(other.target_kneepitchstiffness());
1312 set_target_anklepitchstiffness(other.target_anklepitchstiffness());
1313 set_target_anklerollstiffness(other.target_anklerollstiffness());
1314 }
1315
1316
1317
1326 {
1327 if (
1328 target_hipyawpitchstiffness() == other.target_hipyawpitchstiffness()
1329 && target_hiprollstiffness() == other.target_hiprollstiffness()
1330 && target_hippitchstiffness() == other.target_hippitchstiffness()
1331 && target_kneepitchstiffness() == other.target_kneepitchstiffness()
1332 && target_anklepitchstiffness() == other.target_anklepitchstiffness()
1333 && target_anklerollstiffness() == other.target_anklerollstiffness()
1334 )
1335 {
1336 return true;
1337 }
1338 return false;
1339 }
1340
1341 //MARK: Leg - Pliability
1342
1353 {
1360 }
1361
1375 {
1382 }
1383
1384
1391 bool kneepitch, bool anklepitch, bool ankleroll)
1392 {
1399 }
1400
1407 }
1408
1415 }
1416
1423 }
1424
1425 //MARK: CUSTOM SETTERS (Converting floats into Integer representations)
1427 void set_hipyawpitch_DEG(float setting) {
1428 set_target_hipyawpitch(static_cast<int16_t>(setting * 10.0f));
1429 }
1430
1431 void set_hiproll_DEG(float setting) {
1432 set_target_hiproll(static_cast<int16_t>(setting * 10.0f));
1433 }
1434
1435 void set_hippitch_DEG(float setting) {
1436 set_target_hippitch(static_cast<int16_t>(setting * 10.0f));
1437 }
1438
1439 void set_kneepitch_DEG(float setting) {
1440 set_target_kneepitch(static_cast<int16_t>(setting * 10.0f));
1441 }
1442
1443 void set_anklepitch_DEG(float setting) {
1444 set_target_anklepitch(static_cast<int16_t>(setting * 10.0f));
1445 }
1446
1447 void set_ankleroll_DEG(float setting) {
1448 set_target_ankleroll(static_cast<int16_t>(setting * 10.0f));
1449 }
1450
1451
1453 void set_hipyawpitch_RAD(float setting) {
1454 set_target_hipyawpitch(static_cast<int16_t>(setting* DEG_OVER_RAD_10));
1455 }
1456
1457 void set_hiproll_RAD(float setting) {
1458 set_target_hiproll(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1459 }
1460
1461 void set_hippitch_RAD(float setting) {
1462 set_target_hippitch(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1463 }
1464
1465 void set_kneepitch_RAD(float setting) {
1466 set_target_kneepitch(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1467 }
1468
1469 void set_anklepitch_RAD(float setting) {
1470 set_target_anklepitch(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1471 }
1472
1473 void set_ankleroll_RAD(float setting) {
1474 set_target_ankleroll(static_cast<int16_t>(setting * DEG_OVER_RAD_10));
1475 }
1476
1478 void set_hipyawpitchstiffness(float setting) {
1479 set_target_hipyawpitchstiffness(static_cast<uint8_t>(setting * 100.0f));
1480 }
1481
1482 void set_hiprollstiffness(float setting) {
1483 set_target_hiprollstiffness(static_cast<uint8_t>(setting * 100.0f));
1484 }
1485
1486 void set_hippitchstiffness(float setting) {
1487 set_target_hippitchstiffness(static_cast<uint8_t>(setting * 100.0f));
1488 }
1489
1490 void set_kneepitchstiffness(float setting) {
1491 set_target_kneepitchstiffness(static_cast<uint8_t>(setting * 100.0f));
1492 }
1493
1494 void set_anklepitchstiffness(float setting) {
1495 set_target_anklepitchstiffness(static_cast<uint8_t>(setting * 100.0f));
1496 }
1497
1498 void set_anklerollstiffness(float setting) {
1499 set_target_anklerollstiffness(static_cast<uint8_t>(setting * 100.0f));
1500 }
1501
1502
1504 // void set_movement_time(int32_t time) {
1505 // set_target_movement_time(time);
1506 // }
1507
1508 //MARK: CUSTOM GETTERS (Converting Integer representations back to floats)
1511 return static_cast<float>(target_hipyawpitch() * 0.1f);
1512 }
1513
1515 return static_cast<float>(target_hiproll() * 0.1f);
1516 }
1517
1519 return static_cast<float>(target_hippitch() * 0.1f);
1520 }
1521
1523 return static_cast<float>(target_kneepitch() * 0.1f);
1524 }
1525
1527 return static_cast<float>(target_anklepitch() * 0.1f);
1528 }
1529
1531 return static_cast<float>(target_ankleroll() * 0.1f);
1532 }
1533
1534
1537 return static_cast<float>(target_hipyawpitch()) * RAD_OVER_DEG_10;
1538 }
1539
1541 return static_cast<float>(target_hiproll()) * RAD_OVER_DEG_10;
1542 }
1543
1545 return static_cast<float>(target_hippitch()) * RAD_OVER_DEG_10;
1546 }
1547
1549 return static_cast<float>(target_kneepitch()) * RAD_OVER_DEG_10;
1550 }
1551
1553 return static_cast<float>(target_anklepitch()) * RAD_OVER_DEG_10;
1554 }
1555
1557 return static_cast<float>(target_ankleroll()) * RAD_OVER_DEG_10;
1558 }
1559
1562 return static_cast<float>(target_hipyawpitchstiffness()) * 0.01f;
1563 }
1564
1566 return static_cast<float>(target_hiprollstiffness()) * 0.01f;
1567 }
1568
1570 return static_cast<float>(target_hippitchstiffness()) * 0.01f;
1571 }
1572
1574 return static_cast<float>(target_kneepitchstiffness()) * 0.01f;
1575 }
1576
1578 return static_cast<float>(target_anklepitchstiffness()) * 0.01f;
1579 }
1580
1582 return static_cast<float>(target_anklerollstiffness()) * 0.01f;
1583 }
1584 };
1585
1586}
1587
1588#endif
Class for moving a SINGLE robotic leg with up to 6 degrees of freedom using local coords of each join...
HalLegTarget(const struct wb_hal_leg_target &t_other)
Copy Constructor.
void from_string(const std::string &t_str)
void isAtGoal(bool goalReached)
Leg at Goal Setter Clients/Machines should not use this method.
void setLegPliability(bool hipyawpitch, bool hiproll, bool hippitch, bool kneepitch, bool anklepitch, bool ankleroll)
Individually set the active/passive state of each joint.
void setLegStiffnessMax()
Convenience function to set the stiffness of all the leg's joints to the maximum (1....
void set_target_ankleroll_active(const unsigned int &t_newValue)
uint8_t & target_hipyawpitchstiffness()
bool hasSameMirroredPose(const HalLegTarget &other)
Tests if this HalLegTarget object has the same mirrored pose settings as the other HalLegTarget objec...
void mirrorLeg(const HalLegTarget &other)
Convenience function to mirror leg settings about the XZ plane from one HalLegTarget object to anothe...
void set_anklepitch_DEG(float setting)
void set_target_leg_stop(const unsigned int &t_newValue)
void set_target_hipyawpitch_active(const unsigned int &t_newValue)
const int16_t & target_ankleroll() const
void set_hipyawpitchstiffness(float setting)
Stiffness Setters.
void set_hippitch_RAD(float setting)
HalLegTarget(const uint8_t &target_leg=0, const float hipyawpitch=0, const float hiproll=0, const float hippitch=0, const float kneepitch=0, const float anklepitch=0, const float ankleroll=0, const float hipyawpitchstiffness=0, const float hiprollstiffness=0, const float hippitchstiffness=0, const float kneepitchstiffness=0, const float anklepitchstiffness=0, const float anklerollstiffness=0, const bool hipyawpitch_active=true, const bool hiproll_active=true, const bool hippitch_active=true, const bool kneepitch_active=true, const bool anklepitch_active=true, const bool ankleroll_active=true, const int32_t movement_time=1000000, const uint8_t pliability=10, const bool leg_stop=false, const bool inRadians=false)
Constructor, defaults to LEFT_LEG.
bool isLegAllPassive()
Are all of the legs's joints set to passive.
bool isLegPassive()
Are any of the leg's joints set to passive.
void setPose_Rad(float hipyawpitch, float hiproll, float hippitch, float kneepitch, float anklepitch, float ankleroll)
Set Pose in radians.
unsigned int target_hiproll_active() const
void set_hiproll_RAD(float setting)
uint8_t & target_kneepitchstiffness()
void set_hippitchstiffness(float setting)
void set_kneepitchstiffness(float setting)
void set_ankleroll_RAD(float setting)
bool hasSamePose(const HalLegTarget &other)
Tests if this HalLegTarget object has the same pose settings as the other HalLegTarget object.
void goToWithTime_Rad(float hipyawpitch, float hiproll, float hippitch, float kneepitch, float anklepitch, float ankleroll, int32_t time=INT_MAX)
move to position in radians over a given time
void set_target_anklepitch_active(const unsigned int &t_newValue)
void set_anklepitchstiffness(float setting)
const uint8_t & target_pliability() const
void ready()
Set leg to ready state (Default) The leg will act on motion commands.
HalLegTarget & operator=(const HalLegTarget &t_other)
Copy Assignment Operator.
uint8_t & target_anklerollstiffness()
const uint8_t & target_anklerollstiffness() const
unsigned int target_hipyawpitch_active() const
const uint8_t & target_leg() const
void set_hippitch_DEG(float setting)
void set_target_hiproll_active(const unsigned int &t_newValue)
float get_hipyawpitch_DEG()
Movement Getters (Degrees)
void tieToLeg(uint8_t leg)
USE_WB_HAL_LEG_TARGET_C_CONVERSION WHITEBOARD_POSTER_STRING_CONVERSION.
unsigned int target_hippitch_active() const
const uint8_t & target_hippitchstiffness() const
unsigned int target_kneepitch_active() const
void set_target_movement_time(const int32_t &t_newValue)
void setLegStiffnessNormal()
Convenience function to set the stiffness of all the leg's joints to what Aldebaran considers 'normal...
const uint8_t & target_hiprollstiffness() const
void set_hipyawpitch_DEG(float setting)
Movement Setters (Degrees)
uint8_t & target_hippitchstiffness()
void set_kneepitch_DEG(float setting)
void set_target_hipyawpitch(const int16_t &t_newValue)
void from_string(const std::string &str)
Parser for recreating this class (NYI)
void set_kneepitch_RAD(float setting)
void set_target_ankleroll(const int16_t &t_newValue)
const int32_t & target_movement_time() const
bool atTargetLocation(HalLegTarget status, HalLegTarget tolerance)
Client side test to determine if leg is at the target location, allowing for specified tolerances.
unsigned int target_anklepitch_active() const
void set_target_hiproll(const int16_t &t_newValue)
void set_target_leg(const uint8_t &t_newValue)
void mirrorPose(const HalLegTarget &other)
Convenience function to mirror pose settings about the XZ plane from one HalLegTarget object to anoth...
void set_target_kneepitch_active(const unsigned int &t_newValue)
void set_target_kneepitch(const int16_t &t_newValue)
const int16_t & target_kneepitch() const
void set_anklerollstiffness(float setting)
uint8_t & target_anklepitchstiffness()
void copyStiffness(const HalLegTarget &other)
Convenience function to copy stiffness settings from one HalLegTarget object to another.
void set_target_anklerollstiffness(const uint8_t &t_newValue)
void set_target_hipyawpitchstiffness(const uint8_t &t_newValue)
void goToWithTime_Deg(float hipyawpitch, float hiproll, float hippitch, float kneepitch, float anklepitch, float ankleroll, int32_t time=INT_MAX)
move to position in degrees over a given time
void copyPose(const HalLegTarget &other)
Convenience function to copy pose settings from one HalLegTarget object to another.
void setLegStiffness(float stiffness)
Convenience function to set uniform stiffness on all leg joints to a custom value.
void set_hiproll_DEG(float setting)
void set_target_hippitchstiffness(const uint8_t &t_newValue)
void set_target_hippitch_active(const unsigned int &t_newValue)
bool hasSameStiffness(const HalLegTarget &other)
Tests if this HalLegTarget object has the same stiffness settings as the other HalLegTarget object.
const int16_t & target_anklepitch() const
void setPose_Deg(float hipyawpitch, float hiproll, float hippitch, float kneepitch, float anklepitch, float ankleroll)
Set Pose in degrees.
bool isLegAllActive()
Are all of the leg's joints set to active.
void set_ankleroll_DEG(float setting)
void stop()
Command the leg to stop at its current location and not act on motion commands until ready() is calle...
void set_target_hippitch(const int16_t &t_newValue)
const uint8_t & target_hipyawpitchstiffness() const
std::string valueDescription()
WHITEBOARD_POSTER_STRING_CONVERSION.
void setLegActive()
Set leg to be Active (DEDAULT DCM state) The leg is active and manual movements will be resisted,...
void set_anklepitch_RAD(float setting)
void setLegStiffnessOff()
Convenience function to turn off stiffness in all the leg's joints (0.0f).
void set_target_kneepitchstiffness(const uint8_t &t_newValue)
HalLegTarget(const std::string &t_str)
String Constructor.
const int16_t & target_hipyawpitch() const
const uint8_t & target_kneepitchstiffness() const
void set_hiprollstiffness(float setting)
void setLegPassive()
Set leg to be Passive Manually moving the leg causes the leg to stay in the new position.
unsigned int target_leg_at_goal() const
float get_hipyawpitchstiffness()
Stiffness Getters.
bool operator==(const HalLegTarget &t_other) const
bool operator!=(const HalLegTarget &t_other) const
void set_target_leg_at_goal(const unsigned int &t_newValue)
const uint8_t & target_anklepitchstiffness() const
const int16_t & target_hippitch() const
float get_hipyawpitch_RAD()
Movement Getters (Radians)
void set_target_pliability(const uint8_t &t_newValue)
HalLegTarget(int32_t t_target_movement_time=INT_MAX, int16_t t_target_hipyawpitch=0, int16_t t_target_hiproll=0, int16_t t_target_hippitch=0, int16_t t_target_kneepitch=0, int16_t t_target_anklepitch=0, int16_t t_target_ankleroll=0, uint8_t t_target_leg=(static_cast< uint8_t >(0)), uint8_t t_target_hipyawpitchstiffness=0, uint8_t t_target_hiprollstiffness=0, uint8_t t_target_hippitchstiffness=0, uint8_t t_target_kneepitchstiffness=0, uint8_t t_target_anklepitchstiffness=0, uint8_t t_target_anklerollstiffness=0, uint8_t t_target_pliability=0, unsigned int t_target_hipyawpitch_active=true, unsigned int t_target_hiproll_active=true, unsigned int t_target_hippitch_active=true, unsigned int t_target_kneepitch_active=true, unsigned int t_target_anklepitch_active=true, unsigned int t_target_ankleroll_active=true, unsigned int t_target_leg_at_goal=false, unsigned int t_target_leg_stop=false)
Create a new HalLegTarget.
void set_target_anklepitchstiffness(const uint8_t &t_newValue)
bool atGoal()
Leg at Goal Getter Clients/Machines should use this getter to test if the DCM has reported that the l...
unsigned int target_leg_stop() const
HalLegTarget(const HalLegTarget &t_other)
Copy Constructor.
void set_target_anklepitch(const int16_t &t_newValue)
const int16_t & target_hiproll() const
void set_hipyawpitch_RAD(float setting)
Movement Setters (Radians)
void set_target_hiprollstiffness(const uint8_t &t_newValue)
unsigned int target_ankleroll_active() const
/file APM_Interface.h
WHITEBOARD_POSTER_STRING_CONVERSION.
uint8_t target_pliability
target leg's pliability when in Passive Mode; When the leg is passive, this value reduces the update ...
uint8_t target_hipyawpitchstiffness
target hip yaw pitch stiffness as a percentage
uint8_t target_hiprollstiffness
target hip roll stiffness as a percentage
uint8_t target_kneepitchstiffness
target knee pitch stiffness as a percentage
unsigned int target_anklepitch_active
Is the ankle pitch Active (true[DEFAULT]) or Passive (false)
uint8_t target_anklerollstiffness
target ankle roll stiffness as a percentage
int16_t target_hipyawpitch
target hip yaw pitch angle in 10ths of degrees
uint8_t target_leg
target leg number; This property is used strictly for accounting purposes when the struct is stored w...
uint8_t target_anklepitchstiffness
target ankle pitch stiffness as a percentage
unsigned int target_ankleroll_active
Is the ankle roll Active (true[DEFAULT]) or Passive (false)
unsigned int target_hiproll_active
Is the hip roll Active (true[DEFAULT]) or Passive (false)
unsigned int target_hipyawpitch_active
Is the hipyawpitch Active (true[DEFAULT]) or Passive (false).
int16_t target_kneepitch
target knee pitch angle in 10ths of degrees
int32_t target_movement_time
Control Message: The elapsed time, in mSec, in which the movement should be completed.
int16_t target_anklepitch
target ankle pitch angle in 10ths of degrees
int16_t target_ankleroll
target ankle roll angle in 10ths of degrees
unsigned int target_kneepitch_active
Is the knee pitch Active (true[DEFAULT]) or Passive (false)
unsigned int target_leg_stop
Control Message: Stop the leg at its current location.
unsigned int target_hippitch_active
Is the hip pitch Active (true[DEFAULT]) or Passive (false)
uint8_t target_hippitchstiffness
target hip pitch stiffness as a percentage
int16_t target_hiproll
target hip roll angle angle in 10ths of degrees
unsigned int target_leg_at_goal
Control Message: Not used.
int16_t target_hippitch
target hip pitch angle in 10ths of degrees
target_hipyawpitch target_hippitch target_anklepitch target_leg target_hiprollstiffness target_kneepitchstiffness target_anklerollstiffness int16_t int16_t int16_t int16_t int16_t anklepitch
target_hipyawpitch target_hippitch target_anklepitch target_leg target_hiprollstiffness target_kneepitchstiffness target_anklerollstiffness int16_t int16_t int16_t int16_t kneepitch
target_hipyawpitch target_hippitch target_anklepitch target_leg target_hiprollstiffness target_kneepitchstiffness target_anklerollstiffness int16_t int16_t int16_t hippitch
target_hipyawpitch target_hippitch target_anklepitch target_leg target_hiprollstiffness target_kneepitchstiffness target_anklerollstiffness int16_t int16_t hiproll
target_hipyawpitch target_hippitch target_anklepitch target_leg target_hiprollstiffness target_kneepitchstiffness target_anklerollstiffness int16_t hipyawpitch
target_hipyawpitch target_hippitch target_anklepitch target_leg target_hiprollstiffness target_kneepitchstiffness target_anklerollstiffness int16_t int16_t int16_t int16_t int16_t int16_t ankleroll
const char * wb_hal_leg_target_to_string(const struct wb_hal_leg_target *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_hal_leg_target_value_description(const struct wb_hal_leg_target *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_hal_leg_target_description(const struct wb_hal_leg_target *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_hal_leg_target * wb_hal_leg_target_from_string(struct wb_hal_leg_target *self, const char *str)
Convert from a string.
#define HAL_LEG_TARGET_DESC_BUFFER_SIZE
#define LEFT_LEG
#define HAL_LEG_TARGET_TO_STRING_BUFFER_SIZE