00001 00012 00013 // Copyright (C) 2012, hiDOF INC. 00014 // Copyright (C) 2013, PAL Robotics S.L. 00015 // 00016 // Redistribution and use in source and binary forms, with or without 00017 // modification, are permitted provided that the following conditions are met: 00018 // * Redistributions of source code must retain the above copyright notice, 00019 // this list of conditions and the following disclaimer. 00020 // * Redistributions in binary form must reproduce the above copyright 00021 // notice, this list of conditions and the following disclaimer in the 00022 // documentation and/or other materials provided with the distribution. 00023 // * Neither the name of PAL Robotics S.L. nor the names of its 00024 // contributors may be used to endorse or promote products derived from 00025 // this software without specific prior written permission. 00026 // 00027 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00028 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00029 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00030 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00031 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00032 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00033 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00034 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00035 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00036 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00037 // POSSIBILITY OF SUCH DAMAGE. 00040 00041 #pragma once 00042 00043 #include <controller_interface/controller.h> 00044 #include <sr_robot_lib/generic_tactiles.hpp> 00045 #include <sr_hardware_interface/sr_actuator.hpp> 00046 #include <boost/shared_ptr.hpp> 00047 #include <ros_ethercat_model/robot_state_interface.hpp> 00048 00049 #include <sr_tactile_sensor_controller/sr_tactile_sensor_publisher.hpp> 00050 #include <vector> 00051 #include <string> 00052 00053 namespace controller 00054 { 00055 // this controller gets access to the SrTactileSensorInterface 00056 class SrTactileSensorController: public controller_interface::Controller<ros_ethercat_model::RobotStateInterface> 00057 { 00058 public: 00059 SrTactileSensorController(); 00060 virtual bool init(ros_ethercat_model::RobotStateInterface* hw, 00061 ros::NodeHandle &root_nh, 00062 ros::NodeHandle& controller_nh); 00063 virtual void starting(const ros::Time& time); 00064 virtual void update(const ros::Time& time, const ros::Duration& period); 00065 virtual void stopping(const ros::Time& time); 00066 00067 protected: 00068 std::vector<tactiles::AllTactileData>* sensors_; 00069 double publish_rate_; 00070 ros::NodeHandle nh_prefix_; 00071 std::string prefix_; 00072 bool initialized_; 00073 boost::shared_ptr<SrTactileSensorPublisher> sensor_publisher_; 00074 }; 00075 00076 } // namespace controller 00077 00078 /* For the emacs weenies in the crowd. 00079 Local Variables: 00080 c-basic-offset: 2 00081 End: 00082 */ 00083