20#include <boost/any.hpp>
43 DAMPING_ACTIVE = 0x00000001,
45 JOINT_LIMIT = 0x00000002
56 public:
virtual void Load(sdf::ElementPtr _sdf)
override;
59 public:
virtual void Fini()
override;
62 public:
virtual void Reset()
override;
80 public:
virtual double GetParam(
unsigned int _parameter)
const;
88 public:
virtual void SetParam(
unsigned int _parameter,
double _value);
91 public:
virtual void SetDamping(
unsigned int _index,
double _damping)
96 const unsigned int _index,
97 const double _position,
98 const bool _preserveWorldVelocity =
false)
103 const double _stiffness)
override;
107 double _stiffness,
double _damping,
double _reference = 0)
override;
154 return this->stopCFM;
161 return this->stopERP;
173 private:
double ApplyAdaptiveDamping(
unsigned int _index,
174 const double _damping);
182 private:
void KpKdToCFMERP(
const double _dt,
183 const double _kp,
const double _kd,
184 double &_cfm,
double &_erp);
192 private:
void CFMERPToKpKd(
const double _dt,
193 const double _cfm,
const double _erp,
194 double &_kp,
double &_kd);
207 private:
bool stiffnessDampingInitialized;
210 private:
bool useImplicitSpringDamper;
214 const double _limit)
override;
218 const double _limit)
override;
222 const unsigned int _index)
const override;
226 const unsigned int _index)
const override;
229 public:
virtual void SetAxis(
const unsigned int _index,
230 const ignition::math::Vector3d &_axis)
override;
233 public:
virtual bool SetParam(
const std::string &_key,
235 const boost::any &_value)
override;
238 public:
virtual double GetParam(
const std::string &_key,
239 unsigned int _index)
override;
248 public:
virtual void SetForce(
unsigned int _index,
double _force)
252 public:
virtual double GetForce(
unsigned int _index)
override;
267 unsigned int _index,
double _force) = 0;
272 private:
void SaveForce(
unsigned int _index,
double _force);
278 private: dJointFeedback *feedback;
281 private:
double stopCFM;
284 private:
double stopERP;
#define MAX_JOINT_AXIS
maximum number of axis per joint anticipated.
Definition Joint.hh:39
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
Wrench information from a joint.
Definition JointWrench.hh:41
Base class for all joints.
Definition Joint.hh:51
ODE joint interface.
Definition ODEJoint.hh:36
virtual void SetAxis(const unsigned int _index, const ignition::math::Vector3d &_axis) override
Set the axis of rotation where axis is specified in local joint frame.
dJointID jointId
This is our ODE ID.
Definition ODEJoint.hh:275
double GetERP()
Get the ERP of this joint.
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.
void SetCFM(double _cfm)
Set the CFM of this joint.
void ApplyExplicitStiffnessDamping()
simulating a joint spring and damper explicitly.
double GetCFM()
Get the CFM of this joint.
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 void ApplyStiffnessDamping() override
Callback to apply spring stiffness and viscous damping effects to joint.
virtual void Detach() override
Detach this joint from all links.
void SetERP(double _erp)
Set the ERP of this joint.
bool UsesImplicitSpringDamper()
Get flag indicating whether implicit spring damper is enabled.
ODEJoint(BasePtr _parent)
Constructor.
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.
dJointFeedback * GetFeedback()
Get the feedback data structure for this joint, if set.
void ApplyImplicitStiffnessDamping()
simulate implicit spring and damper with CFM/ERP and meddling with Joint limits.
virtual bool SetPosition(const unsigned int _index, const double _position, const bool _preserveWorldVelocity=false) override
The child links of this joint are updated based on desired position.
virtual JointWrench GetForceTorque(unsigned int _index) override
get internal force and torque values at a joint.
virtual double GetForce(unsigned int _index) override
virtual void SetProvideFeedback(bool _enable) override
Set whether the joint should generate feedback.
virtual ~ODEJoint()
Destructor.
CFMMode
internal variables used for implicit damping
Definition ODEJoint.hh:39
@ JOINT_LIMIT
implicit damping not active, enforcing joints limits
Definition ODEJoint.hh:45
@ NONE
implicit damping not active
Definition ODEJoint.hh:41
@ DAMPING_ACTIVE
implicit damping active, joints within limits
Definition ODEJoint.hh:43
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 void SetForce(unsigned int _index, double _force) override
Set the force applied to this physics::Joint.
void UseImplicitSpringDamper(const bool _implicit)
Set flag indicating whether implicit spring damper is enabled.
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 Fini() override
Finialize the object.
double GetStopERP()
Get access to stopERP.
Definition ODEJoint.hh:159
virtual void SetParam(unsigned int _parameter, double _value)
Set an ODE joint paramter.
virtual void CacheForceTorque() override
Cache Joint Force Torque Values if necessary for physics engine.
double GetStopCFM()
Get access to stopCFM.
Definition ODEJoint.hh:152
virtual void Reset() override
Reset the joint.
virtual void SetForceImpl(unsigned int _index, double _force)=0
Set the force applied to this physics::Joint.
virtual void SetStiffness(unsigned int _index, const double _stiffness) override
Set the joint spring stiffness.
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.
virtual double GetParam(unsigned int _parameter) const
Get an ODE joint parameter.
boost::shared_ptr< Link > LinkPtr
Definition PhysicsTypes.hh:109
boost::shared_ptr< Base > BasePtr
Definition PhysicsTypes.hh:77
Forward declarations for the common classes.
Definition Animation.hh:27