DARTJoint.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 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 _GAZEBO_DARTJOINT_HH_
19#define _GAZEBO_DARTJOINT_HH_
20
21#include <boost/any.hpp>
22#include <string>
23
28#include "gazebo/util/system.hh"
29
30namespace gazebo
31{
32 namespace physics
33 {
35 class DARTJointPrivate;
36
39
41 class GZ_PHYSICS_VISIBLE DARTJoint : public Joint
42 {
45 public: explicit DARTJoint(BasePtr _parent);
46
48 public: virtual ~DARTJoint();
49
50 // Documentation inherited.
51 public: virtual void Load(sdf::ElementPtr _sdf) override;
52
54 public: virtual void Init() override;
55
56 // Documentation inherited.
57 public: virtual void SetName(const std::string &_name) override;
58
59 // Documentation inherited.
60 public: virtual void Reset() override;
61
62 // Documentation inherited.
63 public: virtual LinkPtr GetJointLink(unsigned int _index) const override;
64
65 // Documentation inherited.
66 public: virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const
67 override;
68
69 // Documentation inherited.
70 public: virtual void Attach(LinkPtr _parent, LinkPtr _child) override;
71
72 // Documentation inherited.
73 public: virtual void Detach() override;
74
75 // Documentation inherited
76 public: virtual void SetDamping(unsigned int _index, double _damping)
77 override;
78
79 // Documentation inherited.
80 public: virtual void SetStiffnessDamping(unsigned int _index,
81 double _stiffness, double _damping, double _reference = 0) override;
82
83 // Documentation inherited.
84 public: virtual void SetStiffness(unsigned int _index,
85 const double _stiffness) override;
86
88 public: virtual void SetAnchor(const unsigned int /*_index*/,
89 const ignition::math::Vector3d &/*_anchor*/) override;
90
91 public: virtual ignition::math::Vector3d Anchor(
92 const unsigned int /*_index*/) const override final;
93
94 // Documentation inherited
95 public: virtual void SetVelocity(unsigned int _index, double _vel)
96 override final;
97
98 // Documentation inherited
99 public: virtual double GetVelocity(unsigned int _index)
100 const override;
101
102 // Documentation inherited.
103 public: virtual void SetForce(unsigned int _index, double _force)
104 override;
105
106 // Documentation inherited.
107 public: virtual double GetForce(unsigned int _index) override;
108
109 // Documentation inherited.
110 public: virtual JointWrench GetForceTorque(unsigned int _index) override;
111
112 // Documentation inherited.
113 public: virtual bool SetPosition(
114 const unsigned int _index,
115 const double _position,
116 const bool _preserveWorldVelocity = false)
117 override final;
118
119 // Documentation inherited.
120 public: virtual ignition::math::Vector3d LinkForce(
121 const unsigned int _index) const override;
122
123 // Documentation inherited.
124 public: virtual ignition::math::Vector3d LinkTorque(
125 const unsigned int _index) const override;
126
127 // Documentation inherited.
128 public: virtual bool SetParam(const std::string &_key,
129 unsigned int _index,
130 const boost::any &_value) override;
131
132 // Documentation inherited.
133 public: virtual double GetParam(const std::string &_key,
134 unsigned int _index) override;
135
136 // Documentation inherited.
137 public: virtual double LowerLimit(const unsigned int _index) const
138 override;
139
140 // Documentation inherited.
141 public: virtual double UpperLimit(const unsigned int _index) const
142 override;
143
144 // Documentation inherited.
145 public: virtual void SetLowerLimit(const unsigned int _index,
146 const double _limit) override;
147
148 // Documentation inherited.
149 public: virtual void SetUpperLimit(const unsigned int _index,
150 const double _limit) override;
151
152 // Documentation inherited.
153 public: virtual void CacheForceTorque() override;
154
155 // Documentation inherited.
156 protected: virtual double PositionImpl(const unsigned int _index = 0)
157 const override;
158
159 // Documentation inherited.
160 public: virtual void ApplyDamping();
161
170 protected: void SetForceImpl(unsigned int _index, double _force);
171
175 private: void SaveForce(unsigned int _index, double _force);
176
179 public: DARTModelPtr GetDARTModel() const;
180
182 public: DARTJointPropPtr DARTProperties() const;
183
186 public: void SetDARTJoint(dart::dynamics::Joint *_dtJoint);
187
190 public: dart::dynamics::Joint *GetDARTJoint();
191
194 protected: DARTJointPrivate *dataPtr;
195 };
197 }
198}
199#endif
DART joint interface.
Definition DARTJoint.hh:42
virtual bool SetPosition(const unsigned int _index, const double _position, const bool _preserveWorldVelocity=false) override final
The child links of this joint are updated based on desired position.
virtual void SetDamping(unsigned int _index, double _damping) override
Set the joint damping.
virtual void Attach(LinkPtr _parent, LinkPtr _child) override
Attach the two bodies with this joint.
virtual double PositionImpl(const unsigned int _index=0) const override
Helper function to get the position of an axis.
virtual ignition::math::Vector3d LinkForce(const unsigned int _index) const override
Get the forces applied to the center of mass of a physics::Link due to the existence of this Joint.
virtual double GetVelocity(unsigned int _index) const override
Get the rotation rate of an axis(index)
virtual void Detach() override
Detach this joint from all links.
DARTJointPropPtr DARTProperties() const
Get DART Joint properties.
virtual ignition::math::Vector3d Anchor(const unsigned int) const override final
Get the anchor point.
virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const override
Determines of the two bodies are connected by a joint.
virtual ignition::math::Vector3d LinkTorque(const unsigned int _index) const override
Get the torque applied to the center of mass of a physics::Link due to the existence of this Joint.
virtual double LowerLimit(const unsigned int _index) const override
Get the joint's lower limit.
DARTModelPtr GetDARTModel() const
Get DART model pointer.
virtual void SetName(const std::string &_name) override
Set the name of the entity.
virtual void ApplyDamping()
virtual JointWrench GetForceTorque(unsigned int _index) override
get internal force and torque values at a joint.
virtual void SetAnchor(const unsigned int, const ignition::math::Vector3d &) override
Set the anchor point.
virtual double GetForce(unsigned int _index) override
void SetDARTJoint(dart::dynamics::Joint *_dtJoint)
Set DART joint pointer.
void SetForceImpl(unsigned int _index, double _force)
Set the force applied to this physics::Joint.
virtual double GetParam(const std::string &_key, unsigned int _index) override
Get a non-generic parameter for the joint.
virtual void SetLowerLimit(const unsigned int _index, const double _limit) override
Set the joint's lower limit.
virtual double UpperLimit(const unsigned int _index) const override
Get the joint's upper limit.
DARTJoint(BasePtr _parent)
Constructor.
DARTJointPrivate * dataPtr
Definition DARTJoint.hh:194
virtual void SetForce(unsigned int _index, double _force) override
Set the force applied to this physics::Joint.
virtual void SetUpperLimit(const unsigned int _index, const double _limit) override
Set the joint's upper limit.
virtual void SetStiffnessDamping(unsigned int _index, double _stiffness, double _damping, double _reference=0) override
Set the joint spring stiffness.
virtual void SetVelocity(unsigned int _index, double _vel) override final
Set the velocity of an axis(index).
virtual void CacheForceTorque() override
Cache Joint Force Torque Values if necessary for physics engine.
virtual void Reset() override
Reset the joint.
virtual void SetStiffness(unsigned int _index, const double _stiffness) override
Set the joint spring stiffness.
virtual ~DARTJoint()
Destructor.
virtual void Init() override
Initialize a joint.
dart::dynamics::Joint * GetDARTJoint()
Get DART joint pointer.
virtual void Load(sdf::ElementPtr _sdf) override
Load physics::Joint from a SDF sdf::Element.
virtual bool SetParam(const std::string &_key, unsigned int _index, const boost::any &_value) override
Set a non-generic parameter for the joint.
virtual LinkPtr GetJointLink(unsigned int _index) const override
Get the link to which the joint is attached according the _index.
Wrench information from a joint.
Definition JointWrench.hh:41
Base class for all joints.
Definition Joint.hh:51
Definition JointMaker.hh:45
boost::shared_ptr< Link > LinkPtr
Definition PhysicsTypes.hh:109
boost::shared_ptr< Base > BasePtr
Definition PhysicsTypes.hh:77
boost::shared_ptr< DARTModel > DARTModelPtr
Definition DARTTypes.hh:46
std::shared_ptr< dart::dynamics::Joint::Properties > DARTJointPropPtr
Definition DARTTypes.hh:55
Forward declarations for the common classes.
Definition Animation.hh:27
Definition Model.hh:41
STL namespace.