command_to_pwm.hpp
Go to the documentation of this file.
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 
00024 #ifndef SR_RONEX_GENERAL_IO_COMMAND_TO_PWM_H_
00025 #define SR_RONEX_GENERAL_IO_COMMAND_TO_PWM_H_
00026 
00027 #include <sr_ronex_hardware_interface/mk2_gio_hardware_interface.hpp>
00028 #include "sr_ronex_transmissions/mapping/ronex_mapping.hpp"
00029 
00030 namespace ronex
00031 {
00032   namespace mapping
00033   {
00034     namespace general_io
00035     {
00036       class CommandToPWM
00037         : public RonexMapping
00038       {
00039       public:
00040         CommandToPWM(TiXmlElement* mapping_el, ros_ethercat_model::RobotState* robot);
00041 
00045         virtual void propagateFromRonex(ros_ethercat_model::JointState *js) {};
00046 
00052         virtual void propagateToRonex(ros_ethercat_model::JointState *js);
00053 
00054       protected:
00056         GeneralIO* general_io_;
00058         size_t pwm_module_, pwm_pin_index_;
00060         size_t digital_pin_index_;
00062         bool pin_out_of_bound_;
00063 
00065         unsigned long int ideal_period_;
00066         unsigned short int clock_divider_, actual_period_, on_time_;
00067 
00072         bool check_pins_in_bound_();
00073 
00074         virtual bool try_init_cb_(const ros::TimerEvent&, TiXmlElement* mapping_el, ros_ethercat_model::RobotState* robot, const char* ronex_name);
00075       };
00076     }
00077   }
00078 }
00079 
00080 /* For the emacs weenies in the crowd.
00081    Local Variables:
00082    c-basic-offset: 2
00083    End:
00084 */
00085 
00086 #endif  /* SR_RONEX_GENERAL_IO_COMMAND_TO_PWM_H_ */


sr_ronex_transmissions
Author(s): Ugo Cupcic, Toni Oliver, Mark Pitchless
autogenerated on Fri Aug 28 2015 13:12:29