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 
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  protected: void Load(const std::string &_worldName, sdf::ElementPtr _sdf);
48 
49  // Documentation inherited.
50  public: virtual void Load(const std::string &_worldName);
51 
52  // Documentation inherited.
53  public: virtual void Init();
54 
55  // Documentation inherited.
56  public: virtual std::string GetTopic() const;
57 
60  public: math::Vector3 GetTorque() const;
61 
64  public: math::Vector3 GetForce() const;
65 
68  public: physics::JointPtr GetJoint() const;
69 
70  // Documentation inherited.
71  public: virtual bool IsActive();
72 
76  public: template<typename T>
78  {return update.Connect(_subscriber);}
79 
83  {update.Disconnect(_conn);}
84 
85  // Documentation inherited.
86  protected: virtual bool UpdateImpl(bool _force);
87 
88  // Documentation inherited.
89  protected: virtual void Fini();
90 
93 
95  private: physics::JointPtr parentJoint;
96 
98  private: transport::PublisherPtr wrenchPub;
99 
101  private: msgs::WrenchStamped wrenchMsg;
102 
104  private: boost::mutex mutex;
105 
107  private: enum MeasureFrame
108  {
109  PARENT_LINK,
110  CHILD_LINK,
111  SENSOR
112  };
113 
115  private: MeasureFrame measureFrame;
116 
120  private: bool parentToChild;
121 
125  private: math::Matrix3 rotationSensorChild;
126  };
128  }
129 }
130 #endif
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:144
void DisconnectUpdate(event::ConnectionPtr &_conn)
Disconnect from the update signal.
Definition: ForceTorqueSensor.hh:82
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
Forward declarations for transport.
Sensor for measure force and torque on a joint.
Definition: ForceTorqueSensor.hh:38
event::EventT< void(msgs::WrenchStamped)> update
Update event.
Definition: ForceTorqueSensor.hh:92
A 3x3 matrix class.
Definition: Matrix3.hh:34
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:98
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:67
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
class __declspec(dllimport) BasicController void update(const Ogre::Real &simDeltaTime)
Basic controller class.
event::ConnectionPtr ConnectUpdate(T _subscriber)
Connect a to the update signal.
Definition: ForceTorqueSensor.hh:77