ForceTorqueSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 #ifndef _GAZEBO_FORCETORQUESENSOR_HH_
18 #define _GAZEBO_FORCETORQUESENSOR_HH_
19 
20 #include <string>
21 
23 #include "gazebo/sensors/Sensor.hh"
24 #include "gazebo/util/system.hh"
25 
26 namespace gazebo
27 {
30  namespace sensors
31  {
34 
38  {
40  public: ForceTorqueSensor();
41 
43  public: virtual ~ForceTorqueSensor();
44 
45  // Documentation inherited.
46  protected: void Load(const std::string &_worldName, sdf::ElementPtr _sdf);
47 
48  // Documentation inherited.
49  public: virtual void Load(const std::string &_worldName);
50 
51  // Documentation inherited.
52  public: virtual void Init();
53 
54  // Documentation inherited.
55  public: virtual std::string GetTopic() const;
56 
61  public: math::Vector3 GetTorque() const GAZEBO_DEPRECATED(6.0);
62 
65  public: ignition::math::Vector3d Torque() const;
66 
71  public: math::Vector3 GetForce() const GAZEBO_DEPRECATED(6.0);
72 
75  public: ignition::math::Vector3d Force() const;
76 
79  public: physics::JointPtr GetJoint() const;
80 
81  // Documentation inherited.
82  public: virtual bool IsActive();
83 
87  public: template<typename T>
89  {return update.Connect(_subscriber);}
90 
94  {update.Disconnect(_conn);}
95 
96  // Documentation inherited.
97  protected: virtual bool UpdateImpl(bool _force);
98 
99  // Documentation inherited.
100  protected: virtual void Fini();
101 
104 
106  private: physics::JointPtr parentJoint;
107 
109  private: transport::PublisherPtr wrenchPub;
110 
112  private: msgs::WrenchStamped wrenchMsg;
113 
115  private: boost::mutex mutex;
116 
118  private: enum MeasureFrame
119  {
120  PARENT_LINK,
121  CHILD_LINK,
122  SENSOR
123  };
124 
126  private: MeasureFrame measureFrame;
127 
131  private: bool parentToChild;
132 
136  private: ignition::math::Matrix3d rotationSensorChild;
137  };
139  }
140 }
141 #endif
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:147
void DisconnectUpdate(event::ConnectionPtr &_conn)
Disconnect from the update signal.
Definition: ForceTorqueSensor.hh:93
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Forward declarations for transport.
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
Sensor for measure force and torque on a joint.
Definition: ForceTorqueSensor.hh:37
event::EventT< void(msgs::WrenchStamped)> update
Update event.
Definition: ForceTorqueSensor.hh:103
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:100
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Base class for sensors.
Definition: Sensor.hh:69
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66
event::ConnectionPtr ConnectUpdate(T _subscriber)
Connect a to the update signal.
Definition: ForceTorqueSensor.hh:88