tibi_dabo_head_tracking_alg.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author 
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 // 
00019 // IMPORTANT NOTE: This code has been generated through a script from the 
00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness
00021 // of the scripts. ROS topics can be easly add by using those scripts. Please
00022 // refer to the IRI wiki page for more information:
00023 // http://wikiri.upc.es/index.php/Robotics_Lab
00024 
00025 #ifndef _tibi_dabo_head_tracking_alg_h_
00026 #define _tibi_dabo_head_tracking_alg_h_
00027 
00028 #include <tibi_dabo_head_tracking/TibiDaboHeadTrackingConfig.h>
00029 #include "mutex.h"
00030 
00031 typedef struct
00032 {
00033   float P;
00034   float I;
00035   float D;
00036 }TPID;
00037 
00038 //include tibi_dabo_head_tracking_alg main library
00039 
00045 class TibiDaboHeadTrackingAlgorithm
00046 {
00047   protected:
00054     CMutex alg_mutex_;
00055 
00056     // private attributes and methods
00057     float current_pan;
00058     float current_tilt;
00059 
00060     TPID pan_control;
00061     TPID tilt_control;
00062   
00063     float max_pan_angle;
00064     float min_pan_angle;
00065     float max_tilt_angle;
00066     float min_tilt_angle;
00067 
00068     float pan_error;
00069     float tilt_error;
00070 
00071     int mode;
00072 
00073   public:
00080     typedef tibi_dabo_head_tracking::TibiDaboHeadTrackingConfig Config;
00081 
00088     Config config_;
00089 
00098     TibiDaboHeadTrackingAlgorithm(void);
00099 
00105     void lock(void) { alg_mutex_.enter(); };
00106 
00112     void unlock(void) { alg_mutex_.exit(); };
00113 
00121     bool try_enter(void) { return alg_mutex_.try_enter(); };
00122 
00134     void config_update(Config& new_cfg, uint32_t level=0);
00135 
00136     // here define all tibi_dabo_head_tracking_alg interface methods to retrieve and set
00137     // the driver parameters
00138     void compute_head_position(float target_pan,float target_tilt,float *pan, float *tilt);
00139     void set_current_head_position(float pan, float tilt);
00140     void get_current_error(float *pan_error,float *tilt_error);
00141 
00148     ~TibiDaboHeadTrackingAlgorithm(void);
00149 };
00150 
00151 #endif


tibi_dabo_head_tracking
Author(s): Sergi Hernandez Juan
autogenerated on Fri Dec 6 2013 22:00:28