ODELink.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 /* Desc: ODE Link class
18  * Author: Nate Koenig
19  */
20 
21 #ifndef _ODELINK_HH_
22 #define _ODELINK_HH_
23 
26 #include "gazebo/physics/Link.hh"
27 #include "gazebo/util/system.hh"
28 
29 namespace gazebo
30 {
31  namespace physics
32  {
35 
37  class GZ_PHYSICS_VISIBLE ODELink : public Link
38  {
41  public: explicit ODELink(EntityPtr _parent);
42 
44  public: virtual ~ODELink();
45 
46  // Documentation inherited
47  public: virtual void Load(sdf::ElementPtr _sdf);
48 
49  // Documentation inherited
50  public: virtual void Init();
51 
52  // Documentation inherited
53  public: virtual void Fini();
54 
55  // Documentation inherited
56  public: virtual void OnPoseChange();
57 
58  // Documentation inherited
59  public: virtual void SetEnabled(bool _enable) const;
60 
61  // Documentation inherited
62  public: virtual bool GetEnabled() const;
63 
68  public: void UpdateCollisionOffsets();
69 
70  // Documentation inherited
71  public: virtual void UpdateMass();
72 
73  // Documentation inherited
74  public: virtual void UpdateSurface();
75 
76  // Documentation inherited
77  public: virtual void SetLinearVel(const math::Vector3 &_vel);
78 
79  // Documentation inherited
80  public: virtual void SetAngularVel(const math::Vector3 &_vel);
81 
82  // Documentation inherited
83  public: virtual void SetForce(const math::Vector3 &_force);
84 
85  // Documentation inherited
86  public: virtual void SetTorque(const math::Vector3 &_torque);
87 
88  // Documentation inherited
89  public: virtual void AddForce(const math::Vector3 &_force);
90 
91  // Documentation inherited
92  public: virtual void AddRelativeForce(const math::Vector3 &_force);
93 
94  // Documentation inherited
95  public: virtual void AddForceAtWorldPosition(const math::Vector3 &_force,
96  const math::Vector3 &_pos);
97 
98  // Documentation inherited
99  public: virtual void AddForceAtRelativePosition(
100  const math::Vector3 &_force,
101  const math::Vector3 &_relpos);
102 
103  // Documentation inherited
104  public: virtual void AddLinkForce(const math::Vector3 &_force,
105  const math::Vector3 &_offset = math::Vector3::Zero);
106 
107  // Documentation inherited
108  public: virtual void AddTorque(const math::Vector3 &_torque);
109 
110  // Documentation inherited
111  public: virtual void AddRelativeTorque(const math::Vector3 &_torque);
112 
113  // Documentation inherited
114  public: virtual math::Vector3 GetWorldLinearVel(
115  const math::Vector3 &_offset) const;
116 
117  // Documentation inherited
118  public: virtual math::Vector3 GetWorldLinearVel(
119  const math::Vector3 &_offset,
120  const math::Quaternion &_q) const;
121 
122  // Documentation inherited
123  public: virtual math::Vector3 GetWorldCoGLinearVel() const;
124 
125  // Documentation inherited
126  public: virtual math::Vector3 GetWorldAngularVel() const;
127 
128  // Documentation inherited
129  public: virtual math::Vector3 GetWorldForce() const;
130 
131  // Documentation inherited
132  public: virtual math::Vector3 GetWorldTorque() const;
133 
134  // Documentation inherited
135  public: virtual void SetGravityMode(bool _mode);
136 
137  // Documentation inherited
138  public: virtual bool GetGravityMode() const;
139 
140  // Documentation inherited
141  public: void SetSelfCollide(bool _collide);
142 
143  // Documentation inherited
144  public: virtual void SetLinearDamping(double _damping);
145 
146  // Documentation inherited
147  public: virtual void SetAngularDamping(double _damping);
148 
149  // Documentation inherited
150  public: virtual void SetKinematic(const bool &_state);
151 
152  // Documentation inherited
153  public: virtual bool GetKinematic() const;
154 
155  // Documentation inherited
156  public: virtual void SetAutoDisable(bool _disable);
157 
160  public: dBodyID GetODEId() const;
161 
164  public: dSpaceID GetSpaceId() const;
165 
168  public: void SetSpaceId(dSpaceID _spaceid);
169 
172  public: static void DisabledCallback(dBodyID _id);
173 
177  public: static void MoveCallback(dBodyID _id);
178 
179  // Documentation inherited
180  public: virtual void SetLinkStatic(bool _static);
181 
183  private: dBodyID linkId;
184 
186  private: ODEPhysicsPtr odePhysics;
187 
189  private: dSpaceID spaceId;
190 
192  private: math::Vector3 force;
193 
195  private: math::Vector3 torque;
196  };
198  }
199 }
200 #endif
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
boost::shared_ptr< ODEPhysics > ODEPhysicsPtr
Definition: ODETypes.hh:59
A quaternion class.
Definition: Quaternion.hh:42
ODE wrapper forward declarations and typedefs.
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:85
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