BulletUniversalJoint.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_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 
38  class GZ_PHYSICS_VISIBLE BulletUniversalJoint
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 ignition::math::Vector3d Anchor(
55  const unsigned int _index) const;
56 
57  // Documentation inherited.
58  public: void SetAxis(const unsigned int _index,
59  const ignition::math::Vector3d &_axis);
60 
61  // Documentation inherited.
62  public: virtual void SetVelocity(unsigned int _index, double _angle);
63 
64  // Documentation inherited.
65  public: virtual double GetVelocity(unsigned int _index) const;
66 
67  // Documentation inherited.
68  public: virtual void SetUpperLimit(const unsigned int _index,
69  const double _limit);
70 
71  // Documentation inherited.
72  public: virtual void SetLowerLimit(const unsigned int _index,
73  const double _limit);
74 
75  // Documentation inherited.
76  public: virtual double UpperLimit(const unsigned int _index) const;
77 
78  // Documentation inherited.
79  public: virtual double LowerLimit(const unsigned int _index) const;
80 
81  // Documentation inherited. \sa Joint::GlobalAxis
82  public: virtual ignition::math::Vector3d GlobalAxis(
83  const unsigned int _index) const;
84 
85  // Documentation inherited.
86  public: virtual double PositionImpl(const unsigned int _index) const;
87 
88  // Documentation inherited.
89  public: virtual bool SetParam(const std::string &_key,
90  unsigned int _index,
91  const boost::any &_value);
92 
93  // Documentation inherited.
94  public: virtual double GetParam(const std::string &_key,
95  unsigned int _index);
96 
97  // Documentation inherited. \sa void BulletJoint::SetForceImpl
98  protected: virtual void SetForceImpl(unsigned int _index, double _torque);
99 
101  private: gzBtUniversalConstraint *bulletUniversal;
102 
105  private: double angleOffset[2];
106 
109  private: ignition::math::Vector3d initialWorldAxis[2];
110  };
112  }
113 }
114 #endif
Forward declarations for the common classes.
Definition: Animation.hh:26
Functions that implement a universal joint/constraint using bullet.
Definition: gzBtUniversalConstraint.hh:28
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:35
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77