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: 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 
111  public: void ClearCollisionCache();
112 
113  // Documentation inherited.
114  public: virtual void SetLinearDamping(double _damping);
115 
116  // Documentation inherited.
117  public: virtual void SetAngularDamping(double _damping);
118 
120  // public: void SetCollisionRelativePose(BulletCollision *collision,
121  // const ignition::math::Pose3d &newPose);
122 
123  // Documentation inherited.
124  public: virtual void AddForce(const ignition::math::Vector3d &_force);
125 
126  // Documentation inherited.
127  public: virtual void AddRelativeForce(
128  const ignition::math::Vector3d &_force);
129 
130  // Documentation inherited.
131  public: virtual void AddForceAtWorldPosition(
132  const ignition::math::Vector3d &_force,
133  const ignition::math::Vector3d &_pos);
134 
135  // Documentation inherited.
136  public: virtual void AddForceAtRelativePosition(
137  const ignition::math::Vector3d &_force,
138  const ignition::math::Vector3d &_relpos);
139 
140  // Documentation inherited
141  public: virtual void AddLinkForce(
142  const ignition::math::Vector3d &_force,
143  const ignition::math::Vector3d &_offset =
144  ignition::math::Vector3d::Zero);
145 
146  // Documentation inherited.
147  public: virtual void AddTorque(const ignition::math::Vector3d &_torque);
148 
149  // Documentation inherited.
150  public: virtual void AddRelativeTorque(
151  const ignition::math::Vector3d &_torque);
152 
153  // Documentation inherited.
154  public: virtual void SetAutoDisable(bool _disable);
155 
156  // Documentation inherited
157  public: virtual void SetLinkStatic(bool _static);
158 
159  // Documentation inherited.
160  public: virtual void UpdateMass();
161 
164  private: btCollisionShape *compoundShape;
165 
169 
171  private: btRigidBody *rigidLink;
172 
174  private: BulletPhysicsPtr bulletPhysics;
175  };
177  }
178 }
179 #endif
boost::shared_ptr< BulletMotionState > BulletMotionStatePtr
Definition: BulletTypes.hh:46
Forward declarations for the common classes.
Definition: Animation.hh:33
boost::shared_ptr< BulletPhysics > BulletPhysicsPtr
Definition: BulletTypes.hh:47
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.