gazebo_ros_ft_sensor.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: Force Torque Sensor Plugin
19  * Author: Francisco Suarez-Ruiz
20  * Date: 5 June 2014
21  */
22 
23 #ifndef GAZEBO_ROS_FT_HH
24 #define GAZEBO_ROS_FT_HH
25 
26 // Custom Callback Queue
27 #include <ros/callback_queue.h>
28 #include <ros/advertise_options.h>
29 
30 #include <gazebo/physics/physics.hh>
31 #include <gazebo/transport/TransportTypes.hh>
32 #include <gazebo/common/Plugin.hh>
33 #include <gazebo/common/Events.hh>
34 
35 #include <ros/ros.h>
36 #include <boost/thread.hpp>
37 #include <boost/thread/mutex.hpp>
38 #include <geometry_msgs/WrenchStamped.h>
39 
40 namespace gazebo
41 {
44 
72 class GazeboRosFT : public ModelPlugin
75 {
78  public: GazeboRosFT();
79 
81  public: virtual ~GazeboRosFT();
82 
84  public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
85 
87  protected: virtual void UpdateChild();
88 
90  private: double gaussian_noise_;
91 
93  private: double GaussianKernel(double mu, double sigma);
94 
96  private: physics::JointPtr joint_;
97 
99  private: physics::LinkPtr parent_link_;
100 
102  private: physics::LinkPtr child_link_;
103 
105  private: physics::ModelPtr model_;
106 
108  private: physics::WorldPtr world_;
109 
113 
115  private: geometry_msgs::WrenchStamped wrench_msg_;
116 
118  private: std::string joint_name_;
119 
121  private: std::string topic_name_;
122 
125  private: std::string frame_name_;
126 
128  private: std::string robot_namespace_;
129 
131  private: boost::mutex lock_;
132 
134  private: common::Time last_time_;
135 
136  // rate control
137  private: double update_rate_;
138 
140  private: int ft_connect_count_;
141  private: void FTConnect();
142  private: void FTDisconnect();
143 
144  // Custom Callback Queue
146  private: void QueueThread();
147  private: boost::thread callback_queue_thread_;
148 
149  // Pointer to the update event connection
150  private: event::ConnectionPtr update_connection_;
151 
152 };
153 
155 
157 
158 }
159 
160 #endif
gazebo::GazeboRosFT::QueueThread
void QueueThread()
Definition: gazebo_ros_ft_sensor.cpp:256
gazebo::GazeboRosFT::topic_name_
std::string topic_name_
ROS WrenchStamped topic name.
Definition: gazebo_ros_ft_sensor.h:121
gazebo::GazeboRosFT::~GazeboRosFT
virtual ~GazeboRosFT()
Destructor.
Definition: gazebo_ros_ft_sensor.cpp:43
gazebo::GazeboRosFT::model_
physics::ModelPtr model_
A pointer to the Gazebo model.
Definition: gazebo_ros_ft_sensor.h:105
ros::Publisher
gazebo::GazeboRosFT::callback_queue_thread_
boost::thread callback_queue_thread_
Definition: gazebo_ros_ft_sensor.h:147
gazebo
ros.h
gazebo::GazeboRosFT::parent_link_
physics::LinkPtr parent_link_
A pointer to the Gazebo parent link.
Definition: gazebo_ros_ft_sensor.h:99
gazebo::GazeboRosFT::robot_namespace_
std::string robot_namespace_
for setting ROS name space
Definition: gazebo_ros_ft_sensor.h:128
gazebo::GazeboRosFT::rosnode_
ros::NodeHandle * rosnode_
A pointer to the ROS node. A node will be instantiated if it does not exist.
Definition: gazebo_ros_ft_sensor.h:111
gazebo::GazeboRosFT::update_connection_
event::ConnectionPtr update_connection_
Definition: gazebo_ros_ft_sensor.h:150
gazebo::GazeboRosFT::lock_
boost::mutex lock_
A mutex to lock access to fields that are used in message callbacks.
Definition: gazebo_ros_ft_sensor.h:131
gazebo::GazeboRosFT::pub_
ros::Publisher pub_
Definition: gazebo_ros_ft_sensor.h:112
gazebo::GazeboRosFT::frame_name_
std::string frame_name_
ROS frame transform name to use in the image message header. FIXME: extract link name directly?
Definition: gazebo_ros_ft_sensor.h:125
gazebo::GazeboRosFT::joint_
physics::JointPtr joint_
A pointer to the Gazebo joint.
Definition: gazebo_ros_ft_sensor.h:96
gazebo::GazeboRosFT::world_
physics::WorldPtr world_
A pointer to the Gazebo world.
Definition: gazebo_ros_ft_sensor.h:108
ros::CallbackQueue
gazebo::GazeboRosFT::ft_connect_count_
int ft_connect_count_
: keep track of number of connections
Definition: gazebo_ros_ft_sensor.h:140
gazebo::GazeboRosFT::Load
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load the controller.
Definition: gazebo_ros_ft_sensor.cpp:56
gazebo::GazeboRosFT::joint_name_
std::string joint_name_
store bodyname
Definition: gazebo_ros_ft_sensor.h:118
gazebo::GazeboRosFT::update_rate_
double update_rate_
Definition: gazebo_ros_ft_sensor.h:137
callback_queue.h
gazebo::GazeboRosFT::last_time_
common::Time last_time_
save last_time
Definition: gazebo_ros_ft_sensor.h:134
gazebo::GazeboRosFT::UpdateChild
virtual void UpdateChild()
Update the controller.
Definition: gazebo_ros_ft_sensor.cpp:161
gazebo::GazeboRosFT::GaussianKernel
double GaussianKernel(double mu, double sigma)
Gaussian noise generator.
Definition: gazebo_ros_ft_sensor.cpp:233
gazebo::GazeboRosFT::wrench_msg_
geometry_msgs::WrenchStamped wrench_msg_
ROS WrenchStamped message.
Definition: gazebo_ros_ft_sensor.h:115
advertise_options.h
gazebo::GazeboRosFT::GazeboRosFT
GazeboRosFT()
Constructor.
Definition: gazebo_ros_ft_sensor.cpp:36
gazebo::GazeboRosFT::queue_
ros::CallbackQueue queue_
Definition: gazebo_ros_ft_sensor.h:145
gazebo::GazeboRosFT::FTDisconnect
void FTDisconnect()
Definition: gazebo_ros_ft_sensor.cpp:154
gazebo::GazeboRosFT::child_link_
physics::LinkPtr child_link_
A pointer to the Gazebo child link.
Definition: gazebo_ros_ft_sensor.h:102
gazebo::GazeboRosFT::gaussian_noise_
double gaussian_noise_
Gaussian noise.
Definition: gazebo_ros_ft_sensor.h:90
gazebo::GazeboRosFT::FTConnect
void FTConnect()
Definition: gazebo_ros_ft_sensor.cpp:147
ros::NodeHandle


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