All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ODELink.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Nate Koenig
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 
24 #include "physics/ode/ode_inc.h"
25 #include "physics/ode/ODETypes.hh"
26 #include "physics/Link.hh"
27 
28 namespace gazebo
29 {
30  namespace physics
31  {
36 
38  class ODELink : public Link
39  {
41  public: ODELink(EntityPtr _parent);
42 
44  public: virtual ~ODELink();
45 
48  public: virtual void Load(sdf::ElementPtr _sdf);
49 
51  public: virtual void Init();
52 
54  public: virtual void Fini();
55 
57  public: virtual void Update();
58 
61  public: virtual void OnPoseChange();
62 
65  public: dBodyID GetODEId() const;
66 
68  public: virtual void SetEnabled(bool enable) const;
69 
71  public: virtual bool GetEnabled() const;
72 
74  public: virtual void UpdateMass();
75 
77  public: virtual void UpdateSurface();
78 
80  public: virtual void SetLinearVel(const math::Vector3 &vel);
81 
83  public: virtual void SetAngularVel(const math::Vector3 &vel);
84 
86  public: virtual void SetForce(const math::Vector3 &_force);
87 
89  public: virtual void SetTorque(const math::Vector3 &_torque);
90 
92  public: virtual void AddForce(const math::Vector3 &_force);
93 
95  public: virtual void AddRelativeForce(const math::Vector3 &_force);
96 
98  public: virtual void AddForceAtWorldPosition(const math::Vector3 &_force,
99  const math::Vector3 &_pos);
100 
102  public: virtual void AddForceAtRelativePosition(
103  const math::Vector3 &_force, const math::Vector3 &_relpos);
104 
106  public: virtual void AddTorque(const math::Vector3 &_torque);
107 
109  public: virtual void AddRelativeTorque(const math::Vector3 &_torque);
110 
112  public: virtual math::Vector3 GetWorldLinearVel() const;
113 
115  public: virtual math::Vector3 GetWorldAngularVel() const;
116 
118  public: virtual math::Vector3 GetWorldForce() const;
119 
121  public: virtual math::Vector3 GetWorldTorque() const;
122 
124  public: virtual void SetGravityMode(bool mode);
125 
127  public: virtual bool GetGravityMode();
128 
130  public: void SetSelfCollide(bool collide);
131 
133  public: dSpaceID GetSpaceId() const;
134 
136  public: void SetSpaceId(dSpaceID spaceid);
137 
139  public: virtual void SetLinearDamping(double damping);
140 
142  public: virtual void SetAngularDamping(double damping);
143 
145  public: static void DisabledCallback(dBodyID _id);
146 
149  public: static void MoveCallback(dBodyID id);
150 
152  public: virtual void SetKinematic(const bool &state);
153 
155  public: virtual bool GetKinematic() const;
156 
159  public: virtual void SetAutoDisable(bool _disable);
160 
161  protected: math::Pose pose;
162 
164  private: dBodyID linkId;
165 
166  private: ODEPhysicsPtr odePhysics;
167 
168  private: dSpaceID spaceId;
169  };
170 
172  }
173 }
174 #endif