Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * HumanoidMotionInterface.cpp - Fawkes BlackBoard Interface - HumanoidMotionInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2008 Tim Niemueller 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <interfaces/HumanoidMotionInterface.h> 00025 00026 #include <core/exceptions/software.h> 00027 00028 #include <cstring> 00029 #include <cstdlib> 00030 00031 namespace fawkes { 00032 00033 /** @class HumanoidMotionInterface <interfaces/HumanoidMotionInterface.h> 00034 * HumanoidMotionInterface Fawkes BlackBoard Interface. 00035 * 00036 This interface provides acces to basic humanoid motion patterns. 00037 00038 * @ingroup FawkesInterfaces 00039 */ 00040 00041 00042 00043 /** Constructor */ 00044 HumanoidMotionInterface::HumanoidMotionInterface() : Interface() 00045 { 00046 data_size = sizeof(HumanoidMotionInterface_data_t); 00047 data_ptr = malloc(data_size); 00048 data = (HumanoidMotionInterface_data_t *)data_ptr; 00049 data_ts = (interface_data_ts_t *)data_ptr; 00050 memset(data_ptr, 0, data_size); 00051 add_fieldinfo(IFT_BOOL, "moving", 1, &data->moving); 00052 add_fieldinfo(IFT_BOOL, "arms_enabled", 1, &data->arms_enabled); 00053 add_fieldinfo(IFT_UINT32, "msgid", 1, &data->msgid); 00054 add_messageinfo("StopMessage"); 00055 add_messageinfo("WalkStraightMessage"); 00056 add_messageinfo("WalkSidewaysMessage"); 00057 add_messageinfo("WalkArcMessage"); 00058 add_messageinfo("WalkVelocityMessage"); 00059 add_messageinfo("TurnMessage"); 00060 add_messageinfo("KickMessage"); 00061 add_messageinfo("ParkMessage"); 00062 add_messageinfo("GetUpMessage"); 00063 add_messageinfo("StandupMessage"); 00064 add_messageinfo("MoveHeadMessage"); 00065 unsigned char tmp_hash[] = {0x58, 0x4e, 0xd5, 0x1c, 0xbb, 0xf7, 0x6d, 0x85, 0x15, 0x52, 0x3b, 0x5a, 0x2b, 0x99, 0x5d, 0xc6}; 00066 set_hash(tmp_hash); 00067 } 00068 00069 /** Destructor */ 00070 HumanoidMotionInterface::~HumanoidMotionInterface() 00071 { 00072 free(data_ptr); 00073 } 00074 /** Convert LegEnum constant to string. 00075 * @param value value to convert to string 00076 * @return constant value as string. 00077 */ 00078 const char * 00079 HumanoidMotionInterface::tostring_LegEnum(LegEnum value) const 00080 { 00081 switch (value) { 00082 case LEG_LEFT: return "LEG_LEFT"; 00083 case LEG_RIGHT: return "LEG_RIGHT"; 00084 default: return "UNKNOWN"; 00085 } 00086 } 00087 /** Convert StandupEnum constant to string. 00088 * @param value value to convert to string 00089 * @return constant value as string. 00090 */ 00091 const char * 00092 HumanoidMotionInterface::tostring_StandupEnum(StandupEnum value) const 00093 { 00094 switch (value) { 00095 case STANDUP_DETECT: return "STANDUP_DETECT"; 00096 case STANDUP_BACK: return "STANDUP_BACK"; 00097 case STANDUP_FRONT: return "STANDUP_FRONT"; 00098 default: return "UNKNOWN"; 00099 } 00100 } 00101 /* Methods */ 00102 /** Get moving value. 00103 * True if the robot is moving. 00104 * @return moving value 00105 */ 00106 bool 00107 HumanoidMotionInterface::is_moving() const 00108 { 00109 return data->moving; 00110 } 00111 00112 /** Get maximum length of moving value. 00113 * @return length of moving value, can be length of the array or number of 00114 * maximum number of characters for a string 00115 */ 00116 size_t 00117 HumanoidMotionInterface::maxlenof_moving() const 00118 { 00119 return 1; 00120 } 00121 00122 /** Set moving value. 00123 * True if the robot is moving. 00124 * @param new_moving new moving value 00125 */ 00126 void 00127 HumanoidMotionInterface::set_moving(const bool new_moving) 00128 { 00129 data->moving = new_moving; 00130 data_changed = true; 00131 } 00132 00133 /** Get arms_enabled value. 00134 * 00135 If true the arms are controlled during walking for balancing. 00136 00137 * @return arms_enabled value 00138 */ 00139 bool 00140 HumanoidMotionInterface::is_arms_enabled() const 00141 { 00142 return data->arms_enabled; 00143 } 00144 00145 /** Get maximum length of arms_enabled value. 00146 * @return length of arms_enabled value, can be length of the array or number of 00147 * maximum number of characters for a string 00148 */ 00149 size_t 00150 HumanoidMotionInterface::maxlenof_arms_enabled() const 00151 { 00152 return 1; 00153 } 00154 00155 /** Set arms_enabled value. 00156 * 00157 If true the arms are controlled during walking for balancing. 00158 00159 * @param new_arms_enabled new arms_enabled value 00160 */ 00161 void 00162 HumanoidMotionInterface::set_arms_enabled(const bool new_arms_enabled) 00163 { 00164 data->arms_enabled = new_arms_enabled; 00165 data_changed = true; 00166 } 00167 00168 /** Get msgid value. 00169 * 00170 The ID of the message that is currently being 00171 processed, or 0 if no message is being processed. 00172 00173 * @return msgid value 00174 */ 00175 uint32_t 00176 HumanoidMotionInterface::msgid() const 00177 { 00178 return data->msgid; 00179 } 00180 00181 /** Get maximum length of msgid value. 00182 * @return length of msgid value, can be length of the array or number of 00183 * maximum number of characters for a string 00184 */ 00185 size_t 00186 HumanoidMotionInterface::maxlenof_msgid() const 00187 { 00188 return 1; 00189 } 00190 00191 /** Set msgid value. 00192 * 00193 The ID of the message that is currently being 00194 processed, or 0 if no message is being processed. 00195 00196 * @param new_msgid new msgid value 00197 */ 00198 void 00199 HumanoidMotionInterface::set_msgid(const uint32_t new_msgid) 00200 { 00201 data->msgid = new_msgid; 00202 data_changed = true; 00203 } 00204 00205 /* =========== message create =========== */ 00206 Message * 00207 HumanoidMotionInterface::create_message(const char *type) const 00208 { 00209 if ( strncmp("StopMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00210 return new StopMessage(); 00211 } else if ( strncmp("WalkStraightMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00212 return new WalkStraightMessage(); 00213 } else if ( strncmp("WalkSidewaysMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00214 return new WalkSidewaysMessage(); 00215 } else if ( strncmp("WalkArcMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00216 return new WalkArcMessage(); 00217 } else if ( strncmp("WalkVelocityMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00218 return new WalkVelocityMessage(); 00219 } else if ( strncmp("TurnMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00220 return new TurnMessage(); 00221 } else if ( strncmp("KickMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00222 return new KickMessage(); 00223 } else if ( strncmp("ParkMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00224 return new ParkMessage(); 00225 } else if ( strncmp("GetUpMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00226 return new GetUpMessage(); 00227 } else if ( strncmp("StandupMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00228 return new StandupMessage(); 00229 } else if ( strncmp("MoveHeadMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) { 00230 return new MoveHeadMessage(); 00231 } else { 00232 throw UnknownTypeException("The given type '%s' does not match any known " 00233 "message type for this interface type.", type); 00234 } 00235 } 00236 00237 00238 /** Copy values from other interface. 00239 * @param other other interface to copy values from 00240 */ 00241 void 00242 HumanoidMotionInterface::copy_values(const Interface *other) 00243 { 00244 const HumanoidMotionInterface *oi = dynamic_cast<const HumanoidMotionInterface *>(other); 00245 if (oi == NULL) { 00246 throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)", 00247 type(), other->type()); 00248 } 00249 memcpy(data, oi->data, sizeof(HumanoidMotionInterface_data_t)); 00250 } 00251 00252 const char * 00253 HumanoidMotionInterface::enum_tostring(const char *enumtype, int val) const 00254 { 00255 if (strcmp(enumtype, "LegEnum") == 0) { 00256 return tostring_LegEnum((LegEnum)val); 00257 } 00258 if (strcmp(enumtype, "StandupEnum") == 0) { 00259 return tostring_StandupEnum((StandupEnum)val); 00260 } 00261 throw UnknownTypeException("Unknown enum type %s", enumtype); 00262 } 00263 00264 /* =========== messages =========== */ 00265 /** @class HumanoidMotionInterface::StopMessage <interfaces/HumanoidMotionInterface.h> 00266 * StopMessage Fawkes BlackBoard Interface Message. 00267 * 00268 00269 */ 00270 00271 00272 /** Constructor */ 00273 HumanoidMotionInterface::StopMessage::StopMessage() : Message("StopMessage") 00274 { 00275 data_size = sizeof(StopMessage_data_t); 00276 data_ptr = malloc(data_size); 00277 memset(data_ptr, 0, data_size); 00278 data = (StopMessage_data_t *)data_ptr; 00279 data_ts = (message_data_ts_t *)data_ptr; 00280 } 00281 00282 /** Destructor */ 00283 HumanoidMotionInterface::StopMessage::~StopMessage() 00284 { 00285 free(data_ptr); 00286 } 00287 00288 /** Copy constructor. 00289 * @param m message to copy from 00290 */ 00291 HumanoidMotionInterface::StopMessage::StopMessage(const StopMessage *m) : Message("StopMessage") 00292 { 00293 data_size = m->data_size; 00294 data_ptr = malloc(data_size); 00295 memcpy(data_ptr, m->data_ptr, data_size); 00296 data = (StopMessage_data_t *)data_ptr; 00297 data_ts = (message_data_ts_t *)data_ptr; 00298 } 00299 00300 /* Methods */ 00301 /** Clone this message. 00302 * Produces a message of the same type as this message and copies the 00303 * data to the new message. 00304 * @return clone of this message 00305 */ 00306 Message * 00307 HumanoidMotionInterface::StopMessage::clone() const 00308 { 00309 return new HumanoidMotionInterface::StopMessage(this); 00310 } 00311 /** @class HumanoidMotionInterface::WalkStraightMessage <interfaces/HumanoidMotionInterface.h> 00312 * WalkStraightMessage Fawkes BlackBoard Interface Message. 00313 * 00314 00315 */ 00316 00317 00318 /** Constructor with initial values. 00319 * @param ini_distance initial value for distance 00320 */ 00321 HumanoidMotionInterface::WalkStraightMessage::WalkStraightMessage(const float ini_distance) : Message("WalkStraightMessage") 00322 { 00323 data_size = sizeof(WalkStraightMessage_data_t); 00324 data_ptr = malloc(data_size); 00325 memset(data_ptr, 0, data_size); 00326 data = (WalkStraightMessage_data_t *)data_ptr; 00327 data_ts = (message_data_ts_t *)data_ptr; 00328 data->distance = ini_distance; 00329 add_fieldinfo(IFT_FLOAT, "distance", 1, &data->distance); 00330 } 00331 /** Constructor */ 00332 HumanoidMotionInterface::WalkStraightMessage::WalkStraightMessage() : Message("WalkStraightMessage") 00333 { 00334 data_size = sizeof(WalkStraightMessage_data_t); 00335 data_ptr = malloc(data_size); 00336 memset(data_ptr, 0, data_size); 00337 data = (WalkStraightMessage_data_t *)data_ptr; 00338 data_ts = (message_data_ts_t *)data_ptr; 00339 add_fieldinfo(IFT_FLOAT, "distance", 1, &data->distance); 00340 } 00341 00342 /** Destructor */ 00343 HumanoidMotionInterface::WalkStraightMessage::~WalkStraightMessage() 00344 { 00345 free(data_ptr); 00346 } 00347 00348 /** Copy constructor. 00349 * @param m message to copy from 00350 */ 00351 HumanoidMotionInterface::WalkStraightMessage::WalkStraightMessage(const WalkStraightMessage *m) : Message("WalkStraightMessage") 00352 { 00353 data_size = m->data_size; 00354 data_ptr = malloc(data_size); 00355 memcpy(data_ptr, m->data_ptr, data_size); 00356 data = (WalkStraightMessage_data_t *)data_ptr; 00357 data_ts = (message_data_ts_t *)data_ptr; 00358 } 00359 00360 /* Methods */ 00361 /** Get distance value. 00362 * Distance in m to walk. 00363 * @return distance value 00364 */ 00365 float 00366 HumanoidMotionInterface::WalkStraightMessage::distance() const 00367 { 00368 return data->distance; 00369 } 00370 00371 /** Get maximum length of distance value. 00372 * @return length of distance value, can be length of the array or number of 00373 * maximum number of characters for a string 00374 */ 00375 size_t 00376 HumanoidMotionInterface::WalkStraightMessage::maxlenof_distance() const 00377 { 00378 return 1; 00379 } 00380 00381 /** Set distance value. 00382 * Distance in m to walk. 00383 * @param new_distance new distance value 00384 */ 00385 void 00386 HumanoidMotionInterface::WalkStraightMessage::set_distance(const float new_distance) 00387 { 00388 data->distance = new_distance; 00389 } 00390 00391 /** Clone this message. 00392 * Produces a message of the same type as this message and copies the 00393 * data to the new message. 00394 * @return clone of this message 00395 */ 00396 Message * 00397 HumanoidMotionInterface::WalkStraightMessage::clone() const 00398 { 00399 return new HumanoidMotionInterface::WalkStraightMessage(this); 00400 } 00401 /** @class HumanoidMotionInterface::WalkSidewaysMessage <interfaces/HumanoidMotionInterface.h> 00402 * WalkSidewaysMessage Fawkes BlackBoard Interface Message. 00403 * 00404 00405 */ 00406 00407 00408 /** Constructor with initial values. 00409 * @param ini_distance initial value for distance 00410 */ 00411 HumanoidMotionInterface::WalkSidewaysMessage::WalkSidewaysMessage(const float ini_distance) : Message("WalkSidewaysMessage") 00412 { 00413 data_size = sizeof(WalkSidewaysMessage_data_t); 00414 data_ptr = malloc(data_size); 00415 memset(data_ptr, 0, data_size); 00416 data = (WalkSidewaysMessage_data_t *)data_ptr; 00417 data_ts = (message_data_ts_t *)data_ptr; 00418 data->distance = ini_distance; 00419 add_fieldinfo(IFT_FLOAT, "distance", 1, &data->distance); 00420 } 00421 /** Constructor */ 00422 HumanoidMotionInterface::WalkSidewaysMessage::WalkSidewaysMessage() : Message("WalkSidewaysMessage") 00423 { 00424 data_size = sizeof(WalkSidewaysMessage_data_t); 00425 data_ptr = malloc(data_size); 00426 memset(data_ptr, 0, data_size); 00427 data = (WalkSidewaysMessage_data_t *)data_ptr; 00428 data_ts = (message_data_ts_t *)data_ptr; 00429 add_fieldinfo(IFT_FLOAT, "distance", 1, &data->distance); 00430 } 00431 00432 /** Destructor */ 00433 HumanoidMotionInterface::WalkSidewaysMessage::~WalkSidewaysMessage() 00434 { 00435 free(data_ptr); 00436 } 00437 00438 /** Copy constructor. 00439 * @param m message to copy from 00440 */ 00441 HumanoidMotionInterface::WalkSidewaysMessage::WalkSidewaysMessage(const WalkSidewaysMessage *m) : Message("WalkSidewaysMessage") 00442 { 00443 data_size = m->data_size; 00444 data_ptr = malloc(data_size); 00445 memcpy(data_ptr, m->data_ptr, data_size); 00446 data = (WalkSidewaysMessage_data_t *)data_ptr; 00447 data_ts = (message_data_ts_t *)data_ptr; 00448 } 00449 00450 /* Methods */ 00451 /** Get distance value. 00452 * Distance in m to walk. 00453 * @return distance value 00454 */ 00455 float 00456 HumanoidMotionInterface::WalkSidewaysMessage::distance() const 00457 { 00458 return data->distance; 00459 } 00460 00461 /** Get maximum length of distance value. 00462 * @return length of distance value, can be length of the array or number of 00463 * maximum number of characters for a string 00464 */ 00465 size_t 00466 HumanoidMotionInterface::WalkSidewaysMessage::maxlenof_distance() const 00467 { 00468 return 1; 00469 } 00470 00471 /** Set distance value. 00472 * Distance in m to walk. 00473 * @param new_distance new distance value 00474 */ 00475 void 00476 HumanoidMotionInterface::WalkSidewaysMessage::set_distance(const float new_distance) 00477 { 00478 data->distance = new_distance; 00479 } 00480 00481 /** Clone this message. 00482 * Produces a message of the same type as this message and copies the 00483 * data to the new message. 00484 * @return clone of this message 00485 */ 00486 Message * 00487 HumanoidMotionInterface::WalkSidewaysMessage::clone() const 00488 { 00489 return new HumanoidMotionInterface::WalkSidewaysMessage(this); 00490 } 00491 /** @class HumanoidMotionInterface::WalkArcMessage <interfaces/HumanoidMotionInterface.h> 00492 * WalkArcMessage Fawkes BlackBoard Interface Message. 00493 * 00494 00495 */ 00496 00497 00498 /** Constructor with initial values. 00499 * @param ini_angle initial value for angle 00500 * @param ini_radius initial value for radius 00501 */ 00502 HumanoidMotionInterface::WalkArcMessage::WalkArcMessage(const float ini_angle, const float ini_radius) : Message("WalkArcMessage") 00503 { 00504 data_size = sizeof(WalkArcMessage_data_t); 00505 data_ptr = malloc(data_size); 00506 memset(data_ptr, 0, data_size); 00507 data = (WalkArcMessage_data_t *)data_ptr; 00508 data_ts = (message_data_ts_t *)data_ptr; 00509 data->angle = ini_angle; 00510 data->radius = ini_radius; 00511 add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle); 00512 add_fieldinfo(IFT_FLOAT, "radius", 1, &data->radius); 00513 } 00514 /** Constructor */ 00515 HumanoidMotionInterface::WalkArcMessage::WalkArcMessage() : Message("WalkArcMessage") 00516 { 00517 data_size = sizeof(WalkArcMessage_data_t); 00518 data_ptr = malloc(data_size); 00519 memset(data_ptr, 0, data_size); 00520 data = (WalkArcMessage_data_t *)data_ptr; 00521 data_ts = (message_data_ts_t *)data_ptr; 00522 add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle); 00523 add_fieldinfo(IFT_FLOAT, "radius", 1, &data->radius); 00524 } 00525 00526 /** Destructor */ 00527 HumanoidMotionInterface::WalkArcMessage::~WalkArcMessage() 00528 { 00529 free(data_ptr); 00530 } 00531 00532 /** Copy constructor. 00533 * @param m message to copy from 00534 */ 00535 HumanoidMotionInterface::WalkArcMessage::WalkArcMessage(const WalkArcMessage *m) : Message("WalkArcMessage") 00536 { 00537 data_size = m->data_size; 00538 data_ptr = malloc(data_size); 00539 memcpy(data_ptr, m->data_ptr, data_size); 00540 data = (WalkArcMessage_data_t *)data_ptr; 00541 data_ts = (message_data_ts_t *)data_ptr; 00542 } 00543 00544 /* Methods */ 00545 /** Get angle value. 00546 * Angle in radians to turn over the way. 00547 * @return angle value 00548 */ 00549 float 00550 HumanoidMotionInterface::WalkArcMessage::angle() const 00551 { 00552 return data->angle; 00553 } 00554 00555 /** Get maximum length of angle value. 00556 * @return length of angle value, can be length of the array or number of 00557 * maximum number of characters for a string 00558 */ 00559 size_t 00560 HumanoidMotionInterface::WalkArcMessage::maxlenof_angle() const 00561 { 00562 return 1; 00563 } 00564 00565 /** Set angle value. 00566 * Angle in radians to turn over the way. 00567 * @param new_angle new angle value 00568 */ 00569 void 00570 HumanoidMotionInterface::WalkArcMessage::set_angle(const float new_angle) 00571 { 00572 data->angle = new_angle; 00573 } 00574 00575 /** Get radius value. 00576 * Radius in m of the circle in m. 00577 * @return radius value 00578 */ 00579 float 00580 HumanoidMotionInterface::WalkArcMessage::radius() const 00581 { 00582 return data->radius; 00583 } 00584 00585 /** Get maximum length of radius value. 00586 * @return length of radius value, can be length of the array or number of 00587 * maximum number of characters for a string 00588 */ 00589 size_t 00590 HumanoidMotionInterface::WalkArcMessage::maxlenof_radius() const 00591 { 00592 return 1; 00593 } 00594 00595 /** Set radius value. 00596 * Radius in m of the circle in m. 00597 * @param new_radius new radius value 00598 */ 00599 void 00600 HumanoidMotionInterface::WalkArcMessage::set_radius(const float new_radius) 00601 { 00602 data->radius = new_radius; 00603 } 00604 00605 /** Clone this message. 00606 * Produces a message of the same type as this message and copies the 00607 * data to the new message. 00608 * @return clone of this message 00609 */ 00610 Message * 00611 HumanoidMotionInterface::WalkArcMessage::clone() const 00612 { 00613 return new HumanoidMotionInterface::WalkArcMessage(this); 00614 } 00615 /** @class HumanoidMotionInterface::WalkVelocityMessage <interfaces/HumanoidMotionInterface.h> 00616 * WalkVelocityMessage Fawkes BlackBoard Interface Message. 00617 * 00618 00619 */ 00620 00621 00622 /** Constructor with initial values. 00623 * @param ini_x initial value for x 00624 * @param ini_y initial value for y 00625 * @param ini_theta initial value for theta 00626 * @param ini_speed initial value for speed 00627 */ 00628 HumanoidMotionInterface::WalkVelocityMessage::WalkVelocityMessage(const float ini_x, const float ini_y, const float ini_theta, const float ini_speed) : Message("WalkVelocityMessage") 00629 { 00630 data_size = sizeof(WalkVelocityMessage_data_t); 00631 data_ptr = malloc(data_size); 00632 memset(data_ptr, 0, data_size); 00633 data = (WalkVelocityMessage_data_t *)data_ptr; 00634 data_ts = (message_data_ts_t *)data_ptr; 00635 data->x = ini_x; 00636 data->y = ini_y; 00637 data->theta = ini_theta; 00638 data->speed = ini_speed; 00639 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x); 00640 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y); 00641 add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta); 00642 add_fieldinfo(IFT_FLOAT, "speed", 1, &data->speed); 00643 } 00644 /** Constructor */ 00645 HumanoidMotionInterface::WalkVelocityMessage::WalkVelocityMessage() : Message("WalkVelocityMessage") 00646 { 00647 data_size = sizeof(WalkVelocityMessage_data_t); 00648 data_ptr = malloc(data_size); 00649 memset(data_ptr, 0, data_size); 00650 data = (WalkVelocityMessage_data_t *)data_ptr; 00651 data_ts = (message_data_ts_t *)data_ptr; 00652 add_fieldinfo(IFT_FLOAT, "x", 1, &data->x); 00653 add_fieldinfo(IFT_FLOAT, "y", 1, &data->y); 00654 add_fieldinfo(IFT_FLOAT, "theta", 1, &data->theta); 00655 add_fieldinfo(IFT_FLOAT, "speed", 1, &data->speed); 00656 } 00657 00658 /** Destructor */ 00659 HumanoidMotionInterface::WalkVelocityMessage::~WalkVelocityMessage() 00660 { 00661 free(data_ptr); 00662 } 00663 00664 /** Copy constructor. 00665 * @param m message to copy from 00666 */ 00667 HumanoidMotionInterface::WalkVelocityMessage::WalkVelocityMessage(const WalkVelocityMessage *m) : Message("WalkVelocityMessage") 00668 { 00669 data_size = m->data_size; 00670 data_ptr = malloc(data_size); 00671 memcpy(data_ptr, m->data_ptr, data_size); 00672 data = (WalkVelocityMessage_data_t *)data_ptr; 00673 data_ts = (message_data_ts_t *)data_ptr; 00674 } 00675 00676 /* Methods */ 00677 /** Get x value. 00678 * 00679 Fraction of MaxStepX. Use negative for backwards. [-1.0 to 1.0]. 00680 00681 * @return x value 00682 */ 00683 float 00684 HumanoidMotionInterface::WalkVelocityMessage::x() const 00685 { 00686 return data->x; 00687 } 00688 00689 /** Get maximum length of x value. 00690 * @return length of x value, can be length of the array or number of 00691 * maximum number of characters for a string 00692 */ 00693 size_t 00694 HumanoidMotionInterface::WalkVelocityMessage::maxlenof_x() const 00695 { 00696 return 1; 00697 } 00698 00699 /** Set x value. 00700 * 00701 Fraction of MaxStepX. Use negative for backwards. [-1.0 to 1.0]. 00702 00703 * @param new_x new x value 00704 */ 00705 void 00706 HumanoidMotionInterface::WalkVelocityMessage::set_x(const float new_x) 00707 { 00708 data->x = new_x; 00709 } 00710 00711 /** Get y value. 00712 * 00713 Fraction of MaxStepY. Use negative for right. [-1.0 to 1.0]. 00714 00715 * @return y value 00716 */ 00717 float 00718 HumanoidMotionInterface::WalkVelocityMessage::y() const 00719 { 00720 return data->y; 00721 } 00722 00723 /** Get maximum length of y value. 00724 * @return length of y value, can be length of the array or number of 00725 * maximum number of characters for a string 00726 */ 00727 size_t 00728 HumanoidMotionInterface::WalkVelocityMessage::maxlenof_y() const 00729 { 00730 return 1; 00731 } 00732 00733 /** Set y value. 00734 * 00735 Fraction of MaxStepY. Use negative for right. [-1.0 to 1.0]. 00736 00737 * @param new_y new y value 00738 */ 00739 void 00740 HumanoidMotionInterface::WalkVelocityMessage::set_y(const float new_y) 00741 { 00742 data->y = new_y; 00743 } 00744 00745 /** Get theta value. 00746 * 00747 Fraction of MaxStepTheta. Use negative for clockwise [-1.0 to 1.0]. 00748 00749 * @return theta value 00750 */ 00751 float 00752 HumanoidMotionInterface::WalkVelocityMessage::theta() const 00753 { 00754 return data->theta; 00755 } 00756 00757 /** Get maximum length of theta value. 00758 * @return length of theta value, can be length of the array or number of 00759 * maximum number of characters for a string 00760 */ 00761 size_t 00762 HumanoidMotionInterface::WalkVelocityMessage::maxlenof_theta() const 00763 { 00764 return 1; 00765 } 00766 00767 /** Set theta value. 00768 * 00769 Fraction of MaxStepTheta. Use negative for clockwise [-1.0 to 1.0]. 00770 00771 * @param new_theta new theta value 00772 */ 00773 void 00774 HumanoidMotionInterface::WalkVelocityMessage::set_theta(const float new_theta) 00775 { 00776 data->theta = new_theta; 00777 } 00778 00779 /** Get speed value. 00780 * 00781 Fraction of MaxStepFrequency [0.0 to 1.0]. 00782 00783 * @return speed value 00784 */ 00785 float 00786 HumanoidMotionInterface::WalkVelocityMessage::speed() const 00787 { 00788 return data->speed; 00789 } 00790 00791 /** Get maximum length of speed value. 00792 * @return length of speed value, can be length of the array or number of 00793 * maximum number of characters for a string 00794 */ 00795 size_t 00796 HumanoidMotionInterface::WalkVelocityMessage::maxlenof_speed() const 00797 { 00798 return 1; 00799 } 00800 00801 /** Set speed value. 00802 * 00803 Fraction of MaxStepFrequency [0.0 to 1.0]. 00804 00805 * @param new_speed new speed value 00806 */ 00807 void 00808 HumanoidMotionInterface::WalkVelocityMessage::set_speed(const float new_speed) 00809 { 00810 data->speed = new_speed; 00811 } 00812 00813 /** Clone this message. 00814 * Produces a message of the same type as this message and copies the 00815 * data to the new message. 00816 * @return clone of this message 00817 */ 00818 Message * 00819 HumanoidMotionInterface::WalkVelocityMessage::clone() const 00820 { 00821 return new HumanoidMotionInterface::WalkVelocityMessage(this); 00822 } 00823 /** @class HumanoidMotionInterface::TurnMessage <interfaces/HumanoidMotionInterface.h> 00824 * TurnMessage Fawkes BlackBoard Interface Message. 00825 * 00826 00827 */ 00828 00829 00830 /** Constructor with initial values. 00831 * @param ini_angle initial value for angle 00832 */ 00833 HumanoidMotionInterface::TurnMessage::TurnMessage(const float ini_angle) : Message("TurnMessage") 00834 { 00835 data_size = sizeof(TurnMessage_data_t); 00836 data_ptr = malloc(data_size); 00837 memset(data_ptr, 0, data_size); 00838 data = (TurnMessage_data_t *)data_ptr; 00839 data_ts = (message_data_ts_t *)data_ptr; 00840 data->angle = ini_angle; 00841 add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle); 00842 } 00843 /** Constructor */ 00844 HumanoidMotionInterface::TurnMessage::TurnMessage() : Message("TurnMessage") 00845 { 00846 data_size = sizeof(TurnMessage_data_t); 00847 data_ptr = malloc(data_size); 00848 memset(data_ptr, 0, data_size); 00849 data = (TurnMessage_data_t *)data_ptr; 00850 data_ts = (message_data_ts_t *)data_ptr; 00851 add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle); 00852 } 00853 00854 /** Destructor */ 00855 HumanoidMotionInterface::TurnMessage::~TurnMessage() 00856 { 00857 free(data_ptr); 00858 } 00859 00860 /** Copy constructor. 00861 * @param m message to copy from 00862 */ 00863 HumanoidMotionInterface::TurnMessage::TurnMessage(const TurnMessage *m) : Message("TurnMessage") 00864 { 00865 data_size = m->data_size; 00866 data_ptr = malloc(data_size); 00867 memcpy(data_ptr, m->data_ptr, data_size); 00868 data = (TurnMessage_data_t *)data_ptr; 00869 data_ts = (message_data_ts_t *)data_ptr; 00870 } 00871 00872 /* Methods */ 00873 /** Get angle value. 00874 * Angle in radians to turn. 00875 * @return angle value 00876 */ 00877 float 00878 HumanoidMotionInterface::TurnMessage::angle() const 00879 { 00880 return data->angle; 00881 } 00882 00883 /** Get maximum length of angle value. 00884 * @return length of angle value, can be length of the array or number of 00885 * maximum number of characters for a string 00886 */ 00887 size_t 00888 HumanoidMotionInterface::TurnMessage::maxlenof_angle() const 00889 { 00890 return 1; 00891 } 00892 00893 /** Set angle value. 00894 * Angle in radians to turn. 00895 * @param new_angle new angle value 00896 */ 00897 void 00898 HumanoidMotionInterface::TurnMessage::set_angle(const float new_angle) 00899 { 00900 data->angle = new_angle; 00901 } 00902 00903 /** Clone this message. 00904 * Produces a message of the same type as this message and copies the 00905 * data to the new message. 00906 * @return clone of this message 00907 */ 00908 Message * 00909 HumanoidMotionInterface::TurnMessage::clone() const 00910 { 00911 return new HumanoidMotionInterface::TurnMessage(this); 00912 } 00913 /** @class HumanoidMotionInterface::KickMessage <interfaces/HumanoidMotionInterface.h> 00914 * KickMessage Fawkes BlackBoard Interface Message. 00915 * 00916 00917 */ 00918 00919 00920 /** Constructor with initial values. 00921 * @param ini_leg initial value for leg 00922 * @param ini_strength initial value for strength 00923 */ 00924 HumanoidMotionInterface::KickMessage::KickMessage(const LegEnum ini_leg, const float ini_strength) : Message("KickMessage") 00925 { 00926 data_size = sizeof(KickMessage_data_t); 00927 data_ptr = malloc(data_size); 00928 memset(data_ptr, 0, data_size); 00929 data = (KickMessage_data_t *)data_ptr; 00930 data_ts = (message_data_ts_t *)data_ptr; 00931 data->leg = ini_leg; 00932 data->strength = ini_strength; 00933 add_fieldinfo(IFT_ENUM, "leg", 1, &data->leg, "LegEnum"); 00934 add_fieldinfo(IFT_FLOAT, "strength", 1, &data->strength); 00935 } 00936 /** Constructor */ 00937 HumanoidMotionInterface::KickMessage::KickMessage() : Message("KickMessage") 00938 { 00939 data_size = sizeof(KickMessage_data_t); 00940 data_ptr = malloc(data_size); 00941 memset(data_ptr, 0, data_size); 00942 data = (KickMessage_data_t *)data_ptr; 00943 data_ts = (message_data_ts_t *)data_ptr; 00944 add_fieldinfo(IFT_ENUM, "leg", 1, &data->leg, "LegEnum"); 00945 add_fieldinfo(IFT_FLOAT, "strength", 1, &data->strength); 00946 } 00947 00948 /** Destructor */ 00949 HumanoidMotionInterface::KickMessage::~KickMessage() 00950 { 00951 free(data_ptr); 00952 } 00953 00954 /** Copy constructor. 00955 * @param m message to copy from 00956 */ 00957 HumanoidMotionInterface::KickMessage::KickMessage(const KickMessage *m) : Message("KickMessage") 00958 { 00959 data_size = m->data_size; 00960 data_ptr = malloc(data_size); 00961 memcpy(data_ptr, m->data_ptr, data_size); 00962 data = (KickMessage_data_t *)data_ptr; 00963 data_ts = (message_data_ts_t *)data_ptr; 00964 } 00965 00966 /* Methods */ 00967 /** Get leg value. 00968 * Leg to kick with 00969 * @return leg value 00970 */ 00971 HumanoidMotionInterface::LegEnum 00972 HumanoidMotionInterface::KickMessage::leg() const 00973 { 00974 return (HumanoidMotionInterface::LegEnum)data->leg; 00975 } 00976 00977 /** Get maximum length of leg value. 00978 * @return length of leg value, can be length of the array or number of 00979 * maximum number of characters for a string 00980 */ 00981 size_t 00982 HumanoidMotionInterface::KickMessage::maxlenof_leg() const 00983 { 00984 return 1; 00985 } 00986 00987 /** Set leg value. 00988 * Leg to kick with 00989 * @param new_leg new leg value 00990 */ 00991 void 00992 HumanoidMotionInterface::KickMessage::set_leg(const LegEnum new_leg) 00993 { 00994 data->leg = new_leg; 00995 } 00996 00997 /** Get strength value. 00998 * Kick strength 00999 * @return strength value 01000 */ 01001 float 01002 HumanoidMotionInterface::KickMessage::strength() const 01003 { 01004 return data->strength; 01005 } 01006 01007 /** Get maximum length of strength value. 01008 * @return length of strength value, can be length of the array or number of 01009 * maximum number of characters for a string 01010 */ 01011 size_t 01012 HumanoidMotionInterface::KickMessage::maxlenof_strength() const 01013 { 01014 return 1; 01015 } 01016 01017 /** Set strength value. 01018 * Kick strength 01019 * @param new_strength new strength value 01020 */ 01021 void 01022 HumanoidMotionInterface::KickMessage::set_strength(const float new_strength) 01023 { 01024 data->strength = new_strength; 01025 } 01026 01027 /** Clone this message. 01028 * Produces a message of the same type as this message and copies the 01029 * data to the new message. 01030 * @return clone of this message 01031 */ 01032 Message * 01033 HumanoidMotionInterface::KickMessage::clone() const 01034 { 01035 return new HumanoidMotionInterface::KickMessage(this); 01036 } 01037 /** @class HumanoidMotionInterface::ParkMessage <interfaces/HumanoidMotionInterface.h> 01038 * ParkMessage Fawkes BlackBoard Interface Message. 01039 * 01040 01041 */ 01042 01043 01044 /** Constructor */ 01045 HumanoidMotionInterface::ParkMessage::ParkMessage() : Message("ParkMessage") 01046 { 01047 data_size = sizeof(ParkMessage_data_t); 01048 data_ptr = malloc(data_size); 01049 memset(data_ptr, 0, data_size); 01050 data = (ParkMessage_data_t *)data_ptr; 01051 data_ts = (message_data_ts_t *)data_ptr; 01052 } 01053 01054 /** Destructor */ 01055 HumanoidMotionInterface::ParkMessage::~ParkMessage() 01056 { 01057 free(data_ptr); 01058 } 01059 01060 /** Copy constructor. 01061 * @param m message to copy from 01062 */ 01063 HumanoidMotionInterface::ParkMessage::ParkMessage(const ParkMessage *m) : Message("ParkMessage") 01064 { 01065 data_size = m->data_size; 01066 data_ptr = malloc(data_size); 01067 memcpy(data_ptr, m->data_ptr, data_size); 01068 data = (ParkMessage_data_t *)data_ptr; 01069 data_ts = (message_data_ts_t *)data_ptr; 01070 } 01071 01072 /* Methods */ 01073 /** Clone this message. 01074 * Produces a message of the same type as this message and copies the 01075 * data to the new message. 01076 * @return clone of this message 01077 */ 01078 Message * 01079 HumanoidMotionInterface::ParkMessage::clone() const 01080 { 01081 return new HumanoidMotionInterface::ParkMessage(this); 01082 } 01083 /** @class HumanoidMotionInterface::GetUpMessage <interfaces/HumanoidMotionInterface.h> 01084 * GetUpMessage Fawkes BlackBoard Interface Message. 01085 * 01086 01087 */ 01088 01089 01090 /** Constructor */ 01091 HumanoidMotionInterface::GetUpMessage::GetUpMessage() : Message("GetUpMessage") 01092 { 01093 data_size = sizeof(GetUpMessage_data_t); 01094 data_ptr = malloc(data_size); 01095 memset(data_ptr, 0, data_size); 01096 data = (GetUpMessage_data_t *)data_ptr; 01097 data_ts = (message_data_ts_t *)data_ptr; 01098 } 01099 01100 /** Destructor */ 01101 HumanoidMotionInterface::GetUpMessage::~GetUpMessage() 01102 { 01103 free(data_ptr); 01104 } 01105 01106 /** Copy constructor. 01107 * @param m message to copy from 01108 */ 01109 HumanoidMotionInterface::GetUpMessage::GetUpMessage(const GetUpMessage *m) : Message("GetUpMessage") 01110 { 01111 data_size = m->data_size; 01112 data_ptr = malloc(data_size); 01113 memcpy(data_ptr, m->data_ptr, data_size); 01114 data = (GetUpMessage_data_t *)data_ptr; 01115 data_ts = (message_data_ts_t *)data_ptr; 01116 } 01117 01118 /* Methods */ 01119 /** Clone this message. 01120 * Produces a message of the same type as this message and copies the 01121 * data to the new message. 01122 * @return clone of this message 01123 */ 01124 Message * 01125 HumanoidMotionInterface::GetUpMessage::clone() const 01126 { 01127 return new HumanoidMotionInterface::GetUpMessage(this); 01128 } 01129 /** @class HumanoidMotionInterface::StandupMessage <interfaces/HumanoidMotionInterface.h> 01130 * StandupMessage Fawkes BlackBoard Interface Message. 01131 * 01132 01133 */ 01134 01135 01136 /** Constructor with initial values. 01137 * @param ini_from_pos initial value for from_pos 01138 */ 01139 HumanoidMotionInterface::StandupMessage::StandupMessage(const StandupEnum ini_from_pos) : Message("StandupMessage") 01140 { 01141 data_size = sizeof(StandupMessage_data_t); 01142 data_ptr = malloc(data_size); 01143 memset(data_ptr, 0, data_size); 01144 data = (StandupMessage_data_t *)data_ptr; 01145 data_ts = (message_data_ts_t *)data_ptr; 01146 data->from_pos = ini_from_pos; 01147 add_fieldinfo(IFT_ENUM, "from_pos", 1, &data->from_pos, "StandupEnum"); 01148 } 01149 /** Constructor */ 01150 HumanoidMotionInterface::StandupMessage::StandupMessage() : Message("StandupMessage") 01151 { 01152 data_size = sizeof(StandupMessage_data_t); 01153 data_ptr = malloc(data_size); 01154 memset(data_ptr, 0, data_size); 01155 data = (StandupMessage_data_t *)data_ptr; 01156 data_ts = (message_data_ts_t *)data_ptr; 01157 add_fieldinfo(IFT_ENUM, "from_pos", 1, &data->from_pos, "StandupEnum"); 01158 } 01159 01160 /** Destructor */ 01161 HumanoidMotionInterface::StandupMessage::~StandupMessage() 01162 { 01163 free(data_ptr); 01164 } 01165 01166 /** Copy constructor. 01167 * @param m message to copy from 01168 */ 01169 HumanoidMotionInterface::StandupMessage::StandupMessage(const StandupMessage *m) : Message("StandupMessage") 01170 { 01171 data_size = m->data_size; 01172 data_ptr = malloc(data_size); 01173 memcpy(data_ptr, m->data_ptr, data_size); 01174 data = (StandupMessage_data_t *)data_ptr; 01175 data_ts = (message_data_ts_t *)data_ptr; 01176 } 01177 01178 /* Methods */ 01179 /** Get from_pos value. 01180 * Position from where to standup. 01181 * @return from_pos value 01182 */ 01183 HumanoidMotionInterface::StandupEnum 01184 HumanoidMotionInterface::StandupMessage::from_pos() const 01185 { 01186 return (HumanoidMotionInterface::StandupEnum)data->from_pos; 01187 } 01188 01189 /** Get maximum length of from_pos value. 01190 * @return length of from_pos value, can be length of the array or number of 01191 * maximum number of characters for a string 01192 */ 01193 size_t 01194 HumanoidMotionInterface::StandupMessage::maxlenof_from_pos() const 01195 { 01196 return 1; 01197 } 01198 01199 /** Set from_pos value. 01200 * Position from where to standup. 01201 * @param new_from_pos new from_pos value 01202 */ 01203 void 01204 HumanoidMotionInterface::StandupMessage::set_from_pos(const StandupEnum new_from_pos) 01205 { 01206 data->from_pos = new_from_pos; 01207 } 01208 01209 /** Clone this message. 01210 * Produces a message of the same type as this message and copies the 01211 * data to the new message. 01212 * @return clone of this message 01213 */ 01214 Message * 01215 HumanoidMotionInterface::StandupMessage::clone() const 01216 { 01217 return new HumanoidMotionInterface::StandupMessage(this); 01218 } 01219 /** @class HumanoidMotionInterface::MoveHeadMessage <interfaces/HumanoidMotionInterface.h> 01220 * MoveHeadMessage Fawkes BlackBoard Interface Message. 01221 * 01222 01223 */ 01224 01225 01226 /** Constructor with initial values. 01227 * @param ini_yaw initial value for yaw 01228 * @param ini_pitch initial value for pitch 01229 * @param ini_speed initial value for speed 01230 */ 01231 HumanoidMotionInterface::MoveHeadMessage::MoveHeadMessage(const float ini_yaw, const float ini_pitch, const float ini_speed) : Message("MoveHeadMessage") 01232 { 01233 data_size = sizeof(MoveHeadMessage_data_t); 01234 data_ptr = malloc(data_size); 01235 memset(data_ptr, 0, data_size); 01236 data = (MoveHeadMessage_data_t *)data_ptr; 01237 data_ts = (message_data_ts_t *)data_ptr; 01238 data->yaw = ini_yaw; 01239 data->pitch = ini_pitch; 01240 data->speed = ini_speed; 01241 add_fieldinfo(IFT_FLOAT, "yaw", 1, &data->yaw); 01242 add_fieldinfo(IFT_FLOAT, "pitch", 1, &data->pitch); 01243 add_fieldinfo(IFT_FLOAT, "speed", 1, &data->speed); 01244 } 01245 /** Constructor */ 01246 HumanoidMotionInterface::MoveHeadMessage::MoveHeadMessage() : Message("MoveHeadMessage") 01247 { 01248 data_size = sizeof(MoveHeadMessage_data_t); 01249 data_ptr = malloc(data_size); 01250 memset(data_ptr, 0, data_size); 01251 data = (MoveHeadMessage_data_t *)data_ptr; 01252 data_ts = (message_data_ts_t *)data_ptr; 01253 add_fieldinfo(IFT_FLOAT, "yaw", 1, &data->yaw); 01254 add_fieldinfo(IFT_FLOAT, "pitch", 1, &data->pitch); 01255 add_fieldinfo(IFT_FLOAT, "speed", 1, &data->speed); 01256 } 01257 01258 /** Destructor */ 01259 HumanoidMotionInterface::MoveHeadMessage::~MoveHeadMessage() 01260 { 01261 free(data_ptr); 01262 } 01263 01264 /** Copy constructor. 01265 * @param m message to copy from 01266 */ 01267 HumanoidMotionInterface::MoveHeadMessage::MoveHeadMessage(const MoveHeadMessage *m) : Message("MoveHeadMessage") 01268 { 01269 data_size = m->data_size; 01270 data_ptr = malloc(data_size); 01271 memcpy(data_ptr, m->data_ptr, data_size); 01272 data = (MoveHeadMessage_data_t *)data_ptr; 01273 data_ts = (message_data_ts_t *)data_ptr; 01274 } 01275 01276 /* Methods */ 01277 /** Get yaw value. 01278 * Desired yaw (horizontal orientation). 01279 * @return yaw value 01280 */ 01281 float 01282 HumanoidMotionInterface::MoveHeadMessage::yaw() const 01283 { 01284 return data->yaw; 01285 } 01286 01287 /** Get maximum length of yaw value. 01288 * @return length of yaw value, can be length of the array or number of 01289 * maximum number of characters for a string 01290 */ 01291 size_t 01292 HumanoidMotionInterface::MoveHeadMessage::maxlenof_yaw() const 01293 { 01294 return 1; 01295 } 01296 01297 /** Set yaw value. 01298 * Desired yaw (horizontal orientation). 01299 * @param new_yaw new yaw value 01300 */ 01301 void 01302 HumanoidMotionInterface::MoveHeadMessage::set_yaw(const float new_yaw) 01303 { 01304 data->yaw = new_yaw; 01305 } 01306 01307 /** Get pitch value. 01308 * Desired pitch (vertical orientation). 01309 * @return pitch value 01310 */ 01311 float 01312 HumanoidMotionInterface::MoveHeadMessage::pitch() const 01313 { 01314 return data->pitch; 01315 } 01316 01317 /** Get maximum length of pitch value. 01318 * @return length of pitch value, can be length of the array or number of 01319 * maximum number of characters for a string 01320 */ 01321 size_t 01322 HumanoidMotionInterface::MoveHeadMessage::maxlenof_pitch() const 01323 { 01324 return 1; 01325 } 01326 01327 /** Set pitch value. 01328 * Desired pitch (vertical orientation). 01329 * @param new_pitch new pitch value 01330 */ 01331 void 01332 HumanoidMotionInterface::MoveHeadMessage::set_pitch(const float new_pitch) 01333 { 01334 data->pitch = new_pitch; 01335 } 01336 01337 /** Get speed value. 01338 * Maximum speed in [0.0..1.0]. 01339 * @return speed value 01340 */ 01341 float 01342 HumanoidMotionInterface::MoveHeadMessage::speed() const 01343 { 01344 return data->speed; 01345 } 01346 01347 /** Get maximum length of speed value. 01348 * @return length of speed value, can be length of the array or number of 01349 * maximum number of characters for a string 01350 */ 01351 size_t 01352 HumanoidMotionInterface::MoveHeadMessage::maxlenof_speed() const 01353 { 01354 return 1; 01355 } 01356 01357 /** Set speed value. 01358 * Maximum speed in [0.0..1.0]. 01359 * @param new_speed new speed value 01360 */ 01361 void 01362 HumanoidMotionInterface::MoveHeadMessage::set_speed(const float new_speed) 01363 { 01364 data->speed = new_speed; 01365 } 01366 01367 /** Clone this message. 01368 * Produces a message of the same type as this message and copies the 01369 * data to the new message. 01370 * @return clone of this message 01371 */ 01372 Message * 01373 HumanoidMotionInterface::MoveHeadMessage::clone() const 01374 { 01375 return new HumanoidMotionInterface::MoveHeadMessage(this); 01376 } 01377 /** Check if message is valid and can be enqueued. 01378 * @param message Message to check 01379 * @return true if the message is valid, false otherwise. 01380 */ 01381 bool 01382 HumanoidMotionInterface::message_valid(const Message *message) const 01383 { 01384 const StopMessage *m0 = dynamic_cast<const StopMessage *>(message); 01385 if ( m0 != NULL ) { 01386 return true; 01387 } 01388 const WalkStraightMessage *m1 = dynamic_cast<const WalkStraightMessage *>(message); 01389 if ( m1 != NULL ) { 01390 return true; 01391 } 01392 const WalkSidewaysMessage *m2 = dynamic_cast<const WalkSidewaysMessage *>(message); 01393 if ( m2 != NULL ) { 01394 return true; 01395 } 01396 const WalkArcMessage *m3 = dynamic_cast<const WalkArcMessage *>(message); 01397 if ( m3 != NULL ) { 01398 return true; 01399 } 01400 const WalkVelocityMessage *m4 = dynamic_cast<const WalkVelocityMessage *>(message); 01401 if ( m4 != NULL ) { 01402 return true; 01403 } 01404 const TurnMessage *m5 = dynamic_cast<const TurnMessage *>(message); 01405 if ( m5 != NULL ) { 01406 return true; 01407 } 01408 const KickMessage *m6 = dynamic_cast<const KickMessage *>(message); 01409 if ( m6 != NULL ) { 01410 return true; 01411 } 01412 const ParkMessage *m7 = dynamic_cast<const ParkMessage *>(message); 01413 if ( m7 != NULL ) { 01414 return true; 01415 } 01416 const GetUpMessage *m8 = dynamic_cast<const GetUpMessage *>(message); 01417 if ( m8 != NULL ) { 01418 return true; 01419 } 01420 const StandupMessage *m9 = dynamic_cast<const StandupMessage *>(message); 01421 if ( m9 != NULL ) { 01422 return true; 01423 } 01424 const MoveHeadMessage *m10 = dynamic_cast<const MoveHeadMessage *>(message); 01425 if ( m10 != NULL ) { 01426 return true; 01427 } 01428 return false; 01429 } 01430 01431 /// @cond INTERNALS 01432 EXPORT_INTERFACE(HumanoidMotionInterface) 01433 /// @endcond 01434 01435 01436 } // end namespace fawkes