ForceTorqueSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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_SENSORS_FORCETORQUESENSOR_HH_
18 #define _GAZEBO_SENSORS_FORCETORQUESENSOR_HH_
19 
20 #include <functional>
21 #include <memory>
22 #include <string>
23 
24 #include <ignition/math/Vector3.hh>
25 
26 #include "gazebo/sensors/Sensor.hh"
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
34  namespace sensors
35  {
36  // Forward declare private data class.
37  class ForceTorqueSensorPrivate;
38 
41 
44  class GZ_SENSORS_VISIBLE ForceTorqueSensor: public Sensor
45  {
47  public: ForceTorqueSensor();
48 
50  public: virtual ~ForceTorqueSensor();
51 
52  // Documentation inherited.
53  protected: void Load(const std::string &_worldName, sdf::ElementPtr _sdf);
54 
55  // Documentation inherited.
56  public: virtual void Load(const std::string &_worldName);
57 
58  // Documentation inherited.
59  public: virtual void Init();
60 
61  // Documentation inherited.
62  public: virtual std::string Topic() const;
63 
66  public: ignition::math::Vector3d Torque() const;
67 
70  public: ignition::math::Vector3d Force() const;
71 
74  public: physics::JointPtr Joint() const;
75 
76  // Documentation inherited.
77  public: virtual bool IsActive() const;
78 
82  public: event::ConnectionPtr ConnectUpdate(
83  std::function<void (msgs::WrenchStamped)> _subscriber);
84 
85  // Documentation inherited.
86  protected: virtual bool UpdateImpl(const bool _force);
87 
88  // Documentation inherited.
89  protected: virtual void Fini();
90 
93  private: std::unique_ptr<ForceTorqueSensorPrivate> dataPtr;
94  };
96  }
97 }
98 #endif
Forward declarations for the common classes.
Definition: Animation.hh:26
Forward declarations for transport.
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
Sensor for measure force and torque on a joint.
Definition: ForceTorqueSensor.hh:44
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Base class for sensors.
Definition: Sensor.hh:51