DARTLink.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 #ifndef GAZEBO_PHYSICS_DART_DARTLINK_HH_
18 #define GAZEBO_PHYSICS_DART_DARTLINK_HH_
19 
20 #include <vector>
21 
22 #include "gazebo/physics/Link.hh"
23 
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace physics
31  {
33  class DARTLinkPrivate;
34 
37 
39  class GZ_PHYSICS_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 ignition::math::Vector3d &_vel);
67 
68  // Documentation inherited
69  public: virtual void SetAngularVel(const ignition::math::Vector3d &_vel);
70 
71  // Documentation inherited
72  public: virtual void SetForce(const ignition::math::Vector3d &_force);
73 
74  // Documentation inherited
75  public: virtual void SetTorque(const ignition::math::Vector3d &_torque);
76 
77  // Documentation inherited
78  public: virtual void AddForce(const ignition::math::Vector3d &_force);
79 
80  // Documentation inherited
81  public: virtual void AddRelativeForce(
82  const ignition::math::Vector3d &_force);
83 
84  // Documentation inherited
85  public: virtual void AddForceAtWorldPosition(
86  const ignition::math::Vector3d &_force,
87  const ignition::math::Vector3d &_pos);
88 
89  // Documentation inherited
90  public: virtual void AddForceAtRelativePosition(
91  const ignition::math::Vector3d &_force,
92  const ignition::math::Vector3d &_relpos);
93 
94  // Documentation inherited
95  public: virtual void AddLinkForce(
96  const ignition::math::Vector3d &_force,
97  const ignition::math::Vector3d &_offset =
98  ignition::math::Vector3d::Zero);
99 
100  // Documentation inherited
101  public: virtual void AddTorque(const ignition::math::Vector3d &_torque);
102 
103  // Documentation inherited
104  public: virtual void AddRelativeTorque(
105  const ignition::math::Vector3d &_torque);
106 
107  // Documentation inherited
108  public: virtual ignition::math::Vector3d WorldLinearVel(
109  const ignition::math::Vector3d &_offset =
110  ignition::math::Vector3d::Zero) const;
111 
112  // Documentation inherited
113  public: virtual ignition::math::Vector3d WorldLinearVel(
114  const ignition::math::Vector3d &_offset,
115  const ignition::math::Quaterniond &_q) const;
116 
117  // Documentation inherited
118  public: virtual ignition::math::Vector3d WorldCoGLinearVel() const;
119 
120  // Documentation inherited
121  public: virtual ignition::math::Vector3d WorldAngularVel() const;
122 
123  // Documentation inherited
124  public: virtual ignition::math::Vector3d WorldForce() const;
125 
126  // Documentation inherited
127  public: virtual ignition::math::Vector3d WorldTorque() const;
128 
129  // Documentation inherited
130  public: virtual void SetGravityMode(bool _mode);
131 
132  // Documentation inherited
133  public: virtual bool GetGravityMode() const;
134 
135  // Documentation inherited
136  public: virtual void SetSelfCollide(bool _collide);
137 
138  // Documentation inherited
139  public: virtual void SetLinearDamping(double _damping);
140 
141  // Documentation inherited
142  public: virtual void SetAngularDamping(double _damping);
143 
144  // Documentation inherited
145  public: virtual void SetKinematic(const bool &_state);
146 
147  // Documentation inherited
148  public: virtual bool GetKinematic() const;
149 
150  // Documentation inherited
151  public: virtual void SetAutoDisable(bool _disable);
152 
153  // Documentation inherited
154  public: virtual void SetLinkStatic(bool _static);
155 
156  // Documentation inherited.
157  public: virtual void UpdateMass();
158 
162  public: void updateDirtyPoseFromDARTTransformation();
163 
166  public: DARTPhysicsPtr GetDARTPhysics(void) const;
167 
170  public: dart::simulation::WorldPtr DARTWorld(void) const;
171 
174  public: DARTModelPtr GetDARTModel() const;
175 
177  public: DARTBodyNodePropPtr DARTProperties() const;
178 
181  public: void SetDARTBodyNode(dart::dynamics::BodyNode *_dtBodyNode);
182 
185  public: void AddSlaveBodyNode(dart::dynamics::BodyNode *_dtBodyNode);
186 
189  public: dart::dynamics::BodyNode *DARTBodyNode() const;
190 
193  public: void SetDARTParentJoint(DARTJointPtr _dartParentJoint);
194 
197  public: void AddDARTChildJoint(DARTJointPtr _dartChildJoint);
198 
201  public: bool IsSoftBody() const;
202 
205  private: DARTLinkPrivate *dataPtr;
206  };
208  }
209 }
210 #endif
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
boost::shared_ptr< DARTJoint > DARTJointPtr
Definition: DARTTypes.hh:48
boost::shared_ptr< DARTModel > DARTModelPtr
Definition: DARTTypes.hh:46
DART wrapper forward declarations and typedefs.
boost::shared_ptr< DARTPhysics > DARTPhysicsPtr
Definition: DARTTypes.hh:43
std::shared_ptr< dart::dynamics::BodyNode::Properties > DARTBodyNodePropPtr
Definition: DARTTypes.hh:54
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:85
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.