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  {
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 
65  public: void UpdateCollisionOffsets();
66 
67  // Documentation inherited
68  public: virtual void UpdateMass();
69 
70  // Documentation inherited
71  public: virtual void UpdateSurface();
72 
73  // Documentation inherited
74  public: virtual void SetLinearVel(const math::Vector3 &_vel);
75 
76  // Documentation inherited
77  public: virtual void SetAngularVel(const math::Vector3 &_vel);
78 
79  // Documentation inherited
80  public: virtual void SetForce(const math::Vector3 &_force);
81 
82  // Documentation inherited
83  public: virtual void SetTorque(const math::Vector3 &_torque);
84 
85  // Documentation inherited
86  public: virtual void AddForce(const math::Vector3 &_force);
87 
88  // Documentation inherited
89  public: virtual void AddRelativeForce(const math::Vector3 &_force);
90 
91  // Documentation inherited
92  public: virtual void AddForceAtWorldPosition(const math::Vector3 &_force,
93  const math::Vector3 &_pos);
94 
95  // Documentation inherited
96  public: virtual void AddForceAtRelativePosition(
97  const math::Vector3 &_force,
98  const math::Vector3 &_relpos);
99 
100  // Documentation inherited
101  public: virtual void AddLinkForce(const math::Vector3 &_force,
102  const math::Vector3 &_offset = math::Vector3::Zero);
103 
104  // Documentation inherited
105  public: virtual void AddTorque(const math::Vector3 &_torque);
106 
107  // Documentation inherited
108  public: virtual void AddRelativeTorque(const math::Vector3 &_torque);
109 
110  // Documentation inherited
111  public: virtual math::Vector3 GetWorldLinearVel(
112  const math::Vector3 &_offset) const;
113 
114  // Documentation inherited
115  public: virtual math::Vector3 GetWorldLinearVel(
116  const math::Vector3 &_offset,
117  const math::Quaternion &_q) const;
118 
119  // Documentation inherited
120  public: virtual math::Vector3 GetWorldCoGLinearVel() const;
121 
122  // Documentation inherited
123  public: virtual math::Vector3 GetWorldAngularVel() const;
124 
125  // Documentation inherited
126  public: virtual math::Vector3 GetWorldForce() const;
127 
128  // Documentation inherited
129  public: virtual math::Vector3 GetWorldTorque() const;
130 
131  // Documentation inherited
132  public: virtual void SetGravityMode(bool _mode);
133 
134  // Documentation inherited
135  public: virtual bool GetGravityMode() const;
136 
137  // Documentation inherited
138  public: void SetSelfCollide(bool _collide);
139 
140  // Documentation inherited
141  public: virtual void SetLinearDamping(double _damping);
142 
143  // Documentation inherited
144  public: virtual void SetAngularDamping(double _damping);
145 
146  // Documentation inherited
147  public: virtual void SetKinematic(const bool &_state);
148 
149  // Documentation inherited
150  public: virtual bool GetKinematic() const;
151 
152  // Documentation inherited
153  public: virtual void SetAutoDisable(bool _disable);
154 
157  public: dBodyID GetODEId() const;
158 
161  public: dSpaceID GetSpaceId() const;
162 
165  public: void SetSpaceId(dSpaceID _spaceid);
166 
169  public: static void DisabledCallback(dBodyID _id);
170 
174  public: static void MoveCallback(dBodyID _id);
175 
176  // Documentation inherited
177  public: virtual void SetLinkStatic(bool _static);
178 
180  private: dBodyID linkId;
181 
183  private: ODEPhysicsPtr odePhysics;
184 
186  private: dSpaceID spaceId;
187 
189  private: math::Vector3 force;
190 
192  private: math::Vector3 torque;
193  };
194  }
195 }
196 #endif
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:259
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
boost::shared_ptr< ODEPhysics > ODEPhysicsPtr
Definition: ODETypes.hh:56
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:80
A quaternion class.
Definition: Quaternion.hh:42
static const Vector3 Zero
math::Vector3(0, 0, 0)
Definition: Vector3.hh:42
ODE wrapper forward declarations and typedefs.
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.