All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BulletJoint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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 /* Desc: The base Bullet joint class
18  * Author: Nate Koenig, Andrew Howard
19  * Date: 21 May 2003
20  */
21 
22 #ifndef _BULLETJOINT_HH_
23 #define _BULLETJOINT_HH_
24 
25 #include <boost/any.hpp>
26 #include <string>
27 
29 #include "gazebo/physics/Joint.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
34  namespace physics
35  {
39 
42  {
44  public: BulletJoint(BasePtr _parent);
45 
47  public: virtual ~BulletJoint();
48 
50  public: virtual void Load(sdf::ElementPtr _sdf);
51 
53  public: virtual void Reset();
54 
57  public: LinkPtr GetJointLink(unsigned int _index) const;
58 
60  public: bool AreConnected(LinkPtr _one, LinkPtr _two) const;
61 
63  public: virtual void Detach();
64 
66  public: virtual void SetAnchor(unsigned int _index,
67  const gazebo::math::Vector3 &_anchor);
68 
69  // Documentation inherited
70  public: virtual void SetDamping(unsigned int _index, double _damping);
71 
72  // Documentation inherited.
73  public: virtual bool SetPosition(unsigned int _index, double _position);
74 
75  // Documentation inherited.
76  public: virtual void SetStiffness(unsigned int _index,
77  const double _stiffness);
78 
79  // Documentation inherited.
80  public: virtual void SetStiffnessDamping(unsigned int _index,
81  double _stiffness, double _damping, double _reference = 0);
82 
84  public: virtual math::Vector3 GetAnchor(unsigned int _index) const;
85 
88  public: virtual math::Vector3 GetLinkForce(unsigned int _index) const;
89 
92  public: virtual math::Vector3 GetLinkTorque(unsigned int _index) const;
93 
95  public: virtual void SetAttribute(Attribute, unsigned int _index,
96  double _value);
97 
98  // Documentation inherited.
99  public: virtual bool SetParam(const std::string &_key,
100  unsigned int _index,
101  const boost::any &_value);
102 
103  // Documentation inherited.
104  public: virtual double GetParam(const std::string &_key,
105  unsigned int _index);
106 
107  // Documentation inherited.
108  public: virtual math::Angle GetHighStop(unsigned int _index);
109 
110  // Documentation inherited.
111  public: virtual math::Angle GetLowStop(unsigned int _index);
112 
113  // Documentation inherited.
114  public: virtual void CacheForceTorque();
115 
116  // Documentation inherited.
117  public: virtual JointWrench GetForceTorque(unsigned int _index);
118 
119  // Documentation inherited.
120  public: virtual void SetForce(unsigned int _index, double _force);
121 
122  // Documentation inherited.
123  public: virtual double GetForce(unsigned int _index);
124 
125  // Documentation inherited.
126  public: virtual void Init();
127 
128  // Documentation inherited.
129  public: virtual void ApplyStiffnessDamping();
130 
141  protected: virtual void SetForceImpl(unsigned int _index,
142  double _force) = 0;
143 
146  protected: void SetupJointFeedback();
147 
151  private: void SaveForce(unsigned int _index, double _force);
152 
154  protected: btTypedConstraint *constraint;
155 
157  protected: btDynamicsWorld *bulletWorld;
158 
160  private: btJointFeedback *feedback;
161 
164  private: bool stiffnessDampingInitialized;
165 
171  private: double forceApplied[MAX_JOINT_AXIS];
172 
175  private: common::Time forceAppliedTime;
176  };
178  }
179 }
180 #endif
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:66
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
#define MAX_JOINT_AXIS
maximum number of axis per joint anticipated.
Definition: Joint.hh:39
Base class for all joints.
Definition: Joint.hh:50
Attribute
Joint attribute types.
Definition: Joint.hh:54
Wrench information from a joint.
Definition: JointWrench.hh:39
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
btDynamicsWorld * bulletWorld
Pointer to Bullet's btDynamicsWorld.
Definition: BulletJoint.hh:157
An angle and related functions.
Definition: Angle.hh:52
btTypedConstraint * constraint
Pointer to a contraint object in Bullet.
Definition: BulletJoint.hh:154
Base class for all joints.
Definition: BulletJoint.hh:41
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:90
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:43