00001 /* 00002 * Copyright (c) 2013, Shadow Robot Company, All rights reserved. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 3.0 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library. 00016 */ 00017 00025 #ifndef SR_RONEX_GENERAL_IO_POSITION_MAPPING_H_ 00026 #define SR_RONEX_GENERAL_IO_POSITION_MAPPING_H_ 00027 00028 #include <sr_ronex_hardware_interface/mk2_gio_hardware_interface.hpp> 00029 #include "sr_ronex_transmissions/mapping/ronex_mapping.hpp" 00030 00031 namespace ronex 00032 { 00033 namespace mapping 00034 { 00035 namespace general_io 00036 { 00037 class AnalogueToPosition 00038 : public RonexMapping 00039 { 00040 public: 00041 AnalogueToPosition(TiXmlElement* mapping_el, ros_ethercat_model::RobotState* robot); 00042 00048 virtual void propagateFromRonex(ros_ethercat_model::JointState *js); 00049 00053 virtual void propagateToRonex(ros_ethercat_model::JointState *js) {}; 00054 00055 protected: 00057 GeneralIO* general_io_; 00059 size_t pin_index_; 00061 bool pin_out_of_bound_; 00062 00064 double scale_, offset_; 00065 00070 double compute_scaled_data_(); 00071 00076 bool check_pin_in_bound_(); 00077 00078 virtual bool try_init_cb_(const ros::TimerEvent&, TiXmlElement* mapping_el, ros_ethercat_model::RobotState* robot, const char* ronex_name); 00079 }; 00080 } 00081 } 00082 } 00083 /* For the emacs weenies in the crowd. 00084 Local Variables: 00085 c-basic-offset: 2 00086 End: 00087 */ 00088 00089 #endif /* SR_RONEX_GENERAL_IO_POSITION_MAPPING_H_ */