BulletLink.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_BULLET_BULLETLINK_HH_
18 #define GAZEBO_PHYSICS_BULLET_BULLETLINK_HH_
19 
22 #include "gazebo/physics/Link.hh"
23 #include "gazebo/util/system.hh"
24 
25 class btRigidBody;
26 
27 namespace gazebo
28 {
29  namespace physics
30  {
31  class BulletMotionState;
32 
35 
37  class GZ_PHYSICS_VISIBLE BulletLink : public Link
38  {
40  public: explicit BulletLink(EntityPtr _parent);
41 
43  public: virtual ~BulletLink();
44 
45  // Documentation inherited.
46  public: virtual void Load(sdf::ElementPtr _ptr);
47 
48  // Documentation inherited.
49  public: virtual void Init();
50 
51  // Documentation inherited.
52  public: virtual void Fini();
53 
54  // Documentation inherited.
55  public: virtual void OnPoseChange();
56 
57  // Documentation inherited.
58  public: virtual void SetEnabled(bool _enable) const;
59 
60  // Documentation inherited.
61  public: virtual bool GetEnabled() const;
62 
63  // Documentation inherited.
64  public: virtual void SetLinearVel(const ignition::math::Vector3d &_vel);
65 
66  // Documentation inherited.
67  public: virtual void SetAngularVel(const ignition::math::Vector3d &_vel);
68 
69  // Documentation inherited.
70  public: virtual void SetForce(const ignition::math::Vector3d &_force);
71 
72  // Documentation inherited.
73  public: virtual void SetTorque(const ignition::math::Vector3d &_torque);
74 
75  // Documentation inherited
76  public: virtual ignition::math::Vector3d WorldLinearVel(
77  const ignition::math::Vector3d &_offset) const;
78 
79  // Documentation inherited
80  public: virtual ignition::math::Vector3d WorldLinearVel(
81  const ignition::math::Vector3d &_offset,
82  const ignition::math::Quaterniond &_q) const;
83 
84  // Documentation inherited
85  public: virtual ignition::math::Vector3d WorldCoGLinearVel() const;
86 
87  // Documentation inherited.
88  public: virtual ignition::math::Vector3d WorldAngularVel() const;
89 
90  // Documentation inherited.
91  public: virtual ignition::math::Vector3d WorldForce() const;
92 
93  // Documentation inherited.
94  public: virtual ignition::math::Vector3d WorldTorque() const;
95 
96  // Documentation inherited.
97  public: virtual void SetGravityMode(bool _mode);
98 
99  // Documentation inherited.
100  public: virtual bool GetGravityMode() const;
101 
102  // Documentation inherited.
103  public: virtual void SetSelfCollide(bool _collide);
104 
107  public: btRigidBody *GetBulletLink() const;
108 
110  public: void RemoveAndAddBody() const;
111 
114  public: void ClearCollisionCache();
115 
116  // Documentation inherited.
117  public: virtual void SetLinearDamping(double _damping);
118 
119  // Documentation inherited.
120  public: virtual void SetAngularDamping(double _damping);
121 
123  // public: void SetCollisionRelativePose(BulletCollision *collision,
124  // const ignition::math::Pose3d &newPose);
125 
126  // Documentation inherited.
127  public: virtual void AddForce(const ignition::math::Vector3d &_force);
128 
129  // Documentation inherited.
130  public: virtual void AddRelativeForce(
131  const ignition::math::Vector3d &_force);
132 
133  // Documentation inherited.
134  public: virtual void AddForceAtWorldPosition(
135  const ignition::math::Vector3d &_force,
136  const ignition::math::Vector3d &_pos);
137 
138  // Documentation inherited.
139  public: virtual void AddForceAtRelativePosition(
140  const ignition::math::Vector3d &_force,
141  const ignition::math::Vector3d &_relpos);
142 
143  // Documentation inherited
144  public: virtual void AddLinkForce(
145  const ignition::math::Vector3d &_force,
146  const ignition::math::Vector3d &_offset =
147  ignition::math::Vector3d::Zero);
148 
149  // Documentation inherited.
150  public: virtual void AddTorque(const ignition::math::Vector3d &_torque);
151 
152  // Documentation inherited.
153  public: virtual void AddRelativeTorque(
154  const ignition::math::Vector3d &_torque);
155 
156  // Documentation inherited.
157  public: virtual void SetAutoDisable(bool _disable);
158 
159  // Documentation inherited
160  public: virtual void SetLinkStatic(bool _static);
161 
162  // Documentation inherited.
163  public: virtual void UpdateMass();
164 
167  private: btCollisionShape *compoundShape;
168 
172 
174  private: btRigidBody *rigidLink;
175 
177  private: BulletPhysicsPtr bulletPhysics;
178  };
180  }
181 }
182 #endif
boost::shared_ptr< BulletMotionState > BulletMotionStatePtr
Definition: BulletTypes.hh:43
boost::shared_ptr< BulletPhysics > BulletPhysicsPtr
Definition: BulletTypes.hh:44
Bullet 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.