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_arm_node_driver_h_ 00026 #define _tibi_arm_node_driver_h_ 00027 00028 #include <iri_base_driver/iri_base_driver.h> 00029 #include <tibi_arm_node/TibiArmNodeConfig.h> 00030 00031 //include tibi_arm_node_driver main library 00032 #include "ptu_d46.h" 00033 00034 extern std::string config_path; 00035 extern std::string motion_path; 00036 00056 class TibiArmNodeDriver : public iri_base_driver::IriBaseDriver 00057 { 00058 private: 00059 // private attributes and methods 00060 // private attributes and methods 00061 CPTUD46 *arm_driver; 00062 // dynamic reconfigure variables 00063 std::string arm_config_file; 00064 std::string xml_path; 00065 // list of available XML files 00066 std::vector<std::string> config_files; 00067 std::vector<std::string> motion_seq_files; 00068 // configuration variables 00069 int feedback_rate; 00070 protected: 00071 void scan_XML_files(void); 00072 public: 00079 typedef tibi_arm_node::TibiArmNodeConfig Config; 00080 00087 Config config_; 00088 00097 TibiArmNodeDriver(void); 00098 00109 bool openDriver(void); 00110 00121 bool closeDriver(void); 00122 00133 bool startDriver(void); 00134 00145 bool stopDriver(void); 00146 00158 void config_update(Config& new_cfg, uint32_t level=0); 00159 00160 // here define all tibi_arm_node_driver interface methods to retrieve and set 00161 // the driver parameters 00162 // API for the motion sequences 00167 void start_motion_sequence(std::string &filename); 00172 void start_motion_sequence(std::vector<TPTUD46MotionStep> &seq); 00177 void pause_motion_sequence(void); 00182 void resume_motion_sequence(void); 00187 void stop_motion_sequence(void); 00192 std::string get_motion_sequence_complete_event_id(void); 00197 std::string get_motion_sequence_error_event_id(void); 00202 std::string get_motion_sequence_error_message(void); 00207 float get_motion_sequence_completed_percentage(void); 00208 // API for the discete motions 00213 void move_absolute_angle(std::vector<double> &position,std::vector<double> &velocity); 00218 void move_relative_angle(std::vector<double> &position,std::vector<double> &velocity); 00223 void stop(void); 00228 void get_position(std::vector<double> &position); 00233 void get_velocity(std::vector<double> &velocity); 00234 // functions to handle the XML files 00239 unsigned int get_num_config_files(void); 00244 std::string get_config_file(unsigned int index); 00249 unsigned int get_num_motion_seq_files(void); 00254 std::string get_motion_seq_file(unsigned int index); 00259 int get_feedback_rate(void); 00266 ~TibiArmNodeDriver(void); 00267 }; 00268 00269 #endif