00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC. 00002 // Author Sergi Hernandez & Joan Perez 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 _segway_rmp200_driver_h_ 00026 #define _segway_rmp200_driver_h_ 00027 00028 #include <iri_base_driver/iri_base_driver.h> 00029 #include <iri_segway_rmp200/SegwayRmp200Config.h> 00030 #include "exceptions.h" 00031 00032 //include segway_rmp200_driver main library 00033 #include "segway_rmp200.h" 00034 #include "segway_rmp200_status.h" 00035 00036 namespace segway_rmp200_node 00037 { 00038 00058 class SegwayRmp200Driver : public iri_base_driver::IriBaseDriver 00059 { 00060 private: 00061 // private attributes and methods 00062 CSegwayRMP200 *segway_; 00063 CFTDIServer *ftdi_server_; 00064 std::string serial_number_; 00065 std::list<std::string> events_; 00066 00067 public: 00068 enum segway_events_enum {NO_USB=0, POWER_OFF, NO_HEART_BEAT, NEW_STATUS}; 00069 00076 typedef iri_segway_rmp200::SegwayRmp200Config Config; 00077 00084 Config config_; 00085 00094 SegwayRmp200Driver(); 00095 00106 bool openDriver(void); 00107 00118 bool closeDriver(void); 00119 00130 bool startDriver(void); 00131 00142 bool stopDriver(void); 00143 00155 void config_update(Config& new_cfg, uint32_t level=0); 00156 00157 // here define all segway_rmp200_driver interface methods to retrieve and set 00158 // the driver parameters 00159 iri_segway_rmp_msgs::SegwayRMP200Status get_status(void); 00160 float get_pitch_angle(void); 00161 float get_pitch_rate(void); 00162 float get_roll_angle(void); 00163 float get_roll_rate(void); 00164 float get_left_wheel_velocity(void); 00165 float get_right_wheel_velocity(void); 00166 float get_yaw_rate(void); 00167 float get_uptime(void); 00168 float get_left_wheel_displacement(void); 00169 float get_right_wheel_displacement(void); 00170 float get_forward_displacement(void); 00171 float get_yaw_displacement(void); 00172 float get_left_motor_torque(void); 00173 float get_right_motor_torque(void); 00174 op_mode get_operation_mode(void); 00175 gain get_gain_schedule(void); 00176 float get_ui_battery_voltage(void); 00177 float get_powerbase_battery_voltage(void); 00178 void reset(void); 00179 void move_platform(float vT, float vR); 00180 void stop_platform(void); 00181 const std::list<std::string> & getSegwayEvents() const; 00182 void setSegwayEvents(void); 00183 static const std::string & getSegwayEventName(const unsigned int & ev); 00184 00191 ~SegwayRmp200Driver(); 00192 }; 00193 00194 } // end of namespace 00195 00196 #endif