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 2013 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 
27 namespace gazebo
28 {
29  namespace physics
30  {
34 
36  class SimbodyJoint : public Joint
37  {
39  public: SimbodyJoint(BasePtr _parent);
40 
42  public: virtual ~SimbodyJoint();
43 
44  // Documentation inherited.
45  public: virtual void Load(sdf::ElementPtr _sdf);
46 
47  // Documentation inherited.
48  public: virtual void Reset();
49 
50  // Documentation inherited.
51  public: virtual LinkPtr GetJointLink(int _index) const;
52 
53  // Documentation inherited.
54  public: virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const;
55 
56  // Documentation inherited.
57  public: virtual void Detach();
58 
59  // Documentation inherited.
60  public: virtual void SetAnchor(int _index,
61  const gazebo::math::Vector3 &_anchor);
62 
63  // Documentation inherited.
64  public: virtual void SetDamping(int _index, const double _damping);
65 
66  // Documentation inherited.
67  public: virtual math::Vector3 GetAnchor(int _index) const;
68 
69  // Documentation inherited.
70  public: virtual math::Vector3 GetLinkForce(unsigned int _index) const;
71 
72  // Documentation inherited.
73  public: virtual math::Vector3 GetLinkTorque(unsigned int _index) const;
74 
76  public: virtual void SetAttribute(Attribute, int _index, double _value);
77 
78  // Documentation inherited.
79  public: virtual void SetAttribute(const std::string &_key,
80  int _index, const boost::any &_value);
81 
82  // Documentation inherited.
83  public: virtual double GetAttribute(const std::string &_key,
84  unsigned int _index);
85 
86  // Save current Simbody State
87  public: virtual void SaveSimbodyState(const SimTK::State &_state);
88 
89  // Restore saved Simbody State
90  public: virtual void RestoreSimbodyState(SimTK::State &_state);
91 
92  // Documentation inherited.
93  public: virtual void SetForce(int _index, double _force);
94 
95  // Documentation inherited.
96  public: virtual double GetForce(unsigned int _index);
97 
98  // Documentation inherited.
99  public: virtual void SetAxis(int _index, const math::Vector3 &_axis);
100 
101  // Documentation inherited.
102  public: virtual JointWrench GetForceTorque(unsigned int _index);
103 
114  protected: virtual void SetForceImpl(int _index, double _force) = 0;
115 
119  private: void SaveForce(int _index, double _force);
120 
121  // Documentation inherited.
122  public: virtual void CacheForceTorque();
123 
127  public: bool mustBreakLoopHere;
128 
131  public: SimTK::Transform xPA;
132 
134  public: SimTK::Transform xCB;
135 
137  public: SimTK::Transform defxAB;
138 
144  public: SimTK::Force::MobilityLinearDamper damper;
145 
151  public: SimTK::Force::MobilityLinearStop limitForce;
152 
158  public: SimTK::MobilizedBody mobod;
159 
162  public: bool isReversed;
163 
169  public: SimTK::Constraint constraint;
170 
171  // Keeps track if simbody physics has been initialized
172  public: bool physicsInitialized;
173 
175  protected: SimTK::MultibodySystem *world;
176 
179 
185  private: double forceApplied[MAX_JOINT_AXIS];
186 
189  private: common::Time forceAppliedTime;
190  };
192  }
193 }
194 #endif