DARTLink.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2016 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_DARTLINK_HH_
19 #define _GAZEBO_DARTLINK_HH_
20 
21 #include <vector>
22 
23 #include "gazebo/physics/Link.hh"
24 
27 #include "gazebo/util/system.hh"
28 
29 namespace gazebo
30 {
31  namespace physics
32  {
34  class DARTLinkPrivate;
35 
38 
40  class GZ_PHYSICS_VISIBLE DARTLink : public Link
41  {
43  public: explicit DARTLink(EntityPtr _parent);
44 
46  public: virtual ~DARTLink();
47 
48  // Documentation inherited
49  public: virtual void Load(sdf::ElementPtr _ptr);
50 
51  // Documentation inherited.
52  public: virtual void Init();
53 
54  // Documentation inherited.
55  public: virtual void Fini();
56 
57  // Documentation inherited
58  public: virtual void OnPoseChange();
59 
60  // Documentation inherited
61  public: virtual void SetEnabled(bool _enable) const;
62 
63  // Documentation inherited
64  public: virtual bool GetEnabled() const;
65 
66  // Documentation inherited
67  public: virtual void SetLinearVel(const math::Vector3 &_vel);
68 
69  // Documentation inherited
70  public: virtual void SetAngularVel(const math::Vector3 &_vel);
71 
72  // Documentation inherited
73  public: virtual void SetForce(const math::Vector3 &_force);
74 
75  // Documentation inherited
76  public: virtual void SetTorque(const math::Vector3 &_torque);
77 
78  // Documentation inherited
79  public: virtual void AddForce(const math::Vector3 &_force);
80 
81  // Documentation inherited
82  public: virtual void AddRelativeForce(const math::Vector3 &_force);
83 
84  // Documentation inherited
85  public: virtual void AddForceAtWorldPosition(const math::Vector3 &_force,
86  const math::Vector3 &_pos);
87 
88  // Documentation inherited
89  public: virtual void AddForceAtRelativePosition(
90  const math::Vector3 &_force,
91  const math::Vector3 &_relpos);
92 
93  // Documentation inherited
94  public: virtual void AddLinkForce(const math::Vector3 &_force,
95  const math::Vector3 &_offset = math::Vector3::Zero);
96 
97  // Documentation inherited
98  public: virtual void AddTorque(const math::Vector3 &_torque);
99 
100  // Documentation inherited
101  public: virtual void AddRelativeTorque(const math::Vector3& _torque);
102 
103  // Documentation inherited
104  public: virtual math::Vector3 GetWorldLinearVel(
105  const math::Vector3& _offset = math::Vector3(0, 0, 0)) const;
106 
107  // Documentation inherited
108  public: virtual math::Vector3 GetWorldLinearVel(
109  const math::Vector3 &_offset,
110  const math::Quaternion &_q) const;
111 
112  // Documentation inherited
113  public: virtual math::Vector3 GetWorldCoGLinearVel() const;
114 
115  // Documentation inherited
116  public: virtual math::Vector3 GetWorldAngularVel() const;
117 
118  // Documentation inherited
119  public: virtual math::Vector3 GetWorldForce() const;
120 
121  // Documentation inherited
122  public: virtual math::Vector3 GetWorldTorque() const;
123 
124  // Documentation inherited
125  public: virtual void SetGravityMode(bool _mode);
126 
127  // Documentation inherited
128  public: virtual bool GetGravityMode() const;
129 
130  // Documentation inherited
131  public: virtual void SetSelfCollide(bool _collide);
132 
133  // Documentation inherited
134  public: virtual void SetLinearDamping(double _damping);
135 
136  // Documentation inherited
137  public: virtual void SetAngularDamping(double _damping);
138 
139  // Documentation inherited
140  public: virtual void SetKinematic(const bool &_state);
141 
142  // Documentation inherited
143  public: virtual bool GetKinematic() const;
144 
145  // Documentation inherited
146  public: virtual void SetAutoDisable(bool _disable);
147 
148  // Documentation inherited
149  public: virtual void SetLinkStatic(bool _static);
150 
154  public: void updateDirtyPoseFromDARTTransformation();
155 
158  public: DARTPhysicsPtr GetDARTPhysics(void) const;
159 
162  public: dart::simulation::World *GetDARTWorld(void) const;
163 
166  public: DARTModelPtr GetDARTModel() const;
167 
170  public: dart::dynamics::BodyNode *GetDARTBodyNode() const;
171 
174  public: void SetDARTParentJoint(DARTJointPtr _dartParentJoint);
175 
178  public: void AddDARTChildJoint(DARTJointPtr _dartChildJoint);
179 
180  // Documentation inherited.
181  public: virtual void UpdateMass();
182 
185  private: DARTLinkPrivate *dataPtr;
186  };
188  }
189 }
190 #endif
boost::shared_ptr< DARTJoint > DARTJointPtr
Definition: DARTTypes.hh:46
Forward declarations for the common classes.
Definition: Animation.hh:33
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
boost::shared_ptr< DARTModel > DARTModelPtr
Definition: DARTTypes.hh:44
DART wrapper forward declarations and typedefs.
boost::shared_ptr< DARTPhysics > DARTPhysicsPtr
Definition: DARTTypes.hh:41
A quaternion class.
Definition: Quaternion.hh:42
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:80
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
static const Vector3 Zero
math::Vector3(0, 0, 0)
Definition: Vector3.hh:42