BulletUniversalJoint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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_BULLETUNIVERSALJOINT_HH_
18 #define _GAZEBO_BULLETUNIVERSALJOINT_HH_
19 
20 #include <string>
25 #include "gazebo/util/system.hh"
26 
27 class btUniversalConstraint;
28 
29 namespace gazebo
30 {
31  namespace physics
32  {
36 
39  : public UniversalJoint<BulletJoint>
40  {
42  public: BulletUniversalJoint(btDynamicsWorld *world, BasePtr _parent);
43 
45  public: virtual ~BulletUniversalJoint();
46 
47  // Documentation inherited.
48  public: virtual void Load(sdf::ElementPtr _sdf);
49 
50  // Documentation inherited.
51  public: virtual void Init();
52 
53  // Documentation inherited.
54  public: virtual math::Vector3 GetAnchor(unsigned int _index) const;
55 
56  // Documentation inherited.
57  public: void SetAxis(unsigned int _index, const math::Vector3 &_axis);
58 
59  // Documentation inherited.
60  public: virtual void SetVelocity(unsigned int _index, double _angle);
61 
62  // Documentation inherited.
63  public: virtual double GetVelocity(unsigned int _index) const;
64 
65  // Documentation inherited.
66  public: virtual bool SetHighStop(unsigned int _index,
67  const math::Angle &_angle);
68 
69  // Documentation inherited.
70  public: virtual bool SetLowStop(unsigned int _index,
71  const math::Angle &_angle);
72 
73  // Documentation inherited.
74  public: virtual math::Angle GetHighStop(unsigned int _index);
75 
76  // Documentation inherited.
77  public: virtual math::Angle GetLowStop(unsigned int _index);
78 
79  // Documentation inherited. \sa Joint::GetGlobalAxis
80  public: virtual math::Vector3 GetGlobalAxis(unsigned int _index) const;
81 
82  // Documentation inherited. \sa Joint::GetAngleImpl
83  public: virtual math::Angle GetAngleImpl(unsigned int _index) const;
84 
85  // Documentation inherited.
86  public: virtual bool SetParam(const std::string &_key,
87  unsigned int _index,
88  const boost::any &_value);
89 
90  // Documentation inherited.
91  public: virtual double GetParam(const std::string &_key,
92  unsigned int _index);
93 
94  // Documentation inherited. \sa void BulletJoint::SetForceImpl
95  protected: virtual void SetForceImpl(unsigned int _index, double _torque);
96 
98  private: gzBtUniversalConstraint *bulletUniversal;
99 
102  private: double angleOffset[2];
103 
106  private: math::Vector3 initialWorldAxis[2];
107  };
109  }
110 }
111 #endif
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:72
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:259
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
gzBtUniversalConstraint(btRigidBody &_rbA, btRigidBody &_rbB, const btVector3 &_anchor, const btVector3 &_axis1, const btVector3 &_axis2)
Constructor.
A bullet universal joint class.
Definition: BulletUniversalJoint.hh:38
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
A universal joint.
Definition: UniversalJoint.hh:36
An angle and related functions.
Definition: Angle.hh:53