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_driver_h_ 00026 #define _tibi_dabo_head_driver_h_ 00027 00028 #include <iri_base_driver/iri_base_driver.h> 00029 #include <tibi_dabo_head_node/TibiDaboHeadConfig.h> 00030 00031 //include tibi_dabo_head_driver main library 00032 #include "segway_head.h" 00033 00034 extern std::string config_path; 00035 extern std::string motion_path; 00036 00056 class TibiDaboHeadDriver : public iri_base_driver::IriBaseDriver 00057 { 00058 private: 00059 // private attributes and methods 00060 CSegwayHead *head_driver; 00061 // dynamic reconfigure variables 00062 std::string head_config_file; 00063 std::string xml_path; 00064 // list of available XML files 00065 std::vector<std::string> config_files; 00066 std::vector<std::string> motion_seq_files; 00067 // configuration variables 00068 int feedback_rate; 00069 protected: 00070 void scan_XML_files(void); 00071 public: 00078 typedef tibi_dabo_head_node::TibiDaboHeadConfig Config; 00079 00086 Config config_; 00087 00096 TibiDaboHeadDriver(); 00097 00108 bool openDriver(void); 00109 00120 bool closeDriver(void); 00121 00132 bool startDriver(void); 00133 00144 bool stopDriver(void); 00145 00157 void config_update(Config& new_cfg, uint32_t level=0); 00158 00159 // here define all tibi_dabo_head_driver interface methods to retrieve and set 00160 // the driver parameters 00161 // API for the motion sequences 00166 void start_motion_sequence(std::string &filename); 00171 void start_motion_sequence(std::vector<TDynamixelMotionStep> &seq); 00176 void pause_motion_sequence(void); 00181 void resume_motion_sequence(void); 00186 void stop_motion_sequence(void); 00191 std::string get_motion_sequence_complete_event_id(void); 00196 std::string get_motion_sequence_error_event_id(void); 00201 std::string get_motion_sequence_error_message(void); 00206 float get_motion_sequence_completed_percentage(void); 00207 // API for the discete motions 00212 void move_absolute_angle(std::vector<double> &position,std::vector<double> &velocity); 00217 void move_relative_angle(std::vector<double> &position,std::vector<double> &velocity); 00222 void stop(void); 00227 void get_position(std::vector<double> &position); 00232 void get_velocity(std::vector<double> &velocity); 00233 // face expressions API 00238 void set_face_expression(std::string &expression); 00243 void set_face_expression(int index); 00248 void set_brightness(float brightness); 00249 // functions to handle the XML files 00254 unsigned int get_num_config_files(void); 00259 std::string get_config_file(unsigned int index); 00264 unsigned int get_num_motion_seq_files(void); 00269 std::string get_motion_seq_file(unsigned int index); 00274 int get_feedback_rate(void); 00281 ~TibiDaboHeadDriver(); 00282 }; 00283 00284 #endif