NavigatorInterface.cpp

00001
00002 /***************************************************************************
00003  *  NavigatorInterface.cpp - Fawkes BlackBoard Interface - NavigatorInterface
00004  *
00005  *  Templated created:   Thu Oct 12 10:49:19 2006
00006  *  Copyright  2007-2009  Martin Liebenberg, Daniel Beck, 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/NavigatorInterface.h>
00025
00026 #include <core/exceptions/software.h>
00027
00028 #include <cstring>
00029 #include <cstdlib>
00030
00031 namespace fawkes {
00032 
00033 /** @class NavigatorInterface <interfaces/NavigatorInterface.h>
00034  * NavigatorInterface Fawkes BlackBoard Interface.
00035  * 
00036       The navigator interface is used by the navigator to export information about
00037       the current status of the navigator and to define all messages by which the navigator
00038       can be instructed.
00039 
00040       There are three coordinate systems, the robot system which is a right-handed cartesian
00041       coordinate system with the robot in its origin, X axis pointing forward, Y pointing to
00042       the left and Z pointing upwards. The second coordinate system is the so-called
00043       navigator system. It is a coordinate system similar to the robot system, but the
00044       origin is defined on the initialization of the navigator. The last system is the
00045       odometry system. It is again a similar system, but the origin is reset from time
00046       to time and the robot's position in this system gives the odometry deltas.
00047     
00048  * @ingroup FawkesInterfaces
00049  */
00050
00051 
00052 /** ERROR_NONE constant */
00053 const unsigned int NavigatorInterface::ERROR_NONE = 0;
00054 /** ERROR_MOTOR constant */
00055 const unsigned int NavigatorInterface::ERROR_MOTOR = 1;
00056 /** ERROR_OBSTRUCTION constant */
00057 const unsigned int NavigatorInterface::ERROR_OBSTRUCTION = 2;
00058 /** ERROR_UNKNOWN_PLACE constant */
00059 const unsigned int NavigatorInterface::ERROR_UNKNOWN_PLACE = 4;
00060 /** FLAG_NONE constant */
00061 const unsigned int NavigatorInterface::FLAG_NONE = 0;
00062 /** FLAG_CART_GOTO constant */
00063 const unsigned int NavigatorInterface::FLAG_CART_GOTO = 1;
00064 /** FLAG_POLAR_GOTO constant */
00065 const unsigned int NavigatorInterface::FLAG_POLAR_GOTO = 2;
00066 /** FLAG_PLACE_GOTO constant */
00067 const unsigned int NavigatorInterface::FLAG_PLACE_GOTO = 4;
00068 /** FLAG_UPDATES_DEST_DIST constant */
00069 const unsigned int NavigatorInterface::FLAG_UPDATES_DEST_DIST = 8;
00070 /** FLAG_SECURITY_DISTANCE constant */
00071 const unsigned int NavigatorInterface::FLAG_SECURITY_DISTANCE = 16;
00072 /** FLAG_ESCAPING constant */
00073 const unsigned int NavigatorInterface::FLAG_ESCAPING = 32;
00074 
00075 /** Constructor */
00076 NavigatorInterface::NavigatorInterface() : Interface()
00077 {
00078   data_size = sizeof(NavigatorInterface_data_t);
00079   data_ptr  = malloc(data_size);
00080   data      = (NavigatorInterface_data_t *)data_ptr;
00081   memset(data_ptr, 0, data_size);
00082   add_fieldinfo(IFT_UINT, "flags", 1, &data->flags);
00083   add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
00084   add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
00085   add_fieldinfo(IFT_FLOAT, "dest_x", 1, &data->dest_x);
00086   add_fieldinfo(IFT_FLOAT, "dest_y", 1, &data->dest_y);
00087   add_fieldinfo(IFT_FLOAT, "dest_ori", 1, &data->dest_ori);
00088   add_fieldinfo(IFT_FLOAT, "dest_dist", 1, &data->dest_dist);
00089   add_fieldinfo(IFT_UINT, "msgid", 1, &data->msgid);
00090   add_fieldinfo(IFT_BOOL, "final", 1, &data->final);
00091   add_fieldinfo(IFT_UINT, "error_code", 1, &data->error_code);
00092   add_fieldinfo(IFT_FLOAT, "max_velocity", 1, &data->max_velocity);
00093   add_fieldinfo(IFT_FLOAT, "security_distance", 1, &data->security_distance);
00094   add_fieldinfo(IFT_BOOL, "escaping_enabled", 1, &data->escaping_enabled);
00095   add_messageinfo("StopMessage");
00096   add_messageinfo("TurnMessage");
00097   add_messageinfo("CartesianGotoMessage");
00098   add_messageinfo("PolarGotoMessage");
00099   add_messageinfo("PlaceGotoMessage");
00100   add_messageinfo("ObstacleMessage");
00101   add_messageinfo("ResetOdometryMessage");
00102   add_messageinfo("SetMaxVelocityMessage");
00103   add_messageinfo("SetEscapingMessage");
00104   add_messageinfo("SetSecurityDistanceMessage");
00105   unsigned char tmp_hash[] = {0x3b, 0x13, 0xa, 0x72, 0xc3, 0x94, 0x6d, 0xd5, 0x70, 0x21, 0x18, 0x2d, 0xcc, 0x52, 0x91, 0xa1};
00106   set_hash(tmp_hash);
00107 }
00108 
00109 /** Destructor */
00110 NavigatorInterface::~NavigatorInterface()
00111 {
00112   free(data_ptr);
00113 }
00114 /* Methods */
00115 /** Get flags value.
00116  * Bit-wise combination of
00117     FLAG_* constants denoting navigator component features.
00118  * @return flags value
00119  */
00120 unsigned int
00121 NavigatorInterface::flags() const
00122 {
00123   return data->flags;
00124 }
00125 
00126 /** Get maximum length of flags value.
00127  * @return length of flags value, can be length of the array or number of 
00128  * maximum number of characters for a string
00129  */
00130 size_t
00131 NavigatorInterface::maxlenof_flags() const
00132 {
00133   return 1;
00134 }
00135 
00136 /** Set flags value.
00137  * Bit-wise combination of
00138     FLAG_* constants denoting navigator component features.
00139  * @param new_flags new flags value
00140  */
00141 void
00142 NavigatorInterface::set_flags(const unsigned int new_flags)
00143 {
00144   data->flags = new_flags;
00145 }
00146 
00147 /** Get x value.
00148  * Current X-coordinate in the navigator coordinate system.
00149  * @return x value
00150  */
00151 float
00152 NavigatorInterface::x() const
00153 {
00154   return data->x;
00155 }
00156 
00157 /** Get maximum length of x value.
00158  * @return length of x value, can be length of the array or number of 
00159  * maximum number of characters for a string
00160  */
00161 size_t
00162 NavigatorInterface::maxlenof_x() const
00163 {
00164   return 1;
00165 }
00166 
00167 /** Set x value.
00168  * Current X-coordinate in the navigator coordinate system.
00169  * @param new_x new x value
00170  */
00171 void
00172 NavigatorInterface::set_x(const float new_x)
00173 {
00174   data->x = new_x;
00175 }
00176 
00177 /** Get y value.
00178  * Current Y-coordinate in the navigator coordinate system.
00179  * @return y value
00180  */
00181 float
00182 NavigatorInterface::y() const
00183 {
00184   return data->y;
00185 }
00186 
00187 /** Get maximum length of y value.
00188  * @return length of y value, can be length of the array or number of 
00189  * maximum number of characters for a string
00190  */
00191 size_t
00192 NavigatorInterface::maxlenof_y() const
00193 {
00194   return 1;
00195 }
00196 
00197 /** Set y value.
00198  * Current Y-coordinate in the navigator coordinate system.
00199  * @param new_y new y value
00200  */
00201 void
00202 NavigatorInterface::set_y(const float new_y)
00203 {
00204   data->y = new_y;
00205 }
00206 
00207 /** Get dest_x value.
00208  * X-coordinate of the current destination, or 0.0 if no target has been set.
00209  * @return dest_x value
00210  */
00211 float
00212 NavigatorInterface::dest_x() const
00213 {
00214   return data->dest_x;
00215 }
00216 
00217 /** Get maximum length of dest_x value.
00218  * @return length of dest_x value, can be length of the array or number of 
00219  * maximum number of characters for a string
00220  */
00221 size_t
00222 NavigatorInterface::maxlenof_dest_x() const
00223 {
00224   return 1;
00225 }
00226 
00227 /** Set dest_x value.
00228  * X-coordinate of the current destination, or 0.0 if no target has been set.
00229  * @param new_dest_x new dest_x value
00230  */
00231 void
00232 NavigatorInterface::set_dest_x(const float new_dest_x)
00233 {
00234   data->dest_x = new_dest_x;
00235 }
00236 
00237 /** Get dest_y value.
00238  * Y-coordinate of the current destination, or 0.0 if no target has been set.
00239  * @return dest_y value
00240  */
00241 float
00242 NavigatorInterface::dest_y() const
00243 {
00244   return data->dest_y;
00245 }
00246 
00247 /** Get maximum length of dest_y value.
00248  * @return length of dest_y value, can be length of the array or number of 
00249  * maximum number of characters for a string
00250  */
00251 size_t
00252 NavigatorInterface::maxlenof_dest_y() const
00253 {
00254   return 1;
00255 }
00256 
00257 /** Set dest_y value.
00258  * Y-coordinate of the current destination, or 0.0 if no target has been set.
00259  * @param new_dest_y new dest_y value
00260  */
00261 void
00262 NavigatorInterface::set_dest_y(const float new_dest_y)
00263 {
00264   data->dest_y = new_dest_y;
00265 }
00266 
00267 /** Get dest_ori value.
00268  * Orientation of the current destination, or 0.0 if no target has been set.
00269  * @return dest_ori value
00270  */
00271 float
00272 NavigatorInterface::dest_ori() const
00273 {
00274   return data->dest_ori;
00275 }
00276 
00277 /** Get maximum length of dest_ori value.
00278  * @return length of dest_ori value, can be length of the array or number of 
00279  * maximum number of characters for a string
00280  */
00281 size_t
00282 NavigatorInterface::maxlenof_dest_ori() const
00283 {
00284   return 1;
00285 }
00286 
00287 /** Set dest_ori value.
00288  * Orientation of the current destination, or 0.0 if no target has been set.
00289  * @param new_dest_ori new dest_ori value
00290  */
00291 void
00292 NavigatorInterface::set_dest_ori(const float new_dest_ori)
00293 {
00294   data->dest_ori = new_dest_ori;
00295 }
00296 
00297 /** Get dest_dist value.
00298  * Distance to destination in m.
00299  * @return dest_dist value
00300  */
00301 float
00302 NavigatorInterface::dest_dist() const
00303 {
00304   return data->dest_dist;
00305 }
00306 
00307 /** Get maximum length of dest_dist value.
00308  * @return length of dest_dist value, can be length of the array or number of 
00309  * maximum number of characters for a string
00310  */
00311 size_t
00312 NavigatorInterface::maxlenof_dest_dist() const
00313 {
00314   return 1;
00315 }
00316 
00317 /** Set dest_dist value.
00318  * Distance to destination in m.
00319  * @param new_dest_dist new dest_dist value
00320  */
00321 void
00322 NavigatorInterface::set_dest_dist(const float new_dest_dist)
00323 {
00324   data->dest_dist = new_dest_dist;
00325 }
00326 
00327 /** Get msgid value.
00328  * The ID of the message that is currently being
00329       processed, or 0 if no message is being processed.
00330  * @return msgid value
00331  */
00332 unsigned int
00333 NavigatorInterface::msgid() const
00334 {
00335   return data->msgid;
00336 }
00337 
00338 /** Get maximum length of msgid value.
00339  * @return length of msgid value, can be length of the array or number of 
00340  * maximum number of characters for a string
00341  */
00342 size_t
00343 NavigatorInterface::maxlenof_msgid() const
00344 {
00345   return 1;
00346 }
00347 
00348 /** Set msgid value.
00349  * The ID of the message that is currently being
00350       processed, or 0 if no message is being processed.
00351  * @param new_msgid new msgid value
00352  */
00353 void
00354 NavigatorInterface::set_msgid(const unsigned int new_msgid)
00355 {
00356   data->msgid = new_msgid;
00357 }
00358 
00359 /** Get final value.
00360  * True, if the last goto command has been finished,
00361       false if it is still running
00362  * @return final value
00363  */
00364 bool
00365 NavigatorInterface::is_final() const
00366 {
00367   return data->final;
00368 }
00369 
00370 /** Get maximum length of final value.
00371  * @return length of final value, can be length of the array or number of 
00372  * maximum number of characters for a string
00373  */
00374 size_t
00375 NavigatorInterface::maxlenof_final() const
00376 {
00377   return 1;
00378 }
00379 
00380 /** Set final value.
00381  * True, if the last goto command has been finished,
00382       false if it is still running
00383  * @param new_final new final value
00384  */
00385 void
00386 NavigatorInterface::set_final(const bool new_final)
00387 {
00388   data->final = new_final;
00389 }
00390 
00391 /** Get error_code value.
00392  * Failure code set if
00393     final is true. 0 if no error occured, an error code from ERROR_*
00394     constants otherwise (or a bit-wise combination).
00395  * @return error_code value
00396  */
00397 unsigned int
00398 NavigatorInterface::error_code() const
00399 {
00400   return data->error_code;
00401 }
00402 
00403 /** Get maximum length of error_code value.
00404  * @return length of error_code value, can be length of the array or number of 
00405  * maximum number of characters for a string
00406  */
00407 size_t
00408 NavigatorInterface::maxlenof_error_code() const
00409 {
00410   return 1;
00411 }
00412 
00413 /** Set error_code value.
00414  * Failure code set if
00415     final is true. 0 if no error occured, an error code from ERROR_*
00416     constants otherwise (or a bit-wise combination).
00417  * @param new_error_code new error_code value
00418  */
00419 void
00420 NavigatorInterface::set_error_code(const unsigned int new_error_code)
00421 {
00422   data->error_code = new_error_code;
00423 }
00424 
00425 /** Get max_velocity value.
00426  * Maximum velocity
00427  * @return max_velocity value
00428  */
00429 float
00430 NavigatorInterface::max_velocity() const
00431 {
00432   return data->max_velocity;
00433 }
00434 
00435 /** Get maximum length of max_velocity value.
00436  * @return length of max_velocity value, can be length of the array or number of 
00437  * maximum number of characters for a string
00438  */
00439 size_t
00440 NavigatorInterface::maxlenof_max_velocity() const
00441 {
00442   return 1;
00443 }
00444 
00445 /** Set max_velocity value.
00446  * Maximum velocity
00447  * @param new_max_velocity new max_velocity value
00448  */
00449 void
00450 NavigatorInterface::set_max_velocity(const float new_max_velocity)
00451 {
00452   data->max_velocity = new_max_velocity;
00453 }
00454 
00455 /** Get security_distance value.
00456  * Security distance to
00457     keep to obstacles
00458  * @return security_distance value
00459  */
00460 float
00461 NavigatorInterface::security_distance() const
00462 {
00463   return data->security_distance;
00464 }
00465 
00466 /** Get maximum length of security_distance value.
00467  * @return length of security_distance value, can be length of the array or number of 
00468  * maximum number of characters for a string
00469  */
00470 size_t
00471 NavigatorInterface::maxlenof_security_distance() const
00472 {
00473   return 1;
00474 }
00475 
00476 /** Set security_distance value.
00477  * Security distance to
00478     keep to obstacles
00479  * @param new_security_distance new security_distance value
00480  */
00481 void
00482 NavigatorInterface::set_security_distance(const float new_security_distance)
00483 {
00484   data->security_distance = new_security_distance;
00485 }
00486 
00487 /** Get escaping_enabled value.
00488  * This is used for
00489         navigation components with integrated collision avoidance, to
00490         check whether the navigator should stop when an obstacle
00491         obstructs the path, or if it should escape.
00492  * @return escaping_enabled value
00493  */
00494 bool
00495 NavigatorInterface::is_escaping_enabled() const
00496 {
00497   return data->escaping_enabled;
00498 }
00499 
00500 /** Get maximum length of escaping_enabled value.
00501  * @return length of escaping_enabled value, can be length of the array or number of 
00502  * maximum number of characters for a string
00503  */
00504 size_t
00505 NavigatorInterface::maxlenof_escaping_enabled() const
00506 {
00507   return 1;
00508 }
00509 
00510 /** Set escaping_enabled value.
00511  * This is used for
00512         navigation components with integrated collision avoidance, to
00513         check whether the navigator should stop when an obstacle
00514         obstructs the path, or if it should escape.
00515  * @param new_escaping_enabled new escaping_enabled value
00516  */
00517 void
00518 NavigatorInterface::set_escaping_enabled(const bool new_escaping_enabled)
00519 {
00520   data->escaping_enabled = new_escaping_enabled;
00521 }
00522
00523 /* =========== message create =========== */
00524 Message *
00525 NavigatorInterface::create_message(const char *type) const
00526 {
00527   if ( strncmp("StopMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00528     return new StopMessage();
00529   } else if ( strncmp("TurnMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00530     return new TurnMessage();
00531   } else if ( strncmp("CartesianGotoMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00532     return new CartesianGotoMessage();
00533   } else if ( strncmp("PolarGotoMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00534     return new PolarGotoMessage();
00535   } else if ( strncmp("PlaceGotoMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00536     return new PlaceGotoMessage();
00537   } else if ( strncmp("ObstacleMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00538     return new ObstacleMessage();
00539   } else if ( strncmp("ResetOdometryMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00540     return new ResetOdometryMessage();
00541   } else if ( strncmp("SetMaxVelocityMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00542     return new SetMaxVelocityMessage();
00543   } else if ( strncmp("SetEscapingMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00544     return new SetEscapingMessage();
00545   } else if ( strncmp("SetSecurityDistanceMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00546     return new SetSecurityDistanceMessage();
00547   } else {
00548     throw UnknownTypeException("The given type '%s' does not match any known "
00549                                "message type for this interface type.", type);
00550   }
00551 }
00552
00553 
00554 /** Copy values from other interface.
00555  * @param other other interface to copy values from
00556  */
00557 void
00558 NavigatorInterface::copy_values(const Interface *other)
00559 {
00560   const NavigatorInterface *oi = dynamic_cast<const NavigatorInterface *>(other);
00561   if (oi == NULL) {
00562     throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
00563                                 type(), other->type());
00564   }
00565   memcpy(data, oi->data, sizeof(NavigatorInterface_data_t));
00566 }
00567
00568 /* =========== messages =========== */
00569 /** @class NavigatorInterface::StopMessage <interfaces/NavigatorInterface.h>
00570  * StopMessage Fawkes BlackBoard Interface Message.
00571  * 
00572     
00573  */
00574
00575 
00576 /** Constructor */
00577 NavigatorInterface::StopMessage::StopMessage() : Message("StopMessage")
00578 {
00579   data_size = 0;
00580   data_ptr  = NULL;
00581 }
00582 
00583 /** Destructor */
00584 NavigatorInterface::StopMessage::~StopMessage()
00585 {
00586 }
00587 
00588 /** Copy constructor.
00589  * @param m message to copy from
00590  */
00591 NavigatorInterface::StopMessage::StopMessage(const StopMessage *m) : Message("StopMessage")
00592 {
00593   data_size = 0;
00594   data_ptr  = NULL;
00595 }
00596
00597 /* Methods */
00598 /** Clone this message.
00599  * Produces a message of the same type as this message and copies the
00600  * data to the new message.
00601  * @return clone of this message
00602  */
00603 Message *
00604 NavigatorInterface::StopMessage::clone() const
00605 {
00606   return new NavigatorInterface::StopMessage(this);
00607 }
00608 /** @class NavigatorInterface::TurnMessage <interfaces/NavigatorInterface.h>
00609  * TurnMessage Fawkes BlackBoard Interface Message.
00610  * 
00611     
00612  */
00613
00614 
00615 /** Constructor with initial values.
00616  * @param ini_angle initial value for angle
00617  * @param ini_velocity initial value for velocity
00618  */
00619 NavigatorInterface::TurnMessage::TurnMessage(const float ini_angle, const float ini_velocity) : Message("TurnMessage")
00620 {
00621   data_size = sizeof(TurnMessage_data_t);
00622   data_ptr  = malloc(data_size);
00623   memset(data_ptr, 0, data_size);
00624   data      = (TurnMessage_data_t *)data_ptr;
00625   data->angle = ini_angle;
00626   data->velocity = ini_velocity;
00627   add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
00628   add_fieldinfo(IFT_FLOAT, "velocity", 1, &data->velocity);
00629 }
00630 /** Constructor */
00631 NavigatorInterface::TurnMessage::TurnMessage() : Message("TurnMessage")
00632 {
00633   data_size = sizeof(TurnMessage_data_t);
00634   data_ptr  = malloc(data_size);
00635   memset(data_ptr, 0, data_size);
00636   data      = (TurnMessage_data_t *)data_ptr;
00637   add_fieldinfo(IFT_FLOAT, "angle", 1, &data->angle);
00638   add_fieldinfo(IFT_FLOAT, "velocity", 1, &data->velocity);
00639 }
00640 
00641 /** Destructor */
00642 NavigatorInterface::TurnMessage::~TurnMessage()
00643 {
00644   free(data_ptr);
00645 }
00646 
00647 /** Copy constructor.
00648  * @param m message to copy from
00649  */
00650 NavigatorInterface::TurnMessage::TurnMessage(const TurnMessage *m) : Message("TurnMessage")
00651 {
00652   data_size = m->data_size;
00653   data_ptr  = malloc(data_size);
00654   memcpy(data_ptr, m->data_ptr, data_size);
00655   data      = (TurnMessage_data_t *)data_ptr;
00656 }
00657
00658 /* Methods */
00659 /** Get angle value.
00660  * Angle of the turn.
00661  * @return angle value
00662  */
00663 float
00664 NavigatorInterface::TurnMessage::angle() const
00665 {
00666   return data->angle;
00667 }
00668 
00669 /** Get maximum length of angle value.
00670  * @return length of angle value, can be length of the array or number of 
00671  * maximum number of characters for a string
00672  */
00673 size_t
00674 NavigatorInterface::TurnMessage::maxlenof_angle() const
00675 {
00676   return 1;
00677 }
00678 
00679 /** Set angle value.
00680  * Angle of the turn.
00681  * @param new_angle new angle value
00682  */
00683 void
00684 NavigatorInterface::TurnMessage::set_angle(const float new_angle)
00685 {
00686   data->angle = new_angle;
00687 }
00688 
00689 /** Get velocity value.
00690  * The desired turning velocity in rad/s,
00691       set to zero to use default value.
00692  * @return velocity value
00693  */
00694 float
00695 NavigatorInterface::TurnMessage::velocity() const
00696 {
00697   return data->velocity;
00698 }
00699 
00700 /** Get maximum length of velocity value.
00701  * @return length of velocity value, can be length of the array or number of 
00702  * maximum number of characters for a string
00703  */
00704 size_t
00705 NavigatorInterface::TurnMessage::maxlenof_velocity() const
00706 {
00707   return 1;
00708 }
00709 
00710 /** Set velocity value.
00711  * The desired turning velocity in rad/s,
00712       set to zero to use default value.
00713  * @param new_velocity new velocity value
00714  */
00715 void
00716 NavigatorInterface::TurnMessage::set_velocity(const float new_velocity)
00717 {
00718   data->velocity = new_velocity;
00719 }
00720 
00721 /** Clone this message.
00722  * Produces a message of the same type as this message and copies the
00723  * data to the new message.
00724  * @return clone of this message
00725  */
00726 Message *
00727 NavigatorInterface::TurnMessage::clone() const
00728 {
00729   return new NavigatorInterface::TurnMessage(this);
00730 }
00731 /** @class NavigatorInterface::CartesianGotoMessage <interfaces/NavigatorInterface.h>
00732  * CartesianGotoMessage Fawkes BlackBoard Interface Message.
00733  * 
00734     
00735  */
00736
00737 
00738 /** Constructor with initial values.
00739  * @param ini_x initial value for x
00740  * @param ini_y initial value for y
00741  * @param ini_orientation initial value for orientation
00742  */
00743 NavigatorInterface::CartesianGotoMessage::CartesianGotoMessage(const float ini_x, const float ini_y, const float ini_orientation) : Message("CartesianGotoMessage")
00744 {
00745   data_size = sizeof(CartesianGotoMessage_data_t);
00746   data_ptr  = malloc(data_size);
00747   memset(data_ptr, 0, data_size);
00748   data      = (CartesianGotoMessage_data_t *)data_ptr;
00749   data->x = ini_x;
00750   data->y = ini_y;
00751   data->orientation = ini_orientation;
00752   add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
00753   add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
00754   add_fieldinfo(IFT_FLOAT, "orientation", 1, &data->orientation);
00755 }
00756 /** Constructor */
00757 NavigatorInterface::CartesianGotoMessage::CartesianGotoMessage() : Message("CartesianGotoMessage")
00758 {
00759   data_size = sizeof(CartesianGotoMessage_data_t);
00760   data_ptr  = malloc(data_size);
00761   memset(data_ptr, 0, data_size);
00762   data      = (CartesianGotoMessage_data_t *)data_ptr;
00763   add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
00764   add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
00765   add_fieldinfo(IFT_FLOAT, "orientation", 1, &data->orientation);
00766 }
00767 
00768 /** Destructor */
00769 NavigatorInterface::CartesianGotoMessage::~CartesianGotoMessage()
00770 {
00771   free(data_ptr);
00772 }
00773 
00774 /** Copy constructor.
00775  * @param m message to copy from
00776  */
00777 NavigatorInterface::CartesianGotoMessage::CartesianGotoMessage(const CartesianGotoMessage *m) : Message("CartesianGotoMessage")
00778 {
00779   data_size = m->data_size;
00780   data_ptr  = malloc(data_size);
00781   memcpy(data_ptr, m->data_ptr, data_size);
00782   data      = (CartesianGotoMessage_data_t *)data_ptr;
00783 }
00784
00785 /* Methods */
00786 /** Get x value.
00787  * X-coordinate of the target, in the robot's coordinate system.
00788  * @return x value
00789  */
00790 float
00791 NavigatorInterface::CartesianGotoMessage::x() const
00792 {
00793   return data->x;
00794 }
00795 
00796 /** Get maximum length of x value.
00797  * @return length of x value, can be length of the array or number of 
00798  * maximum number of characters for a string
00799  */
00800 size_t
00801 NavigatorInterface::CartesianGotoMessage::maxlenof_x() const
00802 {
00803   return 1;
00804 }
00805 
00806 /** Set x value.
00807  * X-coordinate of the target, in the robot's coordinate system.
00808  * @param new_x new x value
00809  */
00810 void
00811 NavigatorInterface::CartesianGotoMessage::set_x(const float new_x)
00812 {
00813   data->x = new_x;
00814 }
00815 
00816 /** Get y value.
00817  * Y-coordinate of the target, in the robot's coordinate system.
00818  * @return y value
00819  */
00820 float
00821 NavigatorInterface::CartesianGotoMessage::y() const
00822 {
00823   return data->y;
00824 }
00825 
00826 /** Get maximum length of y value.
00827  * @return length of y value, can be length of the array or number of 
00828  * maximum number of characters for a string
00829  */
00830 size_t
00831 NavigatorInterface::CartesianGotoMessage::maxlenof_y() const
00832 {
00833   return 1;
00834 }
00835 
00836 /** Set y value.
00837  * Y-coordinate of the target, in the robot's coordinate system.
00838  * @param new_y new y value
00839  */
00840 void
00841 NavigatorInterface::CartesianGotoMessage::set_y(const float new_y)
00842 {
00843   data->y = new_y;
00844 }
00845 
00846 /** Get orientation value.
00847  * The orientation of the robot at the target.
00848  * @return orientation value
00849  */
00850 float
00851 NavigatorInterface::CartesianGotoMessage::orientation() const
00852 {
00853   return data->orientation;
00854 }
00855 
00856 /** Get maximum length of orientation value.
00857  * @return length of orientation value, can be length of the array or number of 
00858  * maximum number of characters for a string
00859  */
00860 size_t
00861 NavigatorInterface::CartesianGotoMessage::maxlenof_orientation() const
00862 {
00863   return 1;
00864 }
00865 
00866 /** Set orientation value.
00867  * The orientation of the robot at the target.
00868  * @param new_orientation new orientation value
00869  */
00870 void
00871 NavigatorInterface::CartesianGotoMessage::set_orientation(const float new_orientation)
00872 {
00873   data->orientation = new_orientation;
00874 }
00875 
00876 /** Clone this message.
00877  * Produces a message of the same type as this message and copies the
00878  * data to the new message.
00879  * @return clone of this message
00880  */
00881 Message *
00882 NavigatorInterface::CartesianGotoMessage::clone() const
00883 {
00884   return new NavigatorInterface::CartesianGotoMessage(this);
00885 }
00886 /** @class NavigatorInterface::PolarGotoMessage <interfaces/NavigatorInterface.h>
00887  * PolarGotoMessage Fawkes BlackBoard Interface Message.
00888  * 
00889     
00890  */
00891
00892 
00893 /** Constructor with initial values.
00894  * @param ini_phi initial value for phi
00895  * @param ini_dist initial value for dist
00896  * @param ini_orientation initial value for orientation
00897  */
00898 NavigatorInterface::PolarGotoMessage::PolarGotoMessage(const float ini_phi, const float ini_dist, const float ini_orientation) : Message("PolarGotoMessage")
00899 {
00900   data_size = sizeof(PolarGotoMessage_data_t);
00901   data_ptr  = malloc(data_size);
00902   memset(data_ptr, 0, data_size);
00903   data      = (PolarGotoMessage_data_t *)data_ptr;
00904   data->phi = ini_phi;
00905   data->dist = ini_dist;
00906   data->orientation = ini_orientation;
00907   add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
00908   add_fieldinfo(IFT_FLOAT, "dist", 1, &data->dist);
00909   add_fieldinfo(IFT_FLOAT, "orientation", 1, &data->orientation);
00910 }
00911 /** Constructor */
00912 NavigatorInterface::PolarGotoMessage::PolarGotoMessage() : Message("PolarGotoMessage")
00913 {
00914   data_size = sizeof(PolarGotoMessage_data_t);
00915   data_ptr  = malloc(data_size);
00916   memset(data_ptr, 0, data_size);
00917   data      = (PolarGotoMessage_data_t *)data_ptr;
00918   add_fieldinfo(IFT_FLOAT, "phi", 1, &data->phi);
00919   add_fieldinfo(IFT_FLOAT, "dist", 1, &data->dist);
00920   add_fieldinfo(IFT_FLOAT, "orientation", 1, &data->orientation);
00921 }
00922 
00923 /** Destructor */
00924 NavigatorInterface::PolarGotoMessage::~PolarGotoMessage()
00925 {
00926   free(data_ptr);
00927 }
00928 
00929 /** Copy constructor.
00930  * @param m message to copy from
00931  */
00932 NavigatorInterface::PolarGotoMessage::PolarGotoMessage(const PolarGotoMessage *m) : Message("PolarGotoMessage")
00933 {
00934   data_size = m->data_size;
00935   data_ptr  = malloc(data_size);
00936   memcpy(data_ptr, m->data_ptr, data_size);
00937   data      = (PolarGotoMessage_data_t *)data_ptr;
00938 }
00939
00940 /* Methods */
00941 /** Get phi value.
00942  * Angle between the robot's front and the target.
00943  * @return phi value
00944  */
00945 float
00946 NavigatorInterface::PolarGotoMessage::phi() const
00947 {
00948   return data->phi;
00949 }
00950 
00951 /** Get maximum length of phi value.
00952  * @return length of phi value, can be length of the array or number of 
00953  * maximum number of characters for a string
00954  */
00955 size_t
00956 NavigatorInterface::PolarGotoMessage::maxlenof_phi() const
00957 {
00958   return 1;
00959 }
00960 
00961 /** Set phi value.
00962  * Angle between the robot's front and the target.
00963  * @param new_phi new phi value
00964  */
00965 void
00966 NavigatorInterface::PolarGotoMessage::set_phi(const float new_phi)
00967 {
00968   data->phi = new_phi;
00969 }
00970 
00971 /** Get dist value.
00972  * Distance to the target.
00973  * @return dist value
00974  */
00975 float
00976 NavigatorInterface::PolarGotoMessage::dist() const
00977 {
00978   return data->dist;
00979 }
00980 
00981 /** Get maximum length of dist value.
00982  * @return length of dist value, can be length of the array or number of 
00983  * maximum number of characters for a string
00984  */
00985 size_t
00986 NavigatorInterface::PolarGotoMessage::maxlenof_dist() const
00987 {
00988   return 1;
00989 }
00990 
00991 /** Set dist value.
00992  * Distance to the target.
00993  * @param new_dist new dist value
00994  */
00995 void
00996 NavigatorInterface::PolarGotoMessage::set_dist(const float new_dist)
00997 {
00998   data->dist = new_dist;
00999 }
01000 
01001 /** Get orientation value.
01002  * The orientation of the robot at the target.
01003  * @return orientation value
01004  */
01005 float
01006 NavigatorInterface::PolarGotoMessage::orientation() const
01007 {
01008   return data->orientation;
01009 }
01010 
01011 /** Get maximum length of orientation value.
01012  * @return length of orientation value, can be length of the array or number of 
01013  * maximum number of characters for a string
01014  */
01015 size_t
01016 NavigatorInterface::PolarGotoMessage::maxlenof_orientation() const
01017 {
01018   return 1;
01019 }
01020 
01021 /** Set orientation value.
01022  * The orientation of the robot at the target.
01023  * @param new_orientation new orientation value
01024  */
01025 void
01026 NavigatorInterface::PolarGotoMessage::set_orientation(const float new_orientation)
01027 {
01028   data->orientation = new_orientation;
01029 }
01030 
01031 /** Clone this message.
01032  * Produces a message of the same type as this message and copies the
01033  * data to the new message.
01034  * @return clone of this message
01035  */
01036 Message *
01037 NavigatorInterface::PolarGotoMessage::clone() const
01038 {
01039   return new NavigatorInterface::PolarGotoMessage(this);
01040 }
01041 /** @class NavigatorInterface::PlaceGotoMessage <interfaces/NavigatorInterface.h>
01042  * PlaceGotoMessage Fawkes BlackBoard Interface Message.
01043  * 
01044     
01045  */
01046
01047 
01048 /** Constructor with initial values.
01049  * @param ini_place initial value for place
01050  */
01051 NavigatorInterface::PlaceGotoMessage::PlaceGotoMessage(const char * ini_place) : Message("PlaceGotoMessage")
01052 {
01053   data_size = sizeof(PlaceGotoMessage_data_t);
01054   data_ptr  = malloc(data_size);
01055   memset(data_ptr, 0, data_size);
01056   data      = (PlaceGotoMessage_data_t *)data_ptr;
01057   strncpy(data->place, ini_place, 64);
01058   add_fieldinfo(IFT_STRING, "place", 64, data->place);
01059 }
01060 /** Constructor */
01061 NavigatorInterface::PlaceGotoMessage::PlaceGotoMessage() : Message("PlaceGotoMessage")
01062 {
01063   data_size = sizeof(PlaceGotoMessage_data_t);
01064   data_ptr  = malloc(data_size);
01065   memset(data_ptr, 0, data_size);
01066   data      = (PlaceGotoMessage_data_t *)data_ptr;
01067   add_fieldinfo(IFT_STRING, "place", 64, data->place);
01068 }
01069 
01070 /** Destructor */
01071 NavigatorInterface::PlaceGotoMessage::~PlaceGotoMessage()
01072 {
01073   free(data_ptr);
01074 }
01075 
01076 /** Copy constructor.
01077  * @param m message to copy from
01078  */
01079 NavigatorInterface::PlaceGotoMessage::PlaceGotoMessage(const PlaceGotoMessage *m) : Message("PlaceGotoMessage")
01080 {
01081   data_size = m->data_size;
01082   data_ptr  = malloc(data_size);
01083   memcpy(data_ptr, m->data_ptr, data_size);
01084   data      = (PlaceGotoMessage_data_t *)data_ptr;
01085 }
01086
01087 /* Methods */
01088 /** Get place value.
01089  * Place to go to.
01090  * @return place value
01091  */
01092 char *
01093 NavigatorInterface::PlaceGotoMessage::place() const
01094 {
01095   return data->place;
01096 }
01097 
01098 /** Get maximum length of place value.
01099  * @return length of place value, can be length of the array or number of 
01100  * maximum number of characters for a string
01101  */
01102 size_t
01103 NavigatorInterface::PlaceGotoMessage::maxlenof_place() const
01104 {
01105   return 64;
01106 }
01107 
01108 /** Set place value.
01109  * Place to go to.
01110  * @param new_place new place value
01111  */
01112 void
01113 NavigatorInterface::PlaceGotoMessage::set_place(const char * new_place)
01114 {
01115   strncpy(data->place, new_place, sizeof(data->place));
01116 }
01117 
01118 /** Clone this message.
01119  * Produces a message of the same type as this message and copies the
01120  * data to the new message.
01121  * @return clone of this message
01122  */
01123 Message *
01124 NavigatorInterface::PlaceGotoMessage::clone() const
01125 {
01126   return new NavigatorInterface::PlaceGotoMessage(this);
01127 }
01128 /** @class NavigatorInterface::ObstacleMessage <interfaces/NavigatorInterface.h>
01129  * ObstacleMessage Fawkes BlackBoard Interface Message.
01130  * 
01131     
01132  */
01133
01134 
01135 /** Constructor with initial values.
01136  * @param ini_x initial value for x
01137  * @param ini_y initial value for y
01138  * @param ini_width initial value for width
01139  */
01140 NavigatorInterface::ObstacleMessage::ObstacleMessage(const float ini_x, const float ini_y, const float ini_width) : Message("ObstacleMessage")
01141 {
01142   data_size = sizeof(ObstacleMessage_data_t);
01143   data_ptr  = malloc(data_size);
01144   memset(data_ptr, 0, data_size);
01145   data      = (ObstacleMessage_data_t *)data_ptr;
01146   data->x = ini_x;
01147   data->y = ini_y;
01148   data->width = ini_width;
01149   add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
01150   add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
01151   add_fieldinfo(IFT_FLOAT, "width", 1, &data->width);
01152 }
01153 /** Constructor */
01154 NavigatorInterface::ObstacleMessage::ObstacleMessage() : Message("ObstacleMessage")
01155 {
01156   data_size = sizeof(ObstacleMessage_data_t);
01157   data_ptr  = malloc(data_size);
01158   memset(data_ptr, 0, data_size);
01159   data      = (ObstacleMessage_data_t *)data_ptr;
01160   add_fieldinfo(IFT_FLOAT, "x", 1, &data->x);
01161   add_fieldinfo(IFT_FLOAT, "y", 1, &data->y);
01162   add_fieldinfo(IFT_FLOAT, "width", 1, &data->width);
01163 }
01164 
01165 /** Destructor */
01166 NavigatorInterface::ObstacleMessage::~ObstacleMessage()
01167 {
01168   free(data_ptr);
01169 }
01170 
01171 /** Copy constructor.
01172  * @param m message to copy from
01173  */
01174 NavigatorInterface::ObstacleMessage::ObstacleMessage(const ObstacleMessage *m) : Message("ObstacleMessage")
01175 {
01176   data_size = m->data_size;
01177   data_ptr  = malloc(data_size);
01178   memcpy(data_ptr, m->data_ptr, data_size);
01179   data      = (ObstacleMessage_data_t *)data_ptr;
01180 }
01181
01182 /* Methods */
01183 /** Get x value.
01184  * X-coordinate of the obstacle.
01185  * @return x value
01186  */
01187 float
01188 NavigatorInterface::ObstacleMessage::x() const
01189 {
01190   return data->x;
01191 }
01192 
01193 /** Get maximum length of x value.
01194  * @return length of x value, can be length of the array or number of 
01195  * maximum number of characters for a string
01196  */
01197 size_t
01198 NavigatorInterface::ObstacleMessage::maxlenof_x() const
01199 {
01200   return 1;
01201 }
01202 
01203 /** Set x value.
01204  * X-coordinate of the obstacle.
01205  * @param new_x new x value
01206  */
01207 void
01208 NavigatorInterface::ObstacleMessage::set_x(const float new_x)
01209 {
01210   data->x = new_x;
01211 }
01212 
01213 /** Get y value.
01214  * Y-coordinate of the obstacle.
01215  * @return y value
01216  */
01217 float
01218 NavigatorInterface::ObstacleMessage::y() const
01219 {
01220   return data->y;
01221 }
01222 
01223 /** Get maximum length of y value.
01224  * @return length of y value, can be length of the array or number of 
01225  * maximum number of characters for a string
01226  */
01227 size_t
01228 NavigatorInterface::ObstacleMessage::maxlenof_y() const
01229 {
01230   return 1;
01231 }
01232 
01233 /** Set y value.
01234  * Y-coordinate of the obstacle.
01235  * @param new_y new y value
01236  */
01237 void
01238 NavigatorInterface::ObstacleMessage::set_y(const float new_y)
01239 {
01240   data->y = new_y;
01241 }
01242 
01243 /** Get width value.
01244  * Width of the obstacle.
01245  * @return width value
01246  */
01247 float
01248 NavigatorInterface::ObstacleMessage::width() const
01249 {
01250   return data->width;
01251 }
01252 
01253 /** Get maximum length of width value.
01254  * @return length of width value, can be length of the array or number of 
01255  * maximum number of characters for a string
01256  */
01257 size_t
01258 NavigatorInterface::ObstacleMessage::maxlenof_width() const
01259 {
01260   return 1;
01261 }
01262 
01263 /** Set width value.
01264  * Width of the obstacle.
01265  * @param new_width new width value
01266  */
01267 void
01268 NavigatorInterface::ObstacleMessage::set_width(const float new_width)
01269 {
01270   data->width = new_width;
01271 }
01272 
01273 /** Clone this message.
01274  * Produces a message of the same type as this message and copies the
01275  * data to the new message.
01276  * @return clone of this message
01277  */
01278 Message *
01279 NavigatorInterface::ObstacleMessage::clone() const
01280 {
01281   return new NavigatorInterface::ObstacleMessage(this);
01282 }
01283 /** @class NavigatorInterface::ResetOdometryMessage <interfaces/NavigatorInterface.h>
01284  * ResetOdometryMessage Fawkes BlackBoard Interface Message.
01285  * 
01286     
01287  */
01288
01289 
01290 /** Constructor */
01291 NavigatorInterface::ResetOdometryMessage::ResetOdometryMessage() : Message("ResetOdometryMessage")
01292 {
01293   data_size = 0;
01294   data_ptr  = NULL;
01295 }
01296 
01297 /** Destructor */
01298 NavigatorInterface::ResetOdometryMessage::~ResetOdometryMessage()
01299 {
01300 }
01301 
01302 /** Copy constructor.
01303  * @param m message to copy from
01304  */
01305 NavigatorInterface::ResetOdometryMessage::ResetOdometryMessage(const ResetOdometryMessage *m) : Message("ResetOdometryMessage")
01306 {
01307   data_size = 0;
01308   data_ptr  = NULL;
01309 }
01310
01311 /* Methods */
01312 /** Clone this message.
01313  * Produces a message of the same type as this message and copies the
01314  * data to the new message.
01315  * @return clone of this message
01316  */
01317 Message *
01318 NavigatorInterface::ResetOdometryMessage::clone() const
01319 {
01320   return new NavigatorInterface::ResetOdometryMessage(this);
01321 }
01322 /** @class NavigatorInterface::SetMaxVelocityMessage <interfaces/NavigatorInterface.h>
01323  * SetMaxVelocityMessage Fawkes BlackBoard Interface Message.
01324  * 
01325     
01326  */
01327
01328 
01329 /** Constructor with initial values.
01330  * @param ini_max_velocity initial value for max_velocity
01331  */
01332 NavigatorInterface::SetMaxVelocityMessage::SetMaxVelocityMessage(const float ini_max_velocity) : Message("SetMaxVelocityMessage")
01333 {
01334   data_size = sizeof(SetMaxVelocityMessage_data_t);
01335   data_ptr  = malloc(data_size);
01336   memset(data_ptr, 0, data_size);
01337   data      = (SetMaxVelocityMessage_data_t *)data_ptr;
01338   data->max_velocity = ini_max_velocity;
01339   add_fieldinfo(IFT_FLOAT, "max_velocity", 1, &data->max_velocity);
01340 }
01341 /** Constructor */
01342 NavigatorInterface::SetMaxVelocityMessage::SetMaxVelocityMessage() : Message("SetMaxVelocityMessage")
01343 {
01344   data_size = sizeof(SetMaxVelocityMessage_data_t);
01345   data_ptr  = malloc(data_size);
01346   memset(data_ptr, 0, data_size);
01347   data      = (SetMaxVelocityMessage_data_t *)data_ptr;
01348   add_fieldinfo(IFT_FLOAT, "max_velocity", 1, &data->max_velocity);
01349 }
01350 
01351 /** Destructor */
01352 NavigatorInterface::SetMaxVelocityMessage::~SetMaxVelocityMessage()
01353 {
01354   free(data_ptr);
01355 }
01356 
01357 /** Copy constructor.
01358  * @param m message to copy from
01359  */
01360 NavigatorInterface::SetMaxVelocityMessage::SetMaxVelocityMessage(const SetMaxVelocityMessage *m) : Message("SetMaxVelocityMessage")
01361 {
01362   data_size = m->data_size;
01363   data_ptr  = malloc(data_size);
01364   memcpy(data_ptr, m->data_ptr, data_size);
01365   data      = (SetMaxVelocityMessage_data_t *)data_ptr;
01366 }
01367
01368 /* Methods */
01369 /** Get max_velocity value.
01370  * Maximum velocity
01371  * @return max_velocity value
01372  */
01373 float
01374 NavigatorInterface::SetMaxVelocityMessage::max_velocity() const
01375 {
01376   return data->max_velocity;
01377 }
01378 
01379 /** Get maximum length of max_velocity value.
01380  * @return length of max_velocity value, can be length of the array or number of 
01381  * maximum number of characters for a string
01382  */
01383 size_t
01384 NavigatorInterface::SetMaxVelocityMessage::maxlenof_max_velocity() const
01385 {
01386   return 1;
01387 }
01388 
01389 /** Set max_velocity value.
01390  * Maximum velocity
01391  * @param new_max_velocity new max_velocity value
01392  */
01393 void
01394 NavigatorInterface::SetMaxVelocityMessage::set_max_velocity(const float new_max_velocity)
01395 {
01396   data->max_velocity = new_max_velocity;
01397 }
01398 
01399 /** Clone this message.
01400  * Produces a message of the same type as this message and copies the
01401  * data to the new message.
01402  * @return clone of this message
01403  */
01404 Message *
01405 NavigatorInterface::SetMaxVelocityMessage::clone() const
01406 {
01407   return new NavigatorInterface::SetMaxVelocityMessage(this);
01408 }
01409 /** @class NavigatorInterface::SetEscapingMessage <interfaces/NavigatorInterface.h>
01410  * SetEscapingMessage Fawkes BlackBoard Interface Message.
01411  * 
01412     
01413  */
01414
01415 
01416 /** Constructor with initial values.
01417  * @param ini_escaping_enabled initial value for escaping_enabled
01418  */
01419 NavigatorInterface::SetEscapingMessage::SetEscapingMessage(const bool ini_escaping_enabled) : Message("SetEscapingMessage")
01420 {
01421   data_size = sizeof(SetEscapingMessage_data_t);
01422   data_ptr  = malloc(data_size);
01423   memset(data_ptr, 0, data_size);
01424   data      = (SetEscapingMessage_data_t *)data_ptr;
01425   data->escaping_enabled = ini_escaping_enabled;
01426   add_fieldinfo(IFT_BOOL, "escaping_enabled", 1, &data->escaping_enabled);
01427 }
01428 /** Constructor */
01429 NavigatorInterface::SetEscapingMessage::SetEscapingMessage() : Message("SetEscapingMessage")
01430 {
01431   data_size = sizeof(SetEscapingMessage_data_t);
01432   data_ptr  = malloc(data_size);
01433   memset(data_ptr, 0, data_size);
01434   data      = (SetEscapingMessage_data_t *)data_ptr;
01435   add_fieldinfo(IFT_BOOL, "escaping_enabled", 1, &data->escaping_enabled);
01436 }
01437 
01438 /** Destructor */
01439 NavigatorInterface::SetEscapingMessage::~SetEscapingMessage()
01440 {
01441   free(data_ptr);
01442 }
01443 
01444 /** Copy constructor.
01445  * @param m message to copy from
01446  */
01447 NavigatorInterface::SetEscapingMessage::SetEscapingMessage(const SetEscapingMessage *m) : Message("SetEscapingMessage")
01448 {
01449   data_size = m->data_size;
01450   data_ptr  = malloc(data_size);
01451   memcpy(data_ptr, m->data_ptr, data_size);
01452   data      = (SetEscapingMessage_data_t *)data_ptr;
01453 }
01454
01455 /* Methods */
01456 /** Get escaping_enabled value.
01457  * This is used for
01458         navigation components with integrated collision avoidance, to
01459         check whether the navigator should stop when an obstacle
01460         obstructs the path, or if it should escape.
01461  * @return escaping_enabled value
01462  */
01463 bool
01464 NavigatorInterface::SetEscapingMessage::is_escaping_enabled() const
01465 {
01466   return data->escaping_enabled;
01467 }
01468 
01469 /** Get maximum length of escaping_enabled value.
01470  * @return length of escaping_enabled value, can be length of the array or number of 
01471  * maximum number of characters for a string
01472  */
01473 size_t
01474 NavigatorInterface::SetEscapingMessage::maxlenof_escaping_enabled() const
01475 {
01476   return 1;
01477 }
01478 
01479 /** Set escaping_enabled value.
01480  * This is used for
01481         navigation components with integrated collision avoidance, to
01482         check whether the navigator should stop when an obstacle
01483         obstructs the path, or if it should escape.
01484  * @param new_escaping_enabled new escaping_enabled value
01485  */
01486 void
01487 NavigatorInterface::SetEscapingMessage::set_escaping_enabled(const bool new_escaping_enabled)
01488 {
01489   data->escaping_enabled = new_escaping_enabled;
01490 }
01491 
01492 /** Clone this message.
01493  * Produces a message of the same type as this message and copies the
01494  * data to the new message.
01495  * @return clone of this message
01496  */
01497 Message *
01498 NavigatorInterface::SetEscapingMessage::clone() const
01499 {
01500   return new NavigatorInterface::SetEscapingMessage(this);
01501 }
01502 /** @class NavigatorInterface::SetSecurityDistanceMessage <interfaces/NavigatorInterface.h>
01503  * SetSecurityDistanceMessage Fawkes BlackBoard Interface Message.
01504  * 
01505     
01506  */
01507
01508 
01509 /** Constructor with initial values.
01510  * @param ini_security_distance initial value for security_distance
01511  */
01512 NavigatorInterface::SetSecurityDistanceMessage::SetSecurityDistanceMessage(const float ini_security_distance) : Message("SetSecurityDistanceMessage")
01513 {
01514   data_size = sizeof(SetSecurityDistanceMessage_data_t);
01515   data_ptr  = malloc(data_size);
01516   memset(data_ptr, 0, data_size);
01517   data      = (SetSecurityDistanceMessage_data_t *)data_ptr;
01518   data->security_distance = ini_security_distance;
01519   add_fieldinfo(IFT_FLOAT, "security_distance", 1, &data->security_distance);
01520 }
01521 /** Constructor */
01522 NavigatorInterface::SetSecurityDistanceMessage::SetSecurityDistanceMessage() : Message("SetSecurityDistanceMessage")
01523 {
01524   data_size = sizeof(SetSecurityDistanceMessage_data_t);
01525   data_ptr  = malloc(data_size);
01526   memset(data_ptr, 0, data_size);
01527   data      = (SetSecurityDistanceMessage_data_t *)data_ptr;
01528   add_fieldinfo(IFT_FLOAT, "security_distance", 1, &data->security_distance);
01529 }
01530 
01531 /** Destructor */
01532 NavigatorInterface::SetSecurityDistanceMessage::~SetSecurityDistanceMessage()
01533 {
01534   free(data_ptr);
01535 }
01536 
01537 /** Copy constructor.
01538  * @param m message to copy from
01539  */
01540 NavigatorInterface::SetSecurityDistanceMessage::SetSecurityDistanceMessage(const SetSecurityDistanceMessage *m) : Message("SetSecurityDistanceMessage")
01541 {
01542   data_size = m->data_size;
01543   data_ptr  = malloc(data_size);
01544   memcpy(data_ptr, m->data_ptr, data_size);
01545   data      = (SetSecurityDistanceMessage_data_t *)data_ptr;
01546 }
01547
01548 /* Methods */
01549 /** Get security_distance value.
01550  * Security distance to
01551     keep to obstacles
01552  * @return security_distance value
01553  */
01554 float
01555 NavigatorInterface::SetSecurityDistanceMessage::security_distance() const
01556 {
01557   return data->security_distance;
01558 }
01559 
01560 /** Get maximum length of security_distance value.
01561  * @return length of security_distance value, can be length of the array or number of 
01562  * maximum number of characters for a string
01563  */
01564 size_t
01565 NavigatorInterface::SetSecurityDistanceMessage::maxlenof_security_distance() const
01566 {
01567   return 1;
01568 }
01569 
01570 /** Set security_distance value.
01571  * Security distance to
01572     keep to obstacles
01573  * @param new_security_distance new security_distance value
01574  */
01575 void
01576 NavigatorInterface::SetSecurityDistanceMessage::set_security_distance(const float new_security_distance)
01577 {
01578   data->security_distance = new_security_distance;
01579 }
01580 
01581 /** Clone this message.
01582  * Produces a message of the same type as this message and copies the
01583  * data to the new message.
01584  * @return clone of this message
01585  */
01586 Message *
01587 NavigatorInterface::SetSecurityDistanceMessage::clone() const
01588 {
01589   return new NavigatorInterface::SetSecurityDistanceMessage(this);
01590 }
01591 /** Check if message is valid and can be enqueued.
01592  * @param message Message to check
01593  */
01594 bool
01595 NavigatorInterface::message_valid(const Message *message) const
01596 {
01597   const StopMessage *m0 = dynamic_cast<const StopMessage *>(message);
01598   if ( m0 != NULL ) {
01599     return true;
01600   }
01601   const TurnMessage *m1 = dynamic_cast<const TurnMessage *>(message);
01602   if ( m1 != NULL ) {
01603     return true;
01604   }
01605   const CartesianGotoMessage *m2 = dynamic_cast<const CartesianGotoMessage *>(message);
01606   if ( m2 != NULL ) {
01607     return true;
01608   }
01609   const PolarGotoMessage *m3 = dynamic_cast<const PolarGotoMessage *>(message);
01610   if ( m3 != NULL ) {
01611     return true;
01612   }
01613   const PlaceGotoMessage *m4 = dynamic_cast<const PlaceGotoMessage *>(message);
01614   if ( m4 != NULL ) {
01615     return true;
01616   }
01617   const ObstacleMessage *m5 = dynamic_cast<const ObstacleMessage *>(message);
01618   if ( m5 != NULL ) {
01619     return true;
01620   }
01621   const ResetOdometryMessage *m6 = dynamic_cast<const ResetOdometryMessage *>(message);
01622   if ( m6 != NULL ) {
01623     return true;
01624   }
01625   const SetMaxVelocityMessage *m7 = dynamic_cast<const SetMaxVelocityMessage *>(message);
01626   if ( m7 != NULL ) {
01627     return true;
01628   }
01629   const SetEscapingMessage *m8 = dynamic_cast<const SetEscapingMessage *>(message);
01630   if ( m8 != NULL ) {
01631     return true;
01632   }
01633   const SetSecurityDistanceMessage *m9 = dynamic_cast<const SetSecurityDistanceMessage *>(message);
01634   if ( m9 != NULL ) {
01635     return true;
01636   }
01637   return false;
01638 }
01639 
01640 /// @cond INTERNALS
01641 EXPORT_INTERFACE(NavigatorInterface)
01642 /// @endcond
01643 
01644
01645 } // end namespace fawkes