spi_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 _SPI_PASSTHROUGH_CONTROLLER_H_
00026 #define _SPI_PASSTHROUGH_CONTROLLER_H_
00027 
00028 #include <ros/node_handle.h>
00029 #include <boost/ptr_container/ptr_vector.hpp>
00030 #include <utility>
00031 
00032 #include "sr_ronex_controllers/spi_base_controller.hpp"
00033 #include <sr_ronex_msgs/SPI.h>
00034 
00035 #include <dynamic_reconfigure/server.h>
00036 #include "sr_ronex_drivers/SPIConfig.h"
00037 
00038 namespace ronex
00039 {
00040   class SPIPassthroughController
00041     : public SPIBaseController
00042   {
00043   public:
00044     virtual bool init(ros_ethercat_model::RobotState* robot, ros::NodeHandle &n);
00045 
00046     bool command_srv_cb( sr_ronex_msgs::SPI::Request &req,
00047                          sr_ronex_msgs::SPI::Response &res,
00048                          size_t spi_out_index );
00049 
00050     void dynamic_reconfigure_cb(sr_ronex_drivers::SPIConfig &config, uint32_t level);
00051 
00052   private:
00053     std::vector<ros::ServiceServer> command_srv_;
00054 
00055     //vector containing one command per spi output.
00056     // Some parameters of these commands are updated through the dynamic reconfigure interface
00057     // The data packet is updated from the service.
00058     std::vector<SplittedSPICommand> standard_commands_;
00059 
00061     boost::scoped_ptr<dynamic_reconfigure::Server<sr_ronex_drivers::SPIConfig> > dynamic_reconfigure_server_;
00062     dynamic_reconfigure::Server<sr_ronex_drivers::SPIConfig>::CallbackType function_cb_;
00063 
00064     //Instantiating the services / dynamic reconfigure callbacks etc..
00065     void post_init_();
00066   };
00067 }
00068 
00069 /* For the emacs weenies in the crowd.
00070 Local Variables:
00071    c-basic-offset: 2
00072 End:
00073 */
00074 
00075 #endif /* _SPI_PASSTHROUGH_CONTROLLER_H_ */


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