BulletLink.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: Bullet Link class
18  * Author: Nate Koenig
19  * Date: 15 May 2009
20  */
21 
22 #ifndef _BULLETLINK_HH_
23 #define _BULLETLINK_HH_
24 
27 #include "gazebo/physics/Link.hh"
28 #include "gazebo/util/system.hh"
29 
30 class btRigidBody;
31 
32 namespace gazebo
33 {
34  namespace physics
35  {
36  class BulletMotionState;
37 
42 
45  {
47  public: BulletLink(EntityPtr _parent);
48 
50  public: virtual ~BulletLink();
51 
52  // Documentation inherited.
53  public: virtual void Load(sdf::ElementPtr _ptr);
54 
55  // Documentation inherited.
56  public: virtual void Init();
57 
58  // Documentation inherited.
59  public: virtual void Fini();
60 
61  // Documentation inherited.
62  public: virtual void OnPoseChange();
63 
64  // Documentation inherited.
65  public: virtual void SetEnabled(bool _enable) const;
66 
67  // Documentation inherited.
68  public: virtual bool GetEnabled() const;
69 
70  // Documentation inherited.
71  public: virtual void SetLinearVel(const math::Vector3 &_vel);
72 
73  // Documentation inherited.
74  public: virtual void SetAngularVel(const math::Vector3 &_vel);
75 
76  // Documentation inherited.
77  public: virtual void SetForce(const math::Vector3 &_force);
78 
79  // Documentation inherited.
80  public: virtual void SetTorque(const math::Vector3 &_torque);
81 
82  // Documentation inherited
83  public: virtual math::Vector3 GetWorldLinearVel(
84  const math::Vector3 &_offset) const;
85 
86  // Documentation inherited
87  public: virtual math::Vector3 GetWorldLinearVel(
88  const math::Vector3 &_offset,
89  const math::Quaternion &_q) const;
90 
91  // Documentation inherited
92  public: virtual math::Vector3 GetWorldCoGLinearVel() const;
93 
94  // Documentation inherited.
95  public: virtual math::Vector3 GetWorldAngularVel() const;
96 
97  // Documentation inherited.
98  public: virtual math::Vector3 GetWorldForce() const;
99 
100  // Documentation inherited.
101  public: virtual math::Vector3 GetWorldTorque() const;
102 
103  // Documentation inherited.
104  public: virtual void SetGravityMode(bool _mode);
105 
106  // Documentation inherited.
107  public: virtual bool GetGravityMode() const;
108 
109  // Documentation inherited.
110  public: virtual void SetSelfCollide(bool _collide);
111 
114  public: btRigidBody *GetBulletLink() const;
115 
118  public: void ClearCollisionCache();
119 
120  // Documentation inherited.
121  public: virtual void SetLinearDamping(double _damping);
122 
123  // Documentation inherited.
124  public: virtual void SetAngularDamping(double _damping);
125 
127  /*public: void SetCollisionRelativePose(BulletCollision *collision,
128  const math::Pose &newPose);
129  */
130 
131  // Documentation inherited.
132  public: virtual void AddForce(const math::Vector3 &_force);
133 
134  // Documentation inherited.
135  public: virtual void AddRelativeForce(const math::Vector3 &_force);
136 
137  // Documentation inherited.
138  public: virtual void AddForceAtWorldPosition(const math::Vector3 &_force,
139  const math::Vector3 &_pos);
140 
141  // Documentation inherited.
142  public: virtual void AddForceAtRelativePosition(
143  const math::Vector3 &_force,
144  const math::Vector3 &_relpos);
145 
146  // Documentation inherited.
147  public: virtual void AddTorque(const math::Vector3 &_torque);
148 
149  // Documentation inherited.
150  public: virtual void AddRelativeTorque(const math::Vector3 &_torque);
151 
152  // Documentation inherited.
153  public: virtual void SetAutoDisable(bool _disable);
154 
155  // Documentation inherited
156  public: virtual void SetLinkStatic(bool _static);
157 
160  private: btCollisionShape *compoundShape;
161 
165 
167  private: btRigidBody *rigidLink;
168 
170  private: BulletPhysicsPtr bulletPhysics;
171  };
173  }
174 }
175 #endif
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
boost::shared_ptr< BulletMotionState > BulletMotionStatePtr
Definition: BulletTypes.hh:45
Bullet wrapper forward declarations and typedefs.
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:74
A quaternion class.
Definition: Quaternion.hh:41
boost::shared_ptr< BulletPhysics > BulletPhysicsPtr
Definition: BulletTypes.hh:46
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