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


sr_ronex_controllers
Author(s): Ugo Cupcic, Toni Oliver, Mark Pitchless
autogenerated on Thu Jun 6 2019 21:22:06