DARTJoint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 _GAZEBO_DARTJOINT_HH_
19 #define _GAZEBO_DARTJOINT_HH_
20 
21 #include <boost/any.hpp>
22 #include <string>
23 
25 #include "gazebo/physics/Joint.hh"
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace physics
33  {
35  class DARTJointPrivate;
36 
39 
41  class GZ_PHYSICS_VISIBLE DARTJoint : public Joint
42  {
45  public: explicit DARTJoint(BasePtr _parent);
46 
48  public: virtual ~DARTJoint();
49 
50  // Documentation inherited.
51  public: virtual void Load(sdf::ElementPtr _sdf) override;
52 
54  public: virtual void Init() override;
55 
56  // Documentation inherited.
57  public: virtual void Reset() override;
58 
59  // Documentation inherited.
60  public: virtual LinkPtr GetJointLink(unsigned int _index) const override;
61 
62  // Documentation inherited.
63  public: virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const
64  override;
65 
66  // Documentation inherited.
67  public: virtual void Attach(LinkPtr _parent, LinkPtr _child) override;
68 
69  // Documentation inherited.
70  public: virtual void Detach() override;
71 
72  // Documentation inherited
73  public: virtual void SetDamping(unsigned int _index, double _damping)
74  override;
75 
76  // Documentation inherited.
77  public: virtual void SetStiffnessDamping(unsigned int _index,
78  double _stiffness, double _damping, double _reference = 0) override;
79 
80  // Documentation inherited.
81  public: virtual void SetStiffness(unsigned int _index,
82  const double _stiffness) override;
83 
85  public: virtual void SetAnchor(const unsigned int /*_index*/,
86  const ignition::math::Vector3d &/*_anchor*/) override;
87 
88  public: virtual ignition::math::Vector3d Anchor(
89  const unsigned int /*_index*/) const override final;
90 
91  // Documentation inherited
92  public: virtual void SetVelocity(unsigned int _index, double _vel)
93  override final;
94 
95  // Documentation inherited
96  public: virtual double GetVelocity(unsigned int _index)
97  const override;
98 
99  // Documentation inherited.
100  public: virtual void SetForce(unsigned int _index, double _force)
101  override;
102 
103  // Documentation inherited.
104  public: virtual double GetForce(unsigned int _index) override;
105 
106  // Documentation inherited.
107  public: virtual JointWrench GetForceTorque(unsigned int _index) override;
108 
109  // Documentation inherited.
110  public: virtual bool SetPosition(
111  const unsigned int _index,
112  const double _position,
113  const bool _preserveWorldVelocity = false)
114  override final;
115 
116  // Documentation inherited.
117  public: virtual ignition::math::Vector3d LinkForce(
118  const unsigned int _index) const override;
119 
120  // Documentation inherited.
121  public: virtual ignition::math::Vector3d LinkTorque(
122  const unsigned int _index) const override;
123 
124  // Documentation inherited.
125  public: virtual bool SetParam(const std::string &_key,
126  unsigned int _index,
127  const boost::any &_value) override;
128 
129  // Documentation inherited.
130  public: virtual double GetParam(const std::string &_key,
131  unsigned int _index) override;
132 
133  // Documentation inherited.
134  public: virtual double LowerLimit(const unsigned int _index) const
135  override;
136 
137  // Documentation inherited.
138  public: virtual double UpperLimit(const unsigned int _index) const
139  override;
140 
141  // Documentation inherited.
142  public: virtual void SetLowerLimit(const unsigned int _index,
143  const double _limit) override;
144 
145  // Documentation inherited.
146  public: virtual void SetUpperLimit(const unsigned int _index,
147  const double _limit) override;
148 
149  // Documentation inherited.
150  public: virtual void CacheForceTorque() override;
151 
152  // Documentation inherited.
153  protected: virtual double PositionImpl(const unsigned int _index = 0)
154  const override;
155 
156  // Documentation inherited.
157  public: virtual void ApplyDamping();
158 
167  protected: void SetForceImpl(unsigned int _index, double _force);
168 
172  private: void SaveForce(unsigned int _index, double _force);
173 
176  public: DARTModelPtr GetDARTModel() const;
177 
179  public: DARTJointPropPtr DARTProperties() const;
180 
183  public: void SetDARTJoint(dart::dynamics::Joint *_dtJoint);
184 
187  public: dart::dynamics::Joint *GetDARTJoint();
188 
191  protected: DARTJointPrivate *dataPtr;
192  };
194  }
195 }
196 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
Forward declarations for the common classes.
Definition: Animation.hh:26
boost::shared_ptr< DARTModel > DARTModelPtr
Definition: DARTTypes.hh:46
std::shared_ptr< dart::dynamics::Joint::Properties > DARTJointPropPtr
Definition: DARTTypes.hh:56
Base class for all joints.
Definition: Joint.hh:50
Wrench information from a joint.
Definition: JointWrench.hh:40
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
DART joint interface.
Definition: DARTJoint.hh:41
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
DARTJointPrivate * dataPtr
Definition: DARTJoint.hh:191