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  {
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 AddLinkForce(const math::Vector3 &_force,
96  const math::Vector3 &_offset = math::Vector3::Zero);
97 
98  // Documentation inherited
99  public: virtual void AddTorque(const math::Vector3 &_torque);
100 
101  // Documentation inherited
102  public: virtual void AddRelativeTorque(const math::Vector3 &_torque);
103 
104  // Documentation inherited
105  public: virtual math::Vector3 GetWorldLinearVel(
106  const math::Vector3 &_offset) const;
107 
108  // Documentation inherited
109  public: virtual math::Vector3 GetWorldLinearVel(
110  const math::Vector3 &_offset,
111  const math::Quaternion &_q) const;
112 
113  // Documentation inherited
114  public: virtual math::Vector3 GetWorldCoGLinearVel() const;
115 
116  // Documentation inherited
117  public: virtual math::Vector3 GetWorldAngularVel() const;
118 
119  // Documentation inherited
120  public: virtual math::Vector3 GetWorldForce() const;
121 
122  // Documentation inherited
123  public: virtual math::Vector3 GetWorldTorque() const;
124 
125  // Documentation inherited
126  public: virtual void SetGravityMode(bool _mode);
127 
128  // Documentation inherited
129  public: virtual bool GetGravityMode() const;
130 
131  // Documentation inherited
132  public: void SetSelfCollide(bool _collide);
133 
134  // Documentation inherited
135  public: virtual void SetLinearDamping(double _damping);
136 
137  // Documentation inherited
138  public: virtual void SetAngularDamping(double _damping);
139 
140  // Documentation inherited
141  public: virtual void SetKinematic(const bool &_state);
142 
143  // Documentation inherited
144  public: virtual bool GetKinematic() const;
145 
146  // Documentation inherited
147  public: virtual void SetAutoDisable(bool _disable);
148 
151  public: dBodyID GetODEId() const;
152 
155  public: dSpaceID GetSpaceId() const;
156 
159  public: void SetSpaceId(dSpaceID _spaceid);
160 
163  public: static void DisabledCallback(dBodyID _id);
164 
168  public: static void MoveCallback(dBodyID _id);
169 
170  // Documentation inherited
171  public: virtual void SetLinkStatic(bool _static);
172 
174  private: dBodyID linkId;
175 
177  private: ODEPhysicsPtr odePhysics;
178 
180  private: dSpaceID spaceId;
181 
183  private: math::Vector3 force;
184 
186  private: math::Vector3 torque;
187  };
188  }
189 }
190 #endif
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
#define GZ_PHYSICS_ODE_VISIBLE
Definition: system.hh:343
boost::shared_ptr< ODEPhysics > ODEPhysicsPtr
Definition: ODETypes.hh:56
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:76
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.