calib_thread.cpp

00001 
00002 /***************************************************************************
00003  *  calib_thread.cpp - Katana calibration one-time thread
00004  *
00005  *  Created: Tue Jun 09 18:37:02 2009
00006  *  Copyright  2006-2009  Tim Niemueller [www.niemueller.de]
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.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #include "calib_thread.h"
00024 
00025 #include <kniBase.h>
00026 
00027 /** @class KatanaCalibrationThread "calib_thread.h"
00028  * Katana calibration thread.
00029  * This thread calibrates the arm when started and is finished when the calibration
00030  * is done.
00031  * @author Tim Niemueller
00032  */
00033 
00034 /** Constructor.
00035  * @param katana katana linear motion base class
00036  * @param logger logger
00037  */
00038 KatanaCalibrationThread::KatanaCalibrationThread(fawkes::RefPtr<CLMBase> katana,
00039                                                  fawkes::Logger *logger)
00040   : KatanaMotionThread("KatanaCalibrationThread", katana, logger)
00041 {
00042 }
00043 
00044 void
00045 KatanaCalibrationThread::once()
00046 {
00047   try {
00048     _katana->calibrate();
00049     _logger->log_debug(name(), "Calibration successful");
00050   } catch (/*KNI*/::Exception &e) {
00051     _logger->log_warn(name(), "Calibration failed (ignoring error): %s", e.what());
00052     _error_code = fawkes::KatanaInterface::ERROR_CMD_START_FAILED;
00053   }
00054   _finished = true;
00055 }

Generated on Tue Feb 22 13:32:30 2011 for Fawkes API by  doxygen 1.4.7