gazebo_ros_force.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /*
18  * Desc: A dynamic controller plugin that performs generic force interface.
19  * Author: John Hsu
20  * Date: 24 Sept 2008
21  */
22 
23 #ifndef GAZEBO_ROS_FORCE_HH
24 #define GAZEBO_ROS_FORCE_HH
25 
26 #include <string>
27 
28 // Custom Callback Queue
29 #include <ros/callback_queue.h>
30 #include <ros/subscribe_options.h>
31 #include <geometry_msgs/Wrench.h>
32 
33 #include <ros/ros.h>
34 #include <boost/thread.hpp>
35 #include <boost/thread/mutex.hpp>
36 
37 #include <gazebo/physics/physics.hh>
38 #include <gazebo/transport/TransportTypes.hh>
39 #include <gazebo/common/Plugin.hh>
40 #include <gazebo/common/Events.hh>
41 
42 
43 namespace gazebo
44 {
47 
71 class GazeboRosForce : public ModelPlugin
72 {
74  public: GazeboRosForce();
75 
77  public: virtual ~GazeboRosForce();
78 
79  // Documentation inherited
80  protected: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
81 
82  // Documentation inherited
83  protected: virtual void UpdateChild();
84 
87  private: void UpdateObjectForce(const geometry_msgs::Wrench::ConstPtr& _msg);
88 
90  private: void QueueThread();
91 
93  private: physics::WorldPtr world_;
94 
96  private: physics::LinkPtr link_;
97 
101 
103  private: boost::mutex lock_;
104 
106  private: std::string topic_name_;
108  private: std::string link_name_;
109 
111  private: std::string robot_namespace_;
112 
113  // Custom Callback Queue
116  private: boost::thread callback_queue_thread_;
118  private: geometry_msgs::Wrench wrench_msg_;
119 
120  // Pointer to the update event connection
121  private: event::ConnectionPtr update_connection_;
122 };
124 }
126 #endif
gazebo::GazeboRosForce::rosnode_
ros::NodeHandle * rosnode_
A pointer to the ROS node. A node will be instantiated if it does not exist.
Definition: gazebo_ros_force.h:99
gazebo::GazeboRosForce::robot_namespace_
std::string robot_namespace_
for setting ROS name space
Definition: gazebo_ros_force.h:111
gazebo::GazeboRosForce::update_connection_
event::ConnectionPtr update_connection_
Definition: gazebo_ros_force.h:121
gazebo
ros.h
gazebo::GazeboRosForce::lock_
boost::mutex lock_
A mutex to lock access to fields that are used in ROS message callbacks.
Definition: gazebo_ros_force.h:103
gazebo::GazeboRosForce::topic_name_
std::string topic_name_
ROS Wrench topic name inputs.
Definition: gazebo_ros_force.h:106
gazebo::GazeboRosForce::queue_
ros::CallbackQueue queue_
Definition: gazebo_ros_force.h:114
gazebo::GazeboRosForce::Load
void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
Definition: gazebo_ros_force.cpp:65
ros::CallbackQueue
gazebo::GazeboRosForce::callback_queue_thread_
boost::thread callback_queue_thread_
Thead object for the running callback Thread.
Definition: gazebo_ros_force.h:116
gazebo::GazeboRosForce
Definition: gazebo_ros_force.h:71
gazebo::GazeboRosForce::wrench_msg_
geometry_msgs::Wrench wrench_msg_
Container for the wrench force that this plugin exerts on the body.
Definition: gazebo_ros_force.h:118
gazebo::GazeboRosForce::UpdateChild
virtual void UpdateChild()
Definition: gazebo_ros_force.cpp:140
gazebo::GazeboRosForce::sub_
ros::Subscriber sub_
Definition: gazebo_ros_force.h:100
callback_queue.h
gazebo::GazeboRosForce::UpdateObjectForce
void UpdateObjectForce(const geometry_msgs::Wrench::ConstPtr &_msg)
call back when a Wrench message is published
Definition: gazebo_ros_force.cpp:128
gazebo::GazeboRosForce::~GazeboRosForce
virtual ~GazeboRosForce()
Destructor.
Definition: gazebo_ros_force.cpp:50
gazebo::GazeboRosForce::link_name_
std::string link_name_
The Link this plugin is attached to, and will exert forces on.
Definition: gazebo_ros_force.h:108
subscribe_options.h
gazebo::GazeboRosForce::GazeboRosForce
GazeboRosForce()
Constructor.
Definition: gazebo_ros_force.cpp:38
gazebo::GazeboRosForce::QueueThread
void QueueThread()
The custom callback queue thread function.
Definition: gazebo_ros_force.cpp:160
gazebo::GazeboRosForce::link_
physics::LinkPtr link_
A pointer to the Link, where force is applied.
Definition: gazebo_ros_force.h:96
ros::NodeHandle
ros::Subscriber
gazebo::GazeboRosForce::world_
physics::WorldPtr world_
A pointer to the gazebo world.
Definition: gazebo_ros_force.h:93


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55