00001 /* 00002 * Copyright (C) 2012-2014 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 * Desc: 3D position interface. 00019 * Author: Sachin Chitta and John Hsu 00020 * Date: 10 June 2008 00021 */ 00022 00023 #ifndef GAZEBO_ROS_TEMPLATE_HH 00024 #define GAZEBO_ROS_TEMPLATE_HH 00025 00026 #include <ros/ros.h> 00027 00028 #include <gazebo/physics/physics.hh> 00029 #include <gazebo/transport/TransportTypes.hh> 00030 #include <gazebo/common/Time.hh> 00031 #include <gazebo/common/Plugin.hh> 00032 #include <gazebo/common/Events.hh> 00033 00034 #include <tf2_ros/transform_listener.h> 00035 #include <tf2_ros/transform_broadcaster.h> 00036 00037 namespace gazebo 00038 { 00039 00040 class GazeboRosHandOfGod : public ModelPlugin 00041 { 00043 public: GazeboRosHandOfGod(); 00044 00046 public: virtual ~GazeboRosHandOfGod(); 00047 00049 public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf ); 00050 00052 protected: virtual void GazeboUpdate(); 00053 00055 private: event::ConnectionPtr update_connection_; 00056 boost::shared_ptr<tf2_ros::Buffer> tf_buffer_; 00057 boost::shared_ptr<tf2_ros::TransformListener> tf_listener_; 00058 boost::shared_ptr<tf2_ros::TransformBroadcaster> tf_broadcaster_; 00059 physics::ModelPtr model_; 00060 physics::LinkPtr floating_link_; 00061 std::string link_name_; 00062 std::string robot_namespace_; 00063 std::string frame_id_; 00064 double kl_, ka_; 00065 double cl_, ca_; 00066 }; 00067 00068 } 00069 00070 #endif 00071