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);
52 
54  public: virtual void Init();
55 
56  // Documentation inherited.
57  public: virtual void Reset();
58 
59  // Documentation inherited.
60  public: virtual LinkPtr GetJointLink(unsigned int _index) const;
61 
62  // Documentation inherited.
63  public: virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const;
64 
65  // Documentation inherited.
66  public: virtual void Attach(LinkPtr _parent, LinkPtr _child);
67 
68  // Documentation inherited.
69  public: virtual void Detach();
70 
71  // Documentation inherited
72  public: virtual void SetDamping(unsigned int _index, double _damping);
73 
74  // Documentation inherited.
75  public: virtual void SetStiffnessDamping(unsigned int _index,
76  double _stiffness, double _damping, double _reference = 0);
77 
78  // Documentation inherited.
79  public: virtual void SetStiffness(unsigned int _index,
80  const double _stiffness);
81 
83  public: virtual void SetAnchor(const unsigned int /*_index*/,
84  const ignition::math::Vector3d &/*_anchor*/);
85 
86  public: virtual ignition::math::Vector3d Anchor(
87  const unsigned int /*_index*/) const override final;
88 
89  // Documentation inherited
90  public: virtual void SetVelocity(unsigned int _index, double _vel)
91  override final;
92 
93  // Documentation inherited
94  public: virtual double GetVelocity(unsigned int _index)
95  const override;
96 
97  // Documentation inherited.
98  public: virtual void SetForce(unsigned int _index, double _force);
99 
100  // Documentation inherited.
101  public: virtual double GetForce(unsigned int _index);
102 
103  // Documentation inherited.
104  public: virtual JointWrench GetForceTorque(unsigned int _index);
105 
106  // Documentation inherited.
107  public: virtual bool SetPosition(
108  const unsigned int _index,
109  const double _position,
110  const bool _preserveWorldVelocity = false)
111  override final;
112 
113  // Documentation inherited.
114  public: virtual ignition::math::Vector3d LinkForce(
115  const unsigned int _index) const;
116 
117  // Documentation inherited.
118  public: virtual ignition::math::Vector3d LinkTorque(
119  const unsigned int _index) const;
120 
121  // Documentation inherited.
122  public: virtual bool SetParam(const std::string &_key,
123  unsigned int _index,
124  const boost::any &_value);
125 
126  // Documentation inherited.
127  public: virtual double GetParam(const std::string &_key,
128  unsigned int _index);
129 
130  // Documentation inherited.
131  public: virtual double LowerLimit(const unsigned int _index) const;
132 
133  // Documentation inherited.
134  public: virtual double UpperLimit(const unsigned int _index) const;
135 
136  // Documentation inherited.
137  public: virtual void SetLowerLimit(const unsigned int _index,
138  const double _limit);
139 
140  // Documentation inherited.
141  public: virtual void SetUpperLimit(const unsigned int _index,
142  const double _limit);
143 
144  // Documentation inherited.
145  public: virtual void CacheForceTorque();
146 
147  // Documentation inherited.
148  protected: virtual double PositionImpl(const unsigned int _index = 0)
149  const override;
150 
151  // Documentation inherited.
152  public: virtual void ApplyDamping();
153 
162  protected: void SetForceImpl(unsigned int _index, double _force);
163 
167  private: void SaveForce(unsigned int _index, double _force);
168 
171  public: DARTModelPtr GetDARTModel() const;
172 
174  public: DARTJointPropPtr DARTProperties() const;
175 
178  public: void SetDARTJoint(dart::dynamics::Joint *_dtJoint);
179 
182  public: dart::dynamics::Joint *GetDARTJoint();
183 
186  protected: DARTJointPrivate *dataPtr;
187  };
189  }
190 }
191 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
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:186