All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimbodyJoint.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 
18 #ifndef _SIMBODY_JOINT_HH_
19 #define _SIMBODY_JOINT_HH_
20 
21 #include <boost/any.hpp>
22 #include <string>
23 
25 #include "gazebo/physics/Joint.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace physics
31  {
35 
38  {
40  public: SimbodyJoint(BasePtr _parent);
41 
43  public: virtual ~SimbodyJoint();
44 
45  // Documentation inherited.
46  public: virtual void Load(sdf::ElementPtr _sdf);
47 
48  // Documentation inherited.
49  public: virtual void Reset();
50 
51  // Documentation inherited.
52  public: virtual LinkPtr GetJointLink(unsigned int _index) const;
53 
54  // Documentation inherited.
55  public: virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const;
56 
57  // Documentation inherited.
58  public: virtual void Detach();
59 
60  // Documentation inherited.
61  public: virtual void SetAnchor(unsigned int _index,
62  const gazebo::math::Vector3 &_anchor);
63 
64  // Documentation inherited.
65  public: virtual void SetDamping(unsigned int _index,
66  const double _damping);
67 
68  // Documentation inherited.
69  public: virtual void SetStiffness(unsigned int _index,
70  const double _stiffness);
71 
72  // Documentation inherited.
73  public: virtual void SetStiffnessDamping(unsigned int _index,
74  double _stiffness, double _damping, double _reference = 0);
75 
76  // Documentation inherited.
77  public: virtual math::Vector3 GetAnchor(unsigned int _index) const;
78 
79  // Documentation inherited.
80  public: virtual math::Vector3 GetLinkForce(unsigned int _index) const;
81 
82  // Documentation inherited.
83  public: virtual math::Vector3 GetLinkTorque(unsigned int _index) const;
84 
86  public: virtual void SetAttribute(Attribute, unsigned int _index,
87  double _value);
88 
89  // Documentation inherited.
90  public: virtual bool SetParam(const std::string &_key,
91  unsigned int _index,
92  const boost::any &_value);
93 
94  // Documentation inherited.
95  public: virtual void SetAttribute(const std::string &_key,
96  unsigned int _index,
97  const boost::any &_value)
98  GAZEBO_DEPRECATED(3.0);
99 
100  // Documentation inherited.
101  public: virtual double GetParam(const std::string &_key,
102  unsigned int _index);
103 
104  // Documentation inherited.
105  public: virtual double GetAttribute(const std::string &_key,
106  unsigned int _index) GAZEBO_DEPRECATED(3.0);
107 
108  // Save current Simbody State
109  public: virtual void SaveSimbodyState(const SimTK::State &_state);
110 
111  // Restore saved Simbody State
112  public: virtual void RestoreSimbodyState(SimTK::State &_state);
113 
114  // Documentation inherited.
115  public: virtual void SetForce(unsigned int _index, double _force);
116 
117  // Documentation inherited.
118  public: virtual double GetForce(unsigned int _index);
119 
120  // Documentation inherited.
121  public: virtual void SetAxis(unsigned int _index,
122  const math::Vector3 &_axis);
123 
124  // Documentation inherited.
125  public: virtual JointWrench GetForceTorque(unsigned int _index);
126 
137  protected: virtual void SetForceImpl(unsigned int _index,
138  double _force) = 0;
139 
143  private: void SaveForce(unsigned int _index, double _force);
144 
145  // Documentation inherited.
146  public: virtual void CacheForceTorque();
147 
151  public: bool mustBreakLoopHere;
152 
155  public: SimTK::Transform xPA;
156 
158  public: SimTK::Transform xCB;
159 
161  public: SimTK::Transform defxAB;
162 
168  public: SimTK::Force::MobilityLinearSpring spring[MAX_JOINT_AXIS];
169 
174  public: SimTK::Force::MobilityLinearDamper damper[MAX_JOINT_AXIS];
175 
181  public: SimTK::Force::MobilityLinearStop limitForce[MAX_JOINT_AXIS];
182 
188  public: SimTK::MobilizedBody mobod;
189 
192  public: bool isReversed;
193 
199  public: SimTK::Constraint constraint;
200 
201  // Keeps track if simbody physics has been initialized
202  public: bool physicsInitialized;
203 
204  // Documentation inherited.
205  public: virtual bool SetHighStop(unsigned int _index,
206  const math::Angle &_angle);
207 
208  // Documentation inherited.
209  public: virtual bool SetLowStop(unsigned int _index,
210  const math::Angle &_angle);
211 
212  // Documentation inherited.
213  public: virtual math::Angle GetHighStop(unsigned int _index);
214 
215  // Documentation inherited.
216  public: virtual math::Angle GetLowStop(unsigned int _index);
217 
219  protected: SimTK::MultibodySystem *world;
220 
223 
232  private: double forceApplied[MAX_JOINT_AXIS];
233 
236  private: common::Time forceAppliedTime;
237  };
239  }
240 }
241 #endif
SimbodyPhysicsPtr simbodyPhysics
keep a pointer to the simbody physics engine for convenience
Definition: SimbodyJoint.hh:222
SimTK::Transform xPA
Normally A=F, B=M.
Definition: SimbodyJoint.hh:155
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:65
bool isReversed
: if mobilizer, did it reverse parent&child? Set when we build the Simbody model. ...
Definition: SimbodyJoint.hh:192
SimTK::MobilizedBody mobod
Use isValid() if we used a mobilizer Set when we build the Simbody model.
Definition: SimbodyJoint.hh:188
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
SimTK::Constraint constraint
: isValid() if we used a constraint to model this joint.
Definition: SimbodyJoint.hh:199
SimTK::MultibodySystem * world
Simbody Multibody System.
Definition: SimbodyJoint.hh:219
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:44
bool physicsInitialized
Definition: SimbodyJoint.hh:202
boost::shared_ptr< SimbodyPhysics > SimbodyPhysicsPtr
Definition: SimbodyTypes.hh:37
Base class for all joints.
Definition: SimbodyJoint.hh:37
bool mustBreakLoopHere
Force Simbody to break a loop by using a weld constraint.
Definition: SimbodyJoint.hh:151
SimTK::Transform xCB
child body frame to mobilizer frame
Definition: SimbodyJoint.hh:158
#define MAX_JOINT_AXIS
maximum number of axis per joint anticipated.
Definition: Joint.hh:39
SimTK::Transform defxAB
default mobilizer pose
Definition: SimbodyJoint.hh:161
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
An angle and related functions.
Definition: Angle.hh:52
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:89
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:43