PanTiltInterface.cpp

00001
00002 /***************************************************************************
00003  *  PanTiltInterface.cpp - Fawkes BlackBoard Interface - PanTiltInterface
00004  *
00005  *  Templated created:   Thu Oct 12 10:49:19 2006
00006  *  Copyright  2009  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/PanTiltInterface.h>
00025
00026 #include <core/exceptions/software.h>
00027
00028 #include <cstring>
00029 #include <cstdlib>
00030
00031 namespace fawkes {
00032 
00033 /** @class PanTiltInterface <interfaces/PanTiltInterface.h>
00034  * PanTiltInterface Fawkes BlackBoard Interface.
00035  * 
00036       Interface to access pan/tilt units.
00037     
00038  * @ingroup FawkesInterfaces
00039  */
00040
00041 
00042 /** FLAG_SUPPORTS_PAN constant */
00043 const unsigned int PanTiltInterface::FLAG_SUPPORTS_PAN = 1;
00044 /** FLAG_SUPPORTS_TILT constant */
00045 const unsigned int PanTiltInterface::FLAG_SUPPORTS_TILT = 2;
00046 /** ERROR_NONE constant */
00047 const unsigned int PanTiltInterface::ERROR_NONE = 0;
00048 /** ERROR_UNSPECIFIC constant */
00049 const unsigned int PanTiltInterface::ERROR_UNSPECIFIC = 1;
00050 /** ERROR_COMMUNICATION constant */
00051 const unsigned int PanTiltInterface::ERROR_COMMUNICATION = 2;
00052 /** ERROR_PAN_OUTOFRANGE constant */
00053 const unsigned int PanTiltInterface::ERROR_PAN_OUTOFRANGE = 4;
00054 /** ERROR_TILT_OUTOFRANGE constant */
00055 const unsigned int PanTiltInterface::ERROR_TILT_OUTOFRANGE = 8;
00056 
00057 /** Constructor */
00058 PanTiltInterface::PanTiltInterface() : Interface()
00059 {
00060   data_size = sizeof(PanTiltInterface_data_t);
00061   data_ptr  = malloc(data_size);
00062   data      = (PanTiltInterface_data_t *)data_ptr;
00063   memset(data_ptr, 0, data_size);
00064   add_fieldinfo(IFT_UINT, "flags", 1, &data->flags);
00065   add_fieldinfo(IFT_FLOAT, "pan", 1, &data->pan);
00066   add_fieldinfo(IFT_FLOAT, "tilt", 1, &data->tilt);
00067   add_fieldinfo(IFT_UINT, "msgid", 1, &data->msgid);
00068   add_fieldinfo(IFT_BOOL, "final", 1, &data->final);
00069   add_fieldinfo(IFT_UINT, "error_code", 1, &data->error_code);
00070   add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
00071   add_fieldinfo(IFT_BOOL, "calibrated", 1, &data->calibrated);
00072   add_fieldinfo(IFT_FLOAT, "min_pan", 1, &data->min_pan);
00073   add_fieldinfo(IFT_FLOAT, "max_pan", 1, &data->max_pan);
00074   add_fieldinfo(IFT_FLOAT, "min_tilt", 1, &data->min_tilt);
00075   add_fieldinfo(IFT_FLOAT, "max_tilt", 1, &data->max_tilt);
00076   add_fieldinfo(IFT_FLOAT, "max_pan_velocity", 1, &data->max_pan_velocity);
00077   add_fieldinfo(IFT_FLOAT, "max_tilt_velocity", 1, &data->max_tilt_velocity);
00078   add_fieldinfo(IFT_FLOAT, "pan_velocity", 1, &data->pan_velocity);
00079   add_fieldinfo(IFT_FLOAT, "tilt_velocity", 1, &data->tilt_velocity);
00080   add_fieldinfo(IFT_FLOAT, "pan_margin", 1, &data->pan_margin);
00081   add_fieldinfo(IFT_FLOAT, "tilt_margin", 1, &data->tilt_margin);
00082   add_messageinfo("StopMessage");
00083   add_messageinfo("FlushMessage");
00084   add_messageinfo("CalibrateMessage");
00085   add_messageinfo("ParkMessage");
00086   add_messageinfo("GotoMessage");
00087   add_messageinfo("TimedGotoMessage");
00088   add_messageinfo("SetEnabledMessage");
00089   add_messageinfo("SetVelocityMessage");
00090   add_messageinfo("SetMarginMessage");
00091   unsigned char tmp_hash[] = {0xf1, 0x7a, 0x47, 0xde, 0x4f, 0x37, 0x5b, 0xc7, 0x75, 0x1c, 0xd6, 0x73, 0x1e, 00, 0xe9, 0x71};
00092   set_hash(tmp_hash);
00093 }
00094 
00095 /** Destructor */
00096 PanTiltInterface::~PanTiltInterface()
00097 {
00098   free(data_ptr);
00099 }
00100 /* Methods */
00101 /** Get flags value.
00102  * Flags.
00103  * @return flags value
00104  */
00105 unsigned int
00106 PanTiltInterface::flags() const
00107 {
00108   return data->flags;
00109 }
00110 
00111 /** Get maximum length of flags value.
00112  * @return length of flags value, can be length of the array or number of 
00113  * maximum number of characters for a string
00114  */
00115 size_t
00116 PanTiltInterface::maxlenof_flags() const
00117 {
00118   return 1;
00119 }
00120 
00121 /** Set flags value.
00122  * Flags.
00123  * @param new_flags new flags value
00124  */
00125 void
00126 PanTiltInterface::set_flags(const unsigned int new_flags)
00127 {
00128   data->flags = new_flags;
00129 }
00130 
00131 /** Get pan value.
00132  * Current pan.
00133  * @return pan value
00134  */
00135 float
00136 PanTiltInterface::pan() const
00137 {
00138   return data->pan;
00139 }
00140 
00141 /** Get maximum length of pan value.
00142  * @return length of pan value, can be length of the array or number of 
00143  * maximum number of characters for a string
00144  */
00145 size_t
00146 PanTiltInterface::maxlenof_pan() const
00147 {
00148   return 1;
00149 }
00150 
00151 /** Set pan value.
00152  * Current pan.
00153  * @param new_pan new pan value
00154  */
00155 void
00156 PanTiltInterface::set_pan(const float new_pan)
00157 {
00158   data->pan = new_pan;
00159 }
00160 
00161 /** Get tilt value.
00162  * Current tilt.
00163  * @return tilt value
00164  */
00165 float
00166 PanTiltInterface::tilt() const
00167 {
00168   return data->tilt;
00169 }
00170 
00171 /** Get maximum length of tilt value.
00172  * @return length of tilt value, can be length of the array or number of 
00173  * maximum number of characters for a string
00174  */
00175 size_t
00176 PanTiltInterface::maxlenof_tilt() const
00177 {
00178   return 1;
00179 }
00180 
00181 /** Set tilt value.
00182  * Current tilt.
00183  * @param new_tilt new tilt value
00184  */
00185 void
00186 PanTiltInterface::set_tilt(const float new_tilt)
00187 {
00188   data->tilt = new_tilt;
00189 }
00190 
00191 /** Get msgid value.
00192  * The ID of the message that is currently being
00193       processed, or 0 if no message is being processed.
00194  * @return msgid value
00195  */
00196 unsigned int
00197 PanTiltInterface::msgid() const
00198 {
00199   return data->msgid;
00200 }
00201 
00202 /** Get maximum length of msgid value.
00203  * @return length of msgid value, can be length of the array or number of 
00204  * maximum number of characters for a string
00205  */
00206 size_t
00207 PanTiltInterface::maxlenof_msgid() const
00208 {
00209   return 1;
00210 }
00211 
00212 /** Set msgid value.
00213  * The ID of the message that is currently being
00214       processed, or 0 if no message is being processed.
00215  * @param new_msgid new msgid value
00216  */
00217 void
00218 PanTiltInterface::set_msgid(const unsigned int new_msgid)
00219 {
00220   data->msgid = new_msgid;
00221 }
00222 
00223 /** Get final value.
00224  * True, if the last goto command has been finished,
00225       false if it is still running
00226  * @return final value
00227  */
00228 bool
00229 PanTiltInterface::is_final() const
00230 {
00231   return data->final;
00232 }
00233 
00234 /** Get maximum length of final value.
00235  * @return length of final value, can be length of the array or number of 
00236  * maximum number of characters for a string
00237  */
00238 size_t
00239 PanTiltInterface::maxlenof_final() const
00240 {
00241   return 1;
00242 }
00243 
00244 /** Set final value.
00245  * True, if the last goto command has been finished,
00246       false if it is still running
00247  * @param new_final new final value
00248  */
00249 void
00250 PanTiltInterface::set_final(const bool new_final)
00251 {
00252   data->final = new_final;
00253 }
00254 
00255 /** Get error_code value.
00256  * Failure code set if
00257     final is true. 0 if no error occured, an error code from ERROR_*
00258     constants otherwise (or a bit-wise combination).
00259  * @return error_code value
00260  */
00261 unsigned int
00262 PanTiltInterface::error_code() const
00263 {
00264   return data->error_code;
00265 }
00266 
00267 /** Get maximum length of error_code value.
00268  * @return length of error_code value, can be length of the array or number of 
00269  * maximum number of characters for a string
00270  */
00271 size_t
00272 PanTiltInterface::maxlenof_error_code() const
00273 {
00274   return 1;
00275 }
00276 
00277 /** Set error_code value.
00278  * Failure code set if
00279     final is true. 0 if no error occured, an error code from ERROR_*
00280     constants otherwise (or a bit-wise combination).
00281  * @param new_error_code new error_code value
00282  */
00283 void
00284 PanTiltInterface::set_error_code(const unsigned int new_error_code)
00285 {
00286   data->error_code = new_error_code;
00287 }
00288 
00289 /** Get enabled value.
00290  * Is the pan/tilt unit enabled?
00291  * @return enabled value
00292  */
00293 bool
00294 PanTiltInterface::is_enabled() const
00295 {
00296   return data->enabled;
00297 }
00298 
00299 /** Get maximum length of enabled value.
00300  * @return length of enabled value, can be length of the array or number of 
00301  * maximum number of characters for a string
00302  */
00303 size_t
00304 PanTiltInterface::maxlenof_enabled() const
00305 {
00306   return 1;
00307 }
00308 
00309 /** Set enabled value.
00310  * Is the pan/tilt unit enabled?
00311  * @param new_enabled new enabled value
00312  */
00313 void
00314 PanTiltInterface::set_enabled(const bool new_enabled)
00315 {
00316   data->enabled = new_enabled;
00317 }
00318 
00319 /** Get calibrated value.
00320  * Is the pan/tilt unit calibrated?
00321  * @return calibrated value
00322  */
00323 bool
00324 PanTiltInterface::is_calibrated() const
00325 {
00326   return data->calibrated;
00327 }
00328 
00329 /** Get maximum length of calibrated value.
00330  * @return length of calibrated value, can be length of the array or number of 
00331  * maximum number of characters for a string
00332  */
00333 size_t
00334 PanTiltInterface::maxlenof_calibrated() const
00335 {
00336   return 1;
00337 }
00338 
00339 /** Set calibrated value.
00340  * Is the pan/tilt unit calibrated?
00341  * @param new_calibrated new calibrated value
00342  */
00343 void
00344 PanTiltInterface::set_calibrated(const bool new_calibrated)
00345 {
00346   data->calibrated = new_calibrated;
00347 }
00348 
00349 /** Get min_pan value.
00350  * Minimum pan possible.
00351  * @return min_pan value
00352  */
00353 float
00354 PanTiltInterface::min_pan() const
00355 {
00356   return data->min_pan;
00357 }
00358 
00359 /** Get maximum length of min_pan value.
00360  * @return length of min_pan value, can be length of the array or number of 
00361  * maximum number of characters for a string
00362  */
00363 size_t
00364 PanTiltInterface::maxlenof_min_pan() const
00365 {
00366   return 1;
00367 }
00368 
00369 /** Set min_pan value.
00370  * Minimum pan possible.
00371  * @param new_min_pan new min_pan value
00372  */
00373 void
00374 PanTiltInterface::set_min_pan(const float new_min_pan)
00375 {
00376   data->min_pan = new_min_pan;
00377 }
00378 
00379 /** Get max_pan value.
00380  * Maximum pan possible.
00381  * @return max_pan value
00382  */
00383 float
00384 PanTiltInterface::max_pan() const
00385 {
00386   return data->max_pan;
00387 }
00388 
00389 /** Get maximum length of max_pan value.
00390  * @return length of max_pan value, can be length of the array or number of 
00391  * maximum number of characters for a string
00392  */
00393 size_t
00394 PanTiltInterface::maxlenof_max_pan() const
00395 {
00396   return 1;
00397 }
00398 
00399 /** Set max_pan value.
00400  * Maximum pan possible.
00401  * @param new_max_pan new max_pan value
00402  */
00403 void
00404 PanTiltInterface::set_max_pan(const float new_max_pan)
00405 {
00406   data->max_pan = new_max_pan;
00407 }
00408 
00409 /** Get min_tilt value.
00410  * Minimum tilt possible.
00411  * @return min_tilt value
00412  */
00413 float
00414 PanTiltInterface::min_tilt() const
00415 {
00416   return data->min_tilt;
00417 }
00418 
00419 /** Get maximum length of min_tilt value.
00420  * @return length of min_tilt value, can be length of the array or number of 
00421  * maximum number of characters for a string
00422  */
00423 size_t
00424 PanTiltInterface::maxlenof_min_tilt() const
00425 {
00426   return 1;
00427 }
00428 
00429 /** Set min_tilt value.
00430  * Minimum tilt possible.
00431  * @param new_min_tilt new min_tilt value
00432  */
00433 void
00434 PanTiltInterface::set_min_tilt(const float new_min_tilt)
00435 {
00436   data->min_tilt = new_min_tilt;
00437 }
00438 
00439 /** Get max_tilt value.
00440  * Maximum tilt possible.
00441  * @return max_tilt value
00442  */
00443 float
00444 PanTiltInterface::max_tilt() const
00445 {
00446   return data->max_tilt;
00447 }
00448 
00449 /** Get maximum length of max_tilt value.
00450  * @return length of max_tilt value, can be length of the array or number of 
00451  * maximum number of characters for a string
00452  */
00453 size_t
00454 PanTiltInterface::maxlenof_max_tilt() const
00455 {
00456   return 1;
00457 }
00458 
00459 /** Set max_tilt value.
00460  * Maximum tilt possible.
00461  * @param new_max_tilt new max_tilt value
00462  */
00463 void
00464 PanTiltInterface::set_max_tilt(const float new_max_tilt)
00465 {
00466   data->max_tilt = new_max_tilt;
00467 }
00468 
00469 /** Get max_pan_velocity value.
00470  * Maximum supported pan velocity.
00471  * @return max_pan_velocity value
00472  */
00473 float
00474 PanTiltInterface::max_pan_velocity() const
00475 {
00476   return data->max_pan_velocity;
00477 }
00478 
00479 /** Get maximum length of max_pan_velocity value.
00480  * @return length of max_pan_velocity value, can be length of the array or number of 
00481  * maximum number of characters for a string
00482  */
00483 size_t
00484 PanTiltInterface::maxlenof_max_pan_velocity() const
00485 {
00486   return 1;
00487 }
00488 
00489 /** Set max_pan_velocity value.
00490  * Maximum supported pan velocity.
00491  * @param new_max_pan_velocity new max_pan_velocity value
00492  */
00493 void
00494 PanTiltInterface::set_max_pan_velocity(const float new_max_pan_velocity)
00495 {
00496   data->max_pan_velocity = new_max_pan_velocity;
00497 }
00498 
00499 /** Get max_tilt_velocity value.
00500  * Maximum supported tilt velocity.
00501  * @return max_tilt_velocity value
00502  */
00503 float
00504 PanTiltInterface::max_tilt_velocity() const
00505 {
00506   return data->max_tilt_velocity;
00507 }
00508 
00509 /** Get maximum length of max_tilt_velocity value.
00510  * @return length of max_tilt_velocity value, can be length of the array or number of 
00511  * maximum number of characters for a string
00512  */
00513 size_t
00514 PanTiltInterface::maxlenof_max_tilt_velocity() const
00515 {
00516   return 1;
00517 }
00518 
00519 /** Set max_tilt_velocity value.
00520  * Maximum supported tilt velocity.
00521  * @param new_max_tilt_velocity new max_tilt_velocity value
00522  */
00523 void
00524 PanTiltInterface::set_max_tilt_velocity(const float new_max_tilt_velocity)
00525 {
00526   data->max_tilt_velocity = new_max_tilt_velocity;
00527 }
00528 
00529 /** Get pan_velocity value.
00530  * Maximum pan velocity currently reached.
00531  * @return pan_velocity value
00532  */
00533 float
00534 PanTiltInterface::pan_velocity() const
00535 {
00536   return data->pan_velocity;
00537 }
00538 
00539 /** Get maximum length of pan_velocity value.
00540  * @return length of pan_velocity value, can be length of the array or number of 
00541  * maximum number of characters for a string
00542  */
00543 size_t
00544 PanTiltInterface::maxlenof_pan_velocity() const
00545 {
00546   return 1;
00547 }
00548 
00549 /** Set pan_velocity value.
00550  * Maximum pan velocity currently reached.
00551  * @param new_pan_velocity new pan_velocity value
00552  */
00553 void
00554 PanTiltInterface::set_pan_velocity(const float new_pan_velocity)
00555 {
00556   data->pan_velocity = new_pan_velocity;
00557 }
00558 
00559 /** Get tilt_velocity value.
00560  * Maximum tilt velocity currently reached.
00561  * @return tilt_velocity value
00562  */
00563 float
00564 PanTiltInterface::tilt_velocity() const
00565 {
00566   return data->tilt_velocity;
00567 }
00568 
00569 /** Get maximum length of tilt_velocity value.
00570  * @return length of tilt_velocity value, can be length of the array or number of 
00571  * maximum number of characters for a string
00572  */
00573 size_t
00574 PanTiltInterface::maxlenof_tilt_velocity() const
00575 {
00576   return 1;
00577 }
00578 
00579 /** Set tilt_velocity value.
00580  * Maximum tilt velocity currently reached.
00581  * @param new_tilt_velocity new tilt_velocity value
00582  */
00583 void
00584 PanTiltInterface::set_tilt_velocity(const float new_tilt_velocity)
00585 {
00586   data->tilt_velocity = new_tilt_velocity;
00587 }
00588 
00589 /** Get pan_margin value.
00590  * Margin in radians around a
00591     target pan value to consider the motion as final.
00592  * @return pan_margin value
00593  */
00594 float
00595 PanTiltInterface::pan_margin() const
00596 {
00597   return data->pan_margin;
00598 }
00599 
00600 /** Get maximum length of pan_margin value.
00601  * @return length of pan_margin value, can be length of the array or number of 
00602  * maximum number of characters for a string
00603  */
00604 size_t
00605 PanTiltInterface::maxlenof_pan_margin() const
00606 {
00607   return 1;
00608 }
00609 
00610 /** Set pan_margin value.
00611  * Margin in radians around a
00612     target pan value to consider the motion as final.
00613  * @param new_pan_margin new pan_margin value
00614  */
00615 void
00616 PanTiltInterface::set_pan_margin(const float new_pan_margin)
00617 {
00618   data->pan_margin = new_pan_margin;
00619 }
00620 
00621 /** Get tilt_margin value.
00622  * Margin in radians around a
00623     target tilt value to consider the motion as final.
00624  * @return tilt_margin value
00625  */
00626 float
00627 PanTiltInterface::tilt_margin() const
00628 {
00629   return data->tilt_margin;
00630 }
00631 
00632 /** Get maximum length of tilt_margin value.
00633  * @return length of tilt_margin value, can be length of the array or number of 
00634  * maximum number of characters for a string
00635  */
00636 size_t
00637 PanTiltInterface::maxlenof_tilt_margin() const
00638 {
00639   return 1;
00640 }
00641 
00642 /** Set tilt_margin value.
00643  * Margin in radians around a
00644     target tilt value to consider the motion as final.
00645  * @param new_tilt_margin new tilt_margin value
00646  */
00647 void
00648 PanTiltInterface::set_tilt_margin(const float new_tilt_margin)
00649 {
00650   data->tilt_margin = new_tilt_margin;
00651 }
00652
00653 /* =========== message create =========== */
00654 Message *
00655 PanTiltInterface::create_message(const char *type) const
00656 {
00657   if ( strncmp("StopMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00658     return new StopMessage();
00659   } else if ( strncmp("FlushMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00660     return new FlushMessage();
00661   } else if ( strncmp("CalibrateMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00662     return new CalibrateMessage();
00663   } else if ( strncmp("ParkMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00664     return new ParkMessage();
00665   } else if ( strncmp("GotoMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00666     return new GotoMessage();
00667   } else if ( strncmp("TimedGotoMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00668     return new TimedGotoMessage();
00669   } else if ( strncmp("SetEnabledMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00670     return new SetEnabledMessage();
00671   } else if ( strncmp("SetVelocityMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00672     return new SetVelocityMessage();
00673   } else if ( strncmp("SetMarginMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
00674     return new SetMarginMessage();
00675   } else {
00676     throw UnknownTypeException("The given type '%s' does not match any known "
00677                                "message type for this interface type.", type);
00678   }
00679 }
00680
00681 
00682 /** Copy values from other interface.
00683  * @param other other interface to copy values from
00684  */
00685 void
00686 PanTiltInterface::copy_values(const Interface *other)
00687 {
00688   const PanTiltInterface *oi = dynamic_cast<const PanTiltInterface *>(other);
00689   if (oi == NULL) {
00690     throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
00691                                 type(), other->type());
00692   }
00693   memcpy(data, oi->data, sizeof(PanTiltInterface_data_t));
00694 }
00695
00696 /* =========== messages =========== */
00697 /** @class PanTiltInterface::StopMessage <interfaces/PanTiltInterface.h>
00698  * StopMessage Fawkes BlackBoard Interface Message.
00699  * 
00700     
00701  */
00702
00703 
00704 /** Constructor */
00705 PanTiltInterface::StopMessage::StopMessage() : Message("StopMessage")
00706 {
00707   data_size = 0;
00708   data_ptr  = NULL;
00709 }
00710 
00711 /** Destructor */
00712 PanTiltInterface::StopMessage::~StopMessage()
00713 {
00714 }
00715 
00716 /** Copy constructor.
00717  * @param m message to copy from
00718  */
00719 PanTiltInterface::StopMessage::StopMessage(const StopMessage *m) : Message("StopMessage")
00720 {
00721   data_size = 0;
00722   data_ptr  = NULL;
00723 }
00724
00725 /* Methods */
00726 /** Clone this message.
00727  * Produces a message of the same type as this message and copies the
00728  * data to the new message.
00729  * @return clone of this message
00730  */
00731 Message *
00732 PanTiltInterface::StopMessage::clone() const
00733 {
00734   return new PanTiltInterface::StopMessage(this);
00735 }
00736 /** @class PanTiltInterface::FlushMessage <interfaces/PanTiltInterface.h>
00737  * FlushMessage Fawkes BlackBoard Interface Message.
00738  * 
00739     
00740  */
00741
00742 
00743 /** Constructor */
00744 PanTiltInterface::FlushMessage::FlushMessage() : Message("FlushMessage")
00745 {
00746   data_size = 0;
00747   data_ptr  = NULL;
00748 }
00749 
00750 /** Destructor */
00751 PanTiltInterface::FlushMessage::~FlushMessage()
00752 {
00753 }
00754 
00755 /** Copy constructor.
00756  * @param m message to copy from
00757  */
00758 PanTiltInterface::FlushMessage::FlushMessage(const FlushMessage *m) : Message("FlushMessage")
00759 {
00760   data_size = 0;
00761   data_ptr  = NULL;
00762 }
00763
00764 /* Methods */
00765 /** Clone this message.
00766  * Produces a message of the same type as this message and copies the
00767  * data to the new message.
00768  * @return clone of this message
00769  */
00770 Message *
00771 PanTiltInterface::FlushMessage::clone() const
00772 {
00773   return new PanTiltInterface::FlushMessage(this);
00774 }
00775 /** @class PanTiltInterface::CalibrateMessage <interfaces/PanTiltInterface.h>
00776  * CalibrateMessage Fawkes BlackBoard Interface Message.
00777  * 
00778     
00779  */
00780
00781 
00782 /** Constructor */
00783 PanTiltInterface::CalibrateMessage::CalibrateMessage() : Message("CalibrateMessage")
00784 {
00785   data_size = 0;
00786   data_ptr  = NULL;
00787 }
00788 
00789 /** Destructor */
00790 PanTiltInterface::CalibrateMessage::~CalibrateMessage()
00791 {
00792 }
00793 
00794 /** Copy constructor.
00795  * @param m message to copy from
00796  */
00797 PanTiltInterface::CalibrateMessage::CalibrateMessage(const CalibrateMessage *m) : Message("CalibrateMessage")
00798 {
00799   data_size = 0;
00800   data_ptr  = NULL;
00801 }
00802
00803 /* Methods */
00804 /** Clone this message.
00805  * Produces a message of the same type as this message and copies the
00806  * data to the new message.
00807  * @return clone of this message
00808  */
00809 Message *
00810 PanTiltInterface::CalibrateMessage::clone() const
00811 {
00812   return new PanTiltInterface::CalibrateMessage(this);
00813 }
00814 /** @class PanTiltInterface::ParkMessage <interfaces/PanTiltInterface.h>
00815  * ParkMessage Fawkes BlackBoard Interface Message.
00816  * 
00817     
00818  */
00819
00820 
00821 /** Constructor */
00822 PanTiltInterface::ParkMessage::ParkMessage() : Message("ParkMessage")
00823 {
00824   data_size = 0;
00825   data_ptr  = NULL;
00826 }
00827 
00828 /** Destructor */
00829 PanTiltInterface::ParkMessage::~ParkMessage()
00830 {
00831 }
00832 
00833 /** Copy constructor.
00834  * @param m message to copy from
00835  */
00836 PanTiltInterface::ParkMessage::ParkMessage(const ParkMessage *m) : Message("ParkMessage")
00837 {
00838   data_size = 0;
00839   data_ptr  = NULL;
00840 }
00841
00842 /* Methods */
00843 /** Clone this message.
00844  * Produces a message of the same type as this message and copies the
00845  * data to the new message.
00846  * @return clone of this message
00847  */
00848 Message *
00849 PanTiltInterface::ParkMessage::clone() const
00850 {
00851   return new PanTiltInterface::ParkMessage(this);
00852 }
00853 /** @class PanTiltInterface::GotoMessage <interfaces/PanTiltInterface.h>
00854  * GotoMessage Fawkes BlackBoard Interface Message.
00855  * 
00856     
00857  */
00858
00859 
00860 /** Constructor with initial values.
00861  * @param ini_pan initial value for pan
00862  * @param ini_tilt initial value for tilt
00863  */
00864 PanTiltInterface::GotoMessage::GotoMessage(const float ini_pan, const float ini_tilt) : Message("GotoMessage")
00865 {
00866   data_size = sizeof(GotoMessage_data_t);
00867   data_ptr  = malloc(data_size);
00868   memset(data_ptr, 0, data_size);
00869   data      = (GotoMessage_data_t *)data_ptr;
00870   data->pan = ini_pan;
00871   data->tilt = ini_tilt;
00872   add_fieldinfo(IFT_FLOAT, "pan", 1, &data->pan);
00873   add_fieldinfo(IFT_FLOAT, "tilt", 1, &data->tilt);
00874 }
00875 /** Constructor */
00876 PanTiltInterface::GotoMessage::GotoMessage() : Message("GotoMessage")
00877 {
00878   data_size = sizeof(GotoMessage_data_t);
00879   data_ptr  = malloc(data_size);
00880   memset(data_ptr, 0, data_size);
00881   data      = (GotoMessage_data_t *)data_ptr;
00882   add_fieldinfo(IFT_FLOAT, "pan", 1, &data->pan);
00883   add_fieldinfo(IFT_FLOAT, "tilt", 1, &data->tilt);
00884 }
00885 
00886 /** Destructor */
00887 PanTiltInterface::GotoMessage::~GotoMessage()
00888 {
00889   free(data_ptr);
00890 }
00891 
00892 /** Copy constructor.
00893  * @param m message to copy from
00894  */
00895 PanTiltInterface::GotoMessage::GotoMessage(const GotoMessage *m) : Message("GotoMessage")
00896 {
00897   data_size = m->data_size;
00898   data_ptr  = malloc(data_size);
00899   memcpy(data_ptr, m->data_ptr, data_size);
00900   data      = (GotoMessage_data_t *)data_ptr;
00901 }
00902
00903 /* Methods */
00904 /** Get pan value.
00905  * Current pan.
00906  * @return pan value
00907  */
00908 float
00909 PanTiltInterface::GotoMessage::pan() const
00910 {
00911   return data->pan;
00912 }
00913 
00914 /** Get maximum length of pan value.
00915  * @return length of pan value, can be length of the array or number of 
00916  * maximum number of characters for a string
00917  */
00918 size_t
00919 PanTiltInterface::GotoMessage::maxlenof_pan() const
00920 {
00921   return 1;
00922 }
00923 
00924 /** Set pan value.
00925  * Current pan.
00926  * @param new_pan new pan value
00927  */
00928 void
00929 PanTiltInterface::GotoMessage::set_pan(const float new_pan)
00930 {
00931   data->pan = new_pan;
00932 }
00933 
00934 /** Get tilt value.
00935  * Current tilt.
00936  * @return tilt value
00937  */
00938 float
00939 PanTiltInterface::GotoMessage::tilt() const
00940 {
00941   return data->tilt;
00942 }
00943 
00944 /** Get maximum length of tilt value.
00945  * @return length of tilt value, can be length of the array or number of 
00946  * maximum number of characters for a string
00947  */
00948 size_t
00949 PanTiltInterface::GotoMessage::maxlenof_tilt() const
00950 {
00951   return 1;
00952 }
00953 
00954 /** Set tilt value.
00955  * Current tilt.
00956  * @param new_tilt new tilt value
00957  */
00958 void
00959 PanTiltInterface::GotoMessage::set_tilt(const float new_tilt)
00960 {
00961   data->tilt = new_tilt;
00962 }
00963 
00964 /** Clone this message.
00965  * Produces a message of the same type as this message and copies the
00966  * data to the new message.
00967  * @return clone of this message
00968  */
00969 Message *
00970 PanTiltInterface::GotoMessage::clone() const
00971 {
00972   return new PanTiltInterface::GotoMessage(this);
00973 }
00974 /** @class PanTiltInterface::TimedGotoMessage <interfaces/PanTiltInterface.h>
00975  * TimedGotoMessage Fawkes BlackBoard Interface Message.
00976  * 
00977     
00978  */
00979
00980 
00981 /** Constructor with initial values.
00982  * @param ini_time_sec initial value for time_sec
00983  * @param ini_pan initial value for pan
00984  * @param ini_tilt initial value for tilt
00985  */
00986 PanTiltInterface::TimedGotoMessage::TimedGotoMessage(const float ini_time_sec, const float ini_pan, const float ini_tilt) : Message("TimedGotoMessage")
00987 {
00988   data_size = sizeof(TimedGotoMessage_data_t);
00989   data_ptr  = malloc(data_size);
00990   memset(data_ptr, 0, data_size);
00991   data      = (TimedGotoMessage_data_t *)data_ptr;
00992   data->time_sec = ini_time_sec;
00993   data->pan = ini_pan;
00994   data->tilt = ini_tilt;
00995   add_fieldinfo(IFT_FLOAT, "time_sec", 1, &data->time_sec);
00996   add_fieldinfo(IFT_FLOAT, "pan", 1, &data->pan);
00997   add_fieldinfo(IFT_FLOAT, "tilt", 1, &data->tilt);
00998 }
00999 /** Constructor */
01000 PanTiltInterface::TimedGotoMessage::TimedGotoMessage() : Message("TimedGotoMessage")
01001 {
01002   data_size = sizeof(TimedGotoMessage_data_t);
01003   data_ptr  = malloc(data_size);
01004   memset(data_ptr, 0, data_size);
01005   data      = (TimedGotoMessage_data_t *)data_ptr;
01006   add_fieldinfo(IFT_FLOAT, "time_sec", 1, &data->time_sec);
01007   add_fieldinfo(IFT_FLOAT, "pan", 1, &data->pan);
01008   add_fieldinfo(IFT_FLOAT, "tilt", 1, &data->tilt);
01009 }
01010 
01011 /** Destructor */
01012 PanTiltInterface::TimedGotoMessage::~TimedGotoMessage()
01013 {
01014   free(data_ptr);
01015 }
01016 
01017 /** Copy constructor.
01018  * @param m message to copy from
01019  */
01020 PanTiltInterface::TimedGotoMessage::TimedGotoMessage(const TimedGotoMessage *m) : Message("TimedGotoMessage")
01021 {
01022   data_size = m->data_size;
01023   data_ptr  = malloc(data_size);
01024   memcpy(data_ptr, m->data_ptr, data_size);
01025   data      = (TimedGotoMessage_data_t *)data_ptr;
01026 }
01027
01028 /* Methods */
01029 /** Get time_sec value.
01030  * Time in seconds when to reach
01031     the final position.
01032  * @return time_sec value
01033  */
01034 float
01035 PanTiltInterface::TimedGotoMessage::time_sec() const
01036 {
01037   return data->time_sec;
01038 }
01039 
01040 /** Get maximum length of time_sec value.
01041  * @return length of time_sec value, can be length of the array or number of 
01042  * maximum number of characters for a string
01043  */
01044 size_t
01045 PanTiltInterface::TimedGotoMessage::maxlenof_time_sec() const
01046 {
01047   return 1;
01048 }
01049 
01050 /** Set time_sec value.
01051  * Time in seconds when to reach
01052     the final position.
01053  * @param new_time_sec new time_sec value
01054  */
01055 void
01056 PanTiltInterface::TimedGotoMessage::set_time_sec(const float new_time_sec)
01057 {
01058   data->time_sec = new_time_sec;
01059 }
01060 
01061 /** Get pan value.
01062  * Current pan.
01063  * @return pan value
01064  */
01065 float
01066 PanTiltInterface::TimedGotoMessage::pan() const
01067 {
01068   return data->pan;
01069 }
01070 
01071 /** Get maximum length of pan value.
01072  * @return length of pan value, can be length of the array or number of 
01073  * maximum number of characters for a string
01074  */
01075 size_t
01076 PanTiltInterface::TimedGotoMessage::maxlenof_pan() const
01077 {
01078   return 1;
01079 }
01080 
01081 /** Set pan value.
01082  * Current pan.
01083  * @param new_pan new pan value
01084  */
01085 void
01086 PanTiltInterface::TimedGotoMessage::set_pan(const float new_pan)
01087 {
01088   data->pan = new_pan;
01089 }
01090 
01091 /** Get tilt value.
01092  * Current tilt.
01093  * @return tilt value
01094  */
01095 float
01096 PanTiltInterface::TimedGotoMessage::tilt() const
01097 {
01098   return data->tilt;
01099 }
01100 
01101 /** Get maximum length of tilt value.
01102  * @return length of tilt value, can be length of the array or number of 
01103  * maximum number of characters for a string
01104  */
01105 size_t
01106 PanTiltInterface::TimedGotoMessage::maxlenof_tilt() const
01107 {
01108   return 1;
01109 }
01110 
01111 /** Set tilt value.
01112  * Current tilt.
01113  * @param new_tilt new tilt value
01114  */
01115 void
01116 PanTiltInterface::TimedGotoMessage::set_tilt(const float new_tilt)
01117 {
01118   data->tilt = new_tilt;
01119 }
01120 
01121 /** Clone this message.
01122  * Produces a message of the same type as this message and copies the
01123  * data to the new message.
01124  * @return clone of this message
01125  */
01126 Message *
01127 PanTiltInterface::TimedGotoMessage::clone() const
01128 {
01129   return new PanTiltInterface::TimedGotoMessage(this);
01130 }
01131 /** @class PanTiltInterface::SetEnabledMessage <interfaces/PanTiltInterface.h>
01132  * SetEnabledMessage Fawkes BlackBoard Interface Message.
01133  * 
01134     
01135  */
01136
01137 
01138 /** Constructor with initial values.
01139  * @param ini_enabled initial value for enabled
01140  */
01141 PanTiltInterface::SetEnabledMessage::SetEnabledMessage(const bool ini_enabled) : Message("SetEnabledMessage")
01142 {
01143   data_size = sizeof(SetEnabledMessage_data_t);
01144   data_ptr  = malloc(data_size);
01145   memset(data_ptr, 0, data_size);
01146   data      = (SetEnabledMessage_data_t *)data_ptr;
01147   data->enabled = ini_enabled;
01148   add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
01149 }
01150 /** Constructor */
01151 PanTiltInterface::SetEnabledMessage::SetEnabledMessage() : Message("SetEnabledMessage")
01152 {
01153   data_size = sizeof(SetEnabledMessage_data_t);
01154   data_ptr  = malloc(data_size);
01155   memset(data_ptr, 0, data_size);
01156   data      = (SetEnabledMessage_data_t *)data_ptr;
01157   add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled);
01158 }
01159 
01160 /** Destructor */
01161 PanTiltInterface::SetEnabledMessage::~SetEnabledMessage()
01162 {
01163   free(data_ptr);
01164 }
01165 
01166 /** Copy constructor.
01167  * @param m message to copy from
01168  */
01169 PanTiltInterface::SetEnabledMessage::SetEnabledMessage(const SetEnabledMessage *m) : Message("SetEnabledMessage")
01170 {
01171   data_size = m->data_size;
01172   data_ptr  = malloc(data_size);
01173   memcpy(data_ptr, m->data_ptr, data_size);
01174   data      = (SetEnabledMessage_data_t *)data_ptr;
01175 }
01176
01177 /* Methods */
01178 /** Get enabled value.
01179  * Is the pan/tilt unit enabled?
01180  * @return enabled value
01181  */
01182 bool
01183 PanTiltInterface::SetEnabledMessage::is_enabled() const
01184 {
01185   return data->enabled;
01186 }
01187 
01188 /** Get maximum length of enabled value.
01189  * @return length of enabled value, can be length of the array or number of 
01190  * maximum number of characters for a string
01191  */
01192 size_t
01193 PanTiltInterface::SetEnabledMessage::maxlenof_enabled() const
01194 {
01195   return 1;
01196 }
01197 
01198 /** Set enabled value.
01199  * Is the pan/tilt unit enabled?
01200  * @param new_enabled new enabled value
01201  */
01202 void
01203 PanTiltInterface::SetEnabledMessage::set_enabled(const bool new_enabled)
01204 {
01205   data->enabled = new_enabled;
01206 }
01207 
01208 /** Clone this message.
01209  * Produces a message of the same type as this message and copies the
01210  * data to the new message.
01211  * @return clone of this message
01212  */
01213 Message *
01214 PanTiltInterface::SetEnabledMessage::clone() const
01215 {
01216   return new PanTiltInterface::SetEnabledMessage(this);
01217 }
01218 /** @class PanTiltInterface::SetVelocityMessage <interfaces/PanTiltInterface.h>
01219  * SetVelocityMessage Fawkes BlackBoard Interface Message.
01220  * 
01221     
01222  */
01223
01224 
01225 /** Constructor with initial values.
01226  * @param ini_pan_velocity initial value for pan_velocity
01227  * @param ini_tilt_velocity initial value for tilt_velocity
01228  */
01229 PanTiltInterface::SetVelocityMessage::SetVelocityMessage(const float ini_pan_velocity, const float ini_tilt_velocity) : Message("SetVelocityMessage")
01230 {
01231   data_size = sizeof(SetVelocityMessage_data_t);
01232   data_ptr  = malloc(data_size);
01233   memset(data_ptr, 0, data_size);
01234   data      = (SetVelocityMessage_data_t *)data_ptr;
01235   data->pan_velocity = ini_pan_velocity;
01236   data->tilt_velocity = ini_tilt_velocity;
01237   add_fieldinfo(IFT_FLOAT, "pan_velocity", 1, &data->pan_velocity);
01238   add_fieldinfo(IFT_FLOAT, "tilt_velocity", 1, &data->tilt_velocity);
01239 }
01240 /** Constructor */
01241 PanTiltInterface::SetVelocityMessage::SetVelocityMessage() : Message("SetVelocityMessage")
01242 {
01243   data_size = sizeof(SetVelocityMessage_data_t);
01244   data_ptr  = malloc(data_size);
01245   memset(data_ptr, 0, data_size);
01246   data      = (SetVelocityMessage_data_t *)data_ptr;
01247   add_fieldinfo(IFT_FLOAT, "pan_velocity", 1, &data->pan_velocity);
01248   add_fieldinfo(IFT_FLOAT, "tilt_velocity", 1, &data->tilt_velocity);
01249 }
01250 
01251 /** Destructor */
01252 PanTiltInterface::SetVelocityMessage::~SetVelocityMessage()
01253 {
01254   free(data_ptr);
01255 }
01256 
01257 /** Copy constructor.
01258  * @param m message to copy from
01259  */
01260 PanTiltInterface::SetVelocityMessage::SetVelocityMessage(const SetVelocityMessage *m) : Message("SetVelocityMessage")
01261 {
01262   data_size = m->data_size;
01263   data_ptr  = malloc(data_size);
01264   memcpy(data_ptr, m->data_ptr, data_size);
01265   data      = (SetVelocityMessage_data_t *)data_ptr;
01266 }
01267
01268 /* Methods */
01269 /** Get pan_velocity value.
01270  * Maximum pan velocity currently reached.
01271  * @return pan_velocity value
01272  */
01273 float
01274 PanTiltInterface::SetVelocityMessage::pan_velocity() const
01275 {
01276   return data->pan_velocity;
01277 }
01278 
01279 /** Get maximum length of pan_velocity value.
01280  * @return length of pan_velocity value, can be length of the array or number of 
01281  * maximum number of characters for a string
01282  */
01283 size_t
01284 PanTiltInterface::SetVelocityMessage::maxlenof_pan_velocity() const
01285 {
01286   return 1;
01287 }
01288 
01289 /** Set pan_velocity value.
01290  * Maximum pan velocity currently reached.
01291  * @param new_pan_velocity new pan_velocity value
01292  */
01293 void
01294 PanTiltInterface::SetVelocityMessage::set_pan_velocity(const float new_pan_velocity)
01295 {
01296   data->pan_velocity = new_pan_velocity;
01297 }
01298 
01299 /** Get tilt_velocity value.
01300  * Maximum tilt velocity currently reached.
01301  * @return tilt_velocity value
01302  */
01303 float
01304 PanTiltInterface::SetVelocityMessage::tilt_velocity() const
01305 {
01306   return data->tilt_velocity;
01307 }
01308 
01309 /** Get maximum length of tilt_velocity value.
01310  * @return length of tilt_velocity value, can be length of the array or number of 
01311  * maximum number of characters for a string
01312  */
01313 size_t
01314 PanTiltInterface::SetVelocityMessage::maxlenof_tilt_velocity() const
01315 {
01316   return 1;
01317 }
01318 
01319 /** Set tilt_velocity value.
01320  * Maximum tilt velocity currently reached.
01321  * @param new_tilt_velocity new tilt_velocity value
01322  */
01323 void
01324 PanTiltInterface::SetVelocityMessage::set_tilt_velocity(const float new_tilt_velocity)
01325 {
01326   data->tilt_velocity = new_tilt_velocity;
01327 }
01328 
01329 /** Clone this message.
01330  * Produces a message of the same type as this message and copies the
01331  * data to the new message.
01332  * @return clone of this message
01333  */
01334 Message *
01335 PanTiltInterface::SetVelocityMessage::clone() const
01336 {
01337   return new PanTiltInterface::SetVelocityMessage(this);
01338 }
01339 /** @class PanTiltInterface::SetMarginMessage <interfaces/PanTiltInterface.h>
01340  * SetMarginMessage Fawkes BlackBoard Interface Message.
01341  * 
01342     
01343  */
01344
01345 
01346 /** Constructor with initial values.
01347  * @param ini_pan_margin initial value for pan_margin
01348  * @param ini_tilt_margin initial value for tilt_margin
01349  */
01350 PanTiltInterface::SetMarginMessage::SetMarginMessage(const float ini_pan_margin, const float ini_tilt_margin) : Message("SetMarginMessage")
01351 {
01352   data_size = sizeof(SetMarginMessage_data_t);
01353   data_ptr  = malloc(data_size);
01354   memset(data_ptr, 0, data_size);
01355   data      = (SetMarginMessage_data_t *)data_ptr;
01356   data->pan_margin = ini_pan_margin;
01357   data->tilt_margin = ini_tilt_margin;
01358   add_fieldinfo(IFT_FLOAT, "pan_margin", 1, &data->pan_margin);
01359   add_fieldinfo(IFT_FLOAT, "tilt_margin", 1, &data->tilt_margin);
01360 }
01361 /** Constructor */
01362 PanTiltInterface::SetMarginMessage::SetMarginMessage() : Message("SetMarginMessage")
01363 {
01364   data_size = sizeof(SetMarginMessage_data_t);
01365   data_ptr  = malloc(data_size);
01366   memset(data_ptr, 0, data_size);
01367   data      = (SetMarginMessage_data_t *)data_ptr;
01368   add_fieldinfo(IFT_FLOAT, "pan_margin", 1, &data->pan_margin);
01369   add_fieldinfo(IFT_FLOAT, "tilt_margin", 1, &data->tilt_margin);
01370 }
01371 
01372 /** Destructor */
01373 PanTiltInterface::SetMarginMessage::~SetMarginMessage()
01374 {
01375   free(data_ptr);
01376 }
01377 
01378 /** Copy constructor.
01379  * @param m message to copy from
01380  */
01381 PanTiltInterface::SetMarginMessage::SetMarginMessage(const SetMarginMessage *m) : Message("SetMarginMessage")
01382 {
01383   data_size = m->data_size;
01384   data_ptr  = malloc(data_size);
01385   memcpy(data_ptr, m->data_ptr, data_size);
01386   data      = (SetMarginMessage_data_t *)data_ptr;
01387 }
01388
01389 /* Methods */
01390 /** Get pan_margin value.
01391  * Margin in radians around a
01392     target pan value to consider the motion as final.
01393  * @return pan_margin value
01394  */
01395 float
01396 PanTiltInterface::SetMarginMessage::pan_margin() const
01397 {
01398   return data->pan_margin;
01399 }
01400 
01401 /** Get maximum length of pan_margin value.
01402  * @return length of pan_margin value, can be length of the array or number of 
01403  * maximum number of characters for a string
01404  */
01405 size_t
01406 PanTiltInterface::SetMarginMessage::maxlenof_pan_margin() const
01407 {
01408   return 1;
01409 }
01410 
01411 /** Set pan_margin value.
01412  * Margin in radians around a
01413     target pan value to consider the motion as final.
01414  * @param new_pan_margin new pan_margin value
01415  */
01416 void
01417 PanTiltInterface::SetMarginMessage::set_pan_margin(const float new_pan_margin)
01418 {
01419   data->pan_margin = new_pan_margin;
01420 }
01421 
01422 /** Get tilt_margin value.
01423  * Margin in radians around a
01424     target tilt value to consider the motion as final.
01425  * @return tilt_margin value
01426  */
01427 float
01428 PanTiltInterface::SetMarginMessage::tilt_margin() const
01429 {
01430   return data->tilt_margin;
01431 }
01432 
01433 /** Get maximum length of tilt_margin value.
01434  * @return length of tilt_margin value, can be length of the array or number of 
01435  * maximum number of characters for a string
01436  */
01437 size_t
01438 PanTiltInterface::SetMarginMessage::maxlenof_tilt_margin() const
01439 {
01440   return 1;
01441 }
01442 
01443 /** Set tilt_margin value.
01444  * Margin in radians around a
01445     target tilt value to consider the motion as final.
01446  * @param new_tilt_margin new tilt_margin value
01447  */
01448 void
01449 PanTiltInterface::SetMarginMessage::set_tilt_margin(const float new_tilt_margin)
01450 {
01451   data->tilt_margin = new_tilt_margin;
01452 }
01453 
01454 /** Clone this message.
01455  * Produces a message of the same type as this message and copies the
01456  * data to the new message.
01457  * @return clone of this message
01458  */
01459 Message *
01460 PanTiltInterface::SetMarginMessage::clone() const
01461 {
01462   return new PanTiltInterface::SetMarginMessage(this);
01463 }
01464 /** Check if message is valid and can be enqueued.
01465  * @param message Message to check
01466  */
01467 bool
01468 PanTiltInterface::message_valid(const Message *message) const
01469 {
01470   const StopMessage *m0 = dynamic_cast<const StopMessage *>(message);
01471   if ( m0 != NULL ) {
01472     return true;
01473   }
01474   const FlushMessage *m1 = dynamic_cast<const FlushMessage *>(message);
01475   if ( m1 != NULL ) {
01476     return true;
01477   }
01478   const CalibrateMessage *m2 = dynamic_cast<const CalibrateMessage *>(message);
01479   if ( m2 != NULL ) {
01480     return true;
01481   }
01482   const ParkMessage *m3 = dynamic_cast<const ParkMessage *>(message);
01483   if ( m3 != NULL ) {
01484     return true;
01485   }
01486   const GotoMessage *m4 = dynamic_cast<const GotoMessage *>(message);
01487   if ( m4 != NULL ) {
01488     return true;
01489   }
01490   const TimedGotoMessage *m5 = dynamic_cast<const TimedGotoMessage *>(message);
01491   if ( m5 != NULL ) {
01492     return true;
01493   }
01494   const SetEnabledMessage *m6 = dynamic_cast<const SetEnabledMessage *>(message);
01495   if ( m6 != NULL ) {
01496     return true;
01497   }
01498   const SetVelocityMessage *m7 = dynamic_cast<const SetVelocityMessage *>(message);
01499   if ( m7 != NULL ) {
01500     return true;
01501   }
01502   const SetMarginMessage *m8 = dynamic_cast<const SetMarginMessage *>(message);
01503   if ( m8 != NULL ) {
01504     return true;
01505   }
01506   return false;
01507 }
01508 
01509 /// @cond INTERNALS
01510 EXPORT_INTERFACE(PanTiltInterface)
01511 /// @endcond
01512 
01513
01514 } // end namespace fawkes