ODELink.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 #ifndef GAZEBO_PHYSICS_ODE_ODELINK_HH_
18 #define GAZEBO_PHYSICS_ODE_ODELINK_HH_
19 
20 #include <ignition/math/Vector3.hh>
21 
24 #include "gazebo/physics/Link.hh"
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace physics
30  {
33 
35  class GZ_PHYSICS_VISIBLE ODELink : public Link
36  {
39  public: explicit ODELink(EntityPtr _parent);
40 
42  public: virtual ~ODELink();
43 
44  // Documentation inherited
45  public: virtual void Load(sdf::ElementPtr _sdf);
46 
47  // Documentation inherited
48  public: virtual void Init();
49 
50  // Documentation inherited
51  public: virtual void Fini();
52 
53  // Documentation inherited
54  public: virtual void OnPoseChange();
55 
56  // Documentation inherited
57  public: virtual void SetEnabled(bool _enable) const;
58 
59  // Documentation inherited
60  public: virtual bool GetEnabled() const;
61 
66  public: void UpdateCollisionOffsets();
67 
68  // Documentation inherited
69  public: virtual void UpdateMass();
70 
71  // Documentation inherited
72  public: virtual void UpdateSurface();
73 
74  // Documentation inherited
75  public: virtual void SetLinearVel(const ignition::math::Vector3d &_vel);
76 
77  // Documentation inherited
78  public: virtual void SetAngularVel(const ignition::math::Vector3d &_vel);
79 
80  // Documentation inherited
81  public: virtual void SetForce(const ignition::math::Vector3d &_force);
82 
83  // Documentation inherited
84  public: virtual void SetTorque(const ignition::math::Vector3d &_torque);
85 
86  // Documentation inherited
87  public: virtual void AddForce(const ignition::math::Vector3d &_force);
88 
89  // Documentation inherited
90  public: virtual void AddRelativeForce(
91  const ignition::math::Vector3d &_force);
92 
93  // Documentation inherited
94  public: virtual void AddForceAtWorldPosition(
95  const ignition::math::Vector3d &_force,
96  const ignition::math::Vector3d &_pos);
97 
98  // Documentation inherited
99  public: virtual void AddForceAtRelativePosition(
100  const ignition::math::Vector3d &_force,
101  const ignition::math::Vector3d &_relpos);
102 
103  // Documentation inherited
104  public: virtual void AddLinkForce(
105  const ignition::math::Vector3d &_force,
106  const ignition::math::Vector3d &_offset =
107  ignition::math::Vector3d::Zero);
108 
109  // Documentation inherited
110  public: virtual void AddTorque(const ignition::math::Vector3d &_torque);
111 
112  // Documentation inherited
113  public: virtual void AddRelativeTorque(
114  const ignition::math::Vector3d &_torque);
115 
116  // Documentation inherited
117  public: virtual ignition::math::Vector3d WorldLinearVel(
118  const ignition::math::Vector3d &_offset) const;
119 
120  // Documentation inherited
121  public: virtual ignition::math::Vector3d WorldLinearVel(
122  const ignition::math::Vector3d &_offset,
123  const ignition::math::Quaterniond &_q) const;
124 
125  // Documentation inherited
126  public: virtual ignition::math::Vector3d WorldCoGLinearVel() const;
127 
128  // Documentation inherited
129  public: virtual ignition::math::Vector3d WorldAngularVel() const;
130 
131  // Documentation inherited
132  public: virtual ignition::math::Vector3d WorldForce() const;
133 
134  // Documentation inherited
135  public: virtual ignition::math::Vector3d WorldTorque() const;
136 
137  // Documentation inherited
138  public: virtual void SetGravityMode(bool _mode);
139 
140  // Documentation inherited
141  public: virtual bool GetGravityMode() const;
142 
143  // Documentation inherited
144  public: void SetSelfCollide(bool _collide);
145 
146  // Documentation inherited
147  public: virtual void SetLinearDamping(double _damping);
148 
149  // Documentation inherited
150  public: virtual void SetAngularDamping(double _damping);
151 
152  // Documentation inherited
153  public: virtual void SetKinematic(const bool &_state);
154 
155  // Documentation inherited
156  public: virtual bool GetKinematic() const;
157 
158  // Documentation inherited
159  public: virtual void SetAutoDisable(bool _disable);
160 
163  public: dBodyID GetODEId() const;
164 
167  public: dSpaceID GetSpaceId() const;
168 
171  public: void SetSpaceId(dSpaceID _spaceid);
172 
175  public: static void DisabledCallback(dBodyID _id);
176 
180  public: static void MoveCallback(dBodyID _id);
181 
182  // Documentation inherited
183  public: virtual void SetLinkStatic(bool _static);
184 
186  private: dBodyID linkId;
187 
189  private: ODEPhysicsPtr odePhysics;
190 
192  private: dSpaceID spaceId;
193 
195  private: ignition::math::Vector3d force;
196 
198  private: ignition::math::Vector3d torque;
199  };
201  }
202 }
203 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
boost::shared_ptr< ODEPhysics > ODEPhysicsPtr
Definition: ODETypes.hh:59
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.