DARTLink.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-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 _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  {
37 
39  class GAZEBO_VISIBLE DARTLink : public Link
40  {
42  public: explicit DARTLink(EntityPtr _parent);
43 
45  public: virtual ~DARTLink();
46 
47  // Documentation inherited
48  public: virtual void Load(sdf::ElementPtr _ptr);
49 
50  // Documentation inherited.
51  public: virtual void Init();
52 
53  // Documentation inherited.
54  public: virtual void Fini();
55 
56  // Documentation inherited
57  public: virtual void OnPoseChange();
58 
59  // Documentation inherited
60  public: virtual void SetEnabled(bool _enable) const;
61 
62  // Documentation inherited
63  public: virtual bool GetEnabled() const;
64 
65  // Documentation inherited
66  public: virtual void SetLinearVel(const math::Vector3 &_vel);
67 
68  // Documentation inherited
69  public: virtual void SetAngularVel(const math::Vector3 &_vel);
70 
71  // Documentation inherited
72  public: virtual void SetForce(const math::Vector3 &_force);
73 
74  // Documentation inherited
75  public: virtual void SetTorque(const math::Vector3 &_torque);
76 
77  // Documentation inherited
78  public: virtual void AddForce(const math::Vector3 &_force);
79 
80  // Documentation inherited
81  public: virtual void AddRelativeForce(const math::Vector3 &_force);
82 
83  // Documentation inherited
84  public: virtual void AddForceAtWorldPosition(const math::Vector3 &_force,
85  const math::Vector3 &_pos);
86 
87  // Documentation inherited
88  public: virtual void AddForceAtRelativePosition(
89  const math::Vector3 &_force,
90  const math::Vector3 &_relpos);
91 
92  // Documentation inherited
93  public: virtual void AddTorque(const math::Vector3 &_torque);
94 
95  // Documentation inherited
96  public: virtual void AddRelativeTorque(const math::Vector3& _torque);
97 
98  // Documentation inherited
99  public: virtual math::Vector3 GetWorldLinearVel(
100  const math::Vector3& _offset = math::Vector3(0, 0, 0)) const;
101 
102  // Documentation inherited
103  public: virtual math::Vector3 GetWorldLinearVel(
104  const math::Vector3 &_offset,
105  const math::Quaternion &_q) const;
106 
107  // Documentation inherited
108  public: virtual math::Vector3 GetWorldCoGLinearVel() const;
109 
110  // Documentation inherited
111  public: virtual math::Vector3 GetWorldAngularVel() const;
112 
113  // Documentation inherited
114  public: virtual math::Vector3 GetWorldForce() const;
115 
116  // Documentation inherited
117  public: virtual math::Vector3 GetWorldTorque() const;
118 
119  // Documentation inherited
120  public: virtual void SetGravityMode(bool _mode);
121 
122  // Documentation inherited
123  public: virtual bool GetGravityMode() const;
124 
125  // Documentation inherited
126  public: virtual void SetSelfCollide(bool _collide);
127 
128  // Documentation inherited
129  public: virtual void SetLinearDamping(double _damping);
130 
131  // Documentation inherited
132  public: virtual void SetAngularDamping(double _damping);
133 
134  // Documentation inherited
135  public: virtual void SetKinematic(const bool &_state);
136 
137  // Documentation inherited
138  public: virtual bool GetKinematic() const;
139 
140  // Documentation inherited
141  public: virtual void SetAutoDisable(bool _disable);
142 
143  // Documentation inherited
144  public: virtual void SetLinkStatic(bool _static);
145 
149  public: void updateDirtyPoseFromDARTTransformation();
150 
153  public: DARTPhysicsPtr GetDARTPhysics(void) const;
154 
157  public: dart::simulation::World *GetDARTWorld(void) const;
158 
161  public: DARTModelPtr GetDARTModel() const;
162 
165  public: dart::dynamics::BodyNode *GetDARTBodyNode() const;
166 
169  public: void SetDARTParentJoint(DARTJointPtr _dartParentJoint);
170 
173  public: void AddDARTChildJoint(DARTJointPtr _dartChildJoint);
174 
176  private: DARTPhysicsPtr dartPhysics;
177 
179  private: dart::dynamics::BodyNode *dtBodyNode;
180 
182  private: DARTJointPtr dartParentJoint;
183 
185  private: std::vector<DARTJointPtr> dartChildJoints;
186 
188  private: bool staticLink;
189 
191  private: dart::constraint::WeldJointConstraint *weldJointConst;
192  };
194  }
195 }
196 #endif
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
boost::shared_ptr< DARTPhysics > DARTPhysicsPtr
Definition: DARTTypes.hh:39
DART wrapper forward declarations and typedefs.
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:74
boost::shared_ptr< DARTModel > DARTModelPtr
Definition: DARTTypes.hh:42
A quaternion class.
Definition: Quaternion.hh:41
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< DARTJoint > DARTJointPtr
Definition: DARTTypes.hh:44
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48