ODELink.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 /* 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  {
34  class GAZEBO_VISIBLE ODELink : public Link
35  {
38  public: explicit ODELink(EntityPtr _parent);
39 
41  public: virtual ~ODELink();
42 
43  // Documentation inherited
44  public: virtual void Load(sdf::ElementPtr _sdf);
45 
46  // Documentation inherited
47  public: virtual void Init();
48 
49  // Documentation inherited
50  public: virtual void Fini();
51 
52  // Documentation inherited
53  public: virtual void OnPoseChange();
54 
55  // Documentation inherited
56  public: virtual void SetEnabled(bool _enable) const;
57 
58  // Documentation inherited
59  public: virtual bool GetEnabled() const;
60 
61  // Documentation inherited
62  public: virtual void UpdateMass();
63 
64  // Documentation inherited
65  public: virtual void UpdateSurface();
66 
67  // Documentation inherited
68  public: virtual void SetLinearVel(const math::Vector3 &_vel);
69 
70  // Documentation inherited
71  public: virtual void SetAngularVel(const math::Vector3 &_vel);
72 
73  // Documentation inherited
74  public: virtual void SetForce(const math::Vector3 &_force);
75 
76  // Documentation inherited
77  public: virtual void SetTorque(const math::Vector3 &_torque);
78 
79  // Documentation inherited
80  public: virtual void AddForce(const math::Vector3 &_force);
81 
82  // Documentation inherited
83  public: virtual void AddRelativeForce(const math::Vector3 &_force);
84 
85  // Documentation inherited
86  public: virtual void AddForceAtWorldPosition(const math::Vector3 &_force,
87  const math::Vector3 &_pos);
88 
89  // Documentation inherited
90  public: virtual void AddForceAtRelativePosition(
91  const math::Vector3 &_force,
92  const math::Vector3 &_relpos);
93 
94  // Documentation inherited
95  public: virtual void AddTorque(const math::Vector3 &_torque);
96 
97  // Documentation inherited
98  public: virtual void AddRelativeTorque(const math::Vector3 &_torque);
99 
100  // Documentation inherited
101  public: virtual math::Vector3 GetWorldLinearVel(
102  const math::Vector3 &_offset) const;
103 
104  // Documentation inherited
105  public: virtual math::Vector3 GetWorldLinearVel(
106  const math::Vector3 &_offset,
107  const math::Quaternion &_q) const;
108 
109  // Documentation inherited
110  public: virtual math::Vector3 GetWorldCoGLinearVel() const;
111 
112  // Documentation inherited
113  public: virtual math::Vector3 GetWorldAngularVel() const;
114 
115  // Documentation inherited
116  public: virtual math::Vector3 GetWorldForce() const;
117 
118  // Documentation inherited
119  public: virtual math::Vector3 GetWorldTorque() const;
120 
121  // Documentation inherited
122  public: virtual void SetGravityMode(bool _mode);
123 
124  // Documentation inherited
125  public: virtual bool GetGravityMode() const;
126 
127  // Documentation inherited
128  public: void SetSelfCollide(bool _collide);
129 
130  // Documentation inherited
131  public: virtual void SetLinearDamping(double _damping);
132 
133  // Documentation inherited
134  public: virtual void SetAngularDamping(double _damping);
135 
136  // Documentation inherited
137  public: virtual void SetKinematic(const bool &_state);
138 
139  // Documentation inherited
140  public: virtual bool GetKinematic() const;
141 
142  // Documentation inherited
143  public: virtual void SetAutoDisable(bool _disable);
144 
147  public: dBodyID GetODEId() const;
148 
151  public: dSpaceID GetSpaceId() const;
152 
155  public: void SetSpaceId(dSpaceID _spaceid);
156 
159  public: static void DisabledCallback(dBodyID _id);
160 
164  public: static void MoveCallback(dBodyID _id);
165 
166  // Documentation inherited
167  public: virtual void SetLinkStatic(bool _static);
168 
170  private: dBodyID linkId;
171 
173  private: ODEPhysicsPtr odePhysics;
174 
176  private: dSpaceID spaceId;
177 
179  private: math::Vector3 force;
180 
182  private: math::Vector3 torque;
183  };
184  }
185 }
186 #endif
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
boost::shared_ptr< ODEPhysics > ODEPhysicsPtr
Definition: ODETypes.hh:56
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:74
A quaternion class.
Definition: Quaternion.hh:41
ODE wrapper forward declarations and typedefs.
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48