All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ForceTorqueSensor.hh
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 #ifndef _FORCETORQUESENSOR_HH_
19 #define _FORCETORQUESENSOR_HH_
20 
21 #include <string>
22 
24 #include "gazebo/sensors/Sensor.hh"
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
31  namespace sensors
32  {
35 
39  {
41  public: ForceTorqueSensor();
42 
44  public: virtual ~ForceTorqueSensor();
45 
46  // Documentation inherited.
47  public: virtual void Load(const std::string &_worldName);
48 
49  // Documentation inherited.
50  public: virtual void Init();
51 
52  // Documentation inherited.
53  public: virtual std::string GetTopic() const;
54 
57  public: math::Vector3 GetTorque() const;
58 
61  public: math::Vector3 GetForce() const;
62 
65  public: physics::JointPtr GetJoint() const;
66 
67  // Documentation inherited.
68  public: virtual bool IsActive();
69 
73  public: template<typename T>
75  {return update.Connect(_subscriber);}
76 
80  {update.Disconnect(_conn);}
81 
82  // Documentation inherited.
83  protected: virtual bool UpdateImpl(bool _force);
84 
85  // Documentation inherited.
86  protected: virtual void Fini();
87 
90 
92  private: physics::JointPtr parentJoint;
93 
95  private: transport::PublisherPtr wrenchPub;
96 
98  private: msgs::WrenchStamped wrenchMsg;
99 
101  private: boost::mutex mutex;
102  };
104  }
105 }
106 #endif