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_arm_driver_h_ 00026 #define _tibi_dabo_arm_driver_h_ 00027 00028 #include <iri_base_driver/iri_base_driver.h> 00029 #include <tibi_dabo_arm_node/TibiDaboArmConfig.h> 00030 00031 //include tibi_dabo_arm_driver main library 00032 #include "segway_arm.h" 00033 #include "motion_sequence.h" 00034 00035 extern std::string config_path; 00036 extern std::string motion_path; 00037 00057 class TibiDaboArmDriver : public iri_base_driver::IriBaseDriver 00058 { 00059 private: 00060 // private attributes and methods 00061 CSegwayArm arm_driver; 00062 CMotionSequence *motion_sequence; 00063 // dynamic reconfigure variables 00064 std::string arm_config_file; 00065 std::string xml_path; 00066 // list of available XML files 00067 std::vector<std::string> config_files; 00068 std::vector<std::string> motion_seq_files; 00069 // configuration variables 00070 int feedback_rate; 00071 bool absolute_motion; 00072 bool position_control; 00073 protected: 00074 void scan_XML_files(void); 00075 public: 00082 typedef tibi_dabo_arm_node::TibiDaboArmConfig Config; 00083 00090 Config config_; 00091 00100 TibiDaboArmDriver(); 00101 00112 bool openDriver(void); 00113 00124 bool closeDriver(void); 00125 00136 bool startDriver(void); 00137 00148 bool stopDriver(void); 00149 00161 void config_update(Config& new_cfg, uint32_t level=0); 00162 00163 // here define all tibi_dabo_arm_driver interface methods to retrieve and set 00164 // the driver parameters 00165 // API for the motion sequences 00170 void start_motion_sequence(std::string &filename); 00175 void start_motion_sequence(std::vector<TMotionStep> &seq); 00180 void pause_motion_sequence(void); 00185 void resume_motion_sequence(void); 00190 void stop_motion_sequence(void); 00195 std::string get_motion_sequence_complete_event_id(void); 00200 std::string get_motion_sequence_error_event_id(void); 00205 std::string get_motion_sequence_error_message(void); 00210 float get_motion_sequence_completed_percentage(void); 00211 // API for the discete motions 00216 std::string get_position_reached_event_id(void); 00221 void move(std::vector<float> &position,std::vector<float> &velocity,std::vector<float> &acceleration); 00226 void stop(void); 00231 void get_position(std::vector<float> &position); 00236 void get_velocity(std::vector<float> &velocity); 00241 void set_absolute_motion(bool status); 00246 void set_position_control(bool status); 00251 bool using_position_control(void); 00256 bool using_absolute_motion(void); 00257 // functions to handle the XML files 00262 unsigned int get_num_config_files(void); 00267 std::string get_config_file(unsigned int index); 00272 unsigned int get_num_motion_seq_files(void); 00277 std::string get_motion_seq_file(unsigned int index); 00282 int get_feedback_rate(void); 00289 ~TibiDaboArmDriver(); 00290 }; 00291 00292 #endif