general_io_passthrough_controller.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 
00025 #ifndef _GENERAL_IO_PASSTHROUGH_CONTROLLER_H_
00026 #define _GENERAL_IO_PASSTHROUGH_CONTROLLER_H_
00027 
00028 #include <ros/node_handle.h>
00029 
00030 #include <controller_interface/controller.h>
00031 #include <ros_ethercat_model/robot_state.hpp>
00032 #include <sr_ronex_hardware_interface/mk2_gio_hardware_interface.hpp>
00033 #include <realtime_tools/realtime_publisher.h>
00034 #include <sr_ronex_utilities/sr_ronex_utilities.hpp>
00035 
00036 #include <std_msgs/Bool.h>
00037 #include <sr_ronex_msgs/PWM.h>
00038 
00039 namespace ronex
00040 {
00041   class GeneralIOPassthroughController
00042     : public controller_interface::Controller<ros_ethercat_model::RobotState>
00043   {
00044   public:
00045     GeneralIOPassthroughController();
00046 
00047     virtual bool init(ros_ethercat_model::RobotState* robot, ros::NodeHandle &n);
00048 
00052     virtual void update(const ros::Time&, const ros::Duration&) {}
00053 
00054     void digital_commands_cb(const std_msgs::BoolConstPtr& msg, int index);
00055 
00056     void pwm_commands_cb(const sr_ronex_msgs::PWMConstPtr& msg, int index);
00057 
00058   private:
00059     ros::NodeHandle node_;
00060 
00061     int loop_count_;
00062 
00063     ronex::GeneralIO* general_io_;
00064 
00066     std::vector<ros::Subscriber> digital_subscribers_;
00068     std::vector<ros::Subscriber> pwm_subscribers_;
00069   };
00070 }
00071 
00072 /* For the emacs weenies in the crowd.
00073 Local Variables:
00074    c-basic-offset: 2
00075 End:
00076 */
00077 
00078 #endif /* _GENERAL_IO_PASSTHROUGH_CONTROLLER_H_ */


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