BulletUniversalJoint.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 #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 void SetMaxForce(unsigned int _index, double _t);
67 
68  // Documentation inherited.
69  public: virtual double GetMaxForce(unsigned int _index);
70 
71  // Documentation inherited.
72  public: virtual bool SetHighStop(unsigned int _index,
73  const math::Angle &_angle);
74 
75  // Documentation inherited.
76  public: virtual bool SetLowStop(unsigned int _index,
77  const math::Angle &_angle);
78 
79  // Documentation inherited.
80  public: virtual math::Angle GetHighStop(unsigned int _index);
81 
82  // Documentation inherited.
83  public: virtual math::Angle GetLowStop(unsigned int _index);
84 
85  // Documentation inherited. \sa Joint::GetGlobalAxis
86  public: virtual math::Vector3 GetGlobalAxis(unsigned int _index) const;
87 
88  // Documentation inherited. \sa Joint::GetAngleImpl
89  public: virtual math::Angle GetAngleImpl(unsigned int _index) const;
90 
91  // Documentation inherited.
92  public: virtual bool SetParam(const std::string &_key,
93  unsigned int _index,
94  const boost::any &_value);
95 
96  // Documentation inherited.
97  public: virtual double GetParam(const std::string &_key,
98  unsigned int _index);
99 
100  // Documentation inherited. \sa void BulletJoint::SetForceImpl
101  protected: virtual void SetForceImpl(unsigned int _index, double _torque);
102 
104  private: gzBtUniversalConstraint *bulletUniversal;
105 
108  private: double angleOffset[2];
109 
112  private: math::Vector3 initialWorldAxis[2];
113  };
115  }
116 }
117 #endif
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:68
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
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