00001 /* 00002 * Copyright 2016 Open Source Robotics Foundation 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 */ 00017 00018 #ifndef _ROS_CONVEYOR_BELT_PLUGIN_HH_ 00019 #define _ROS_CONVEYOR_BELT_PLUGIN_HH_ 00020 00021 #include <sdf/sdf.hh> 00022 00023 // Gazebo 00024 #include "ConveyorBeltPlugin.hh" 00025 00026 // ROS 00027 #include <osrf_gear/ConveyorBeltControl.h> 00028 #include <ros/ros.h> 00029 00030 namespace gazebo 00031 { 00033 class ROSConveyorBeltPlugin : public ConveyorBeltPlugin 00034 { 00036 public: ROSConveyorBeltPlugin(); 00037 00039 public: virtual ~ROSConveyorBeltPlugin(); 00040 00044 public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf); 00045 00049 public: bool OnControlCommand( 00050 osrf_gear::ConveyorBeltControl::Request &_req, 00051 osrf_gear::ConveyorBeltControl::Response &_res); 00052 00054 private: std::string robotNamespace_; 00055 00057 private: ros::NodeHandle *rosnode_; 00058 00060 public: ros::ServiceServer controlService_; 00061 }; 00062 } 00063 #endif