17 #ifndef GAZEBO_PHYSICS_JOINT_HH_
18 #define GAZEBO_PHYSICS_JOINT_HH_
23 #include <boost/any.hpp>
24 #include <ignition/math/Pose3.hh>
25 #include <ignition/math/Vector3.hh>
29 #include "gazebo/msgs/MessageTypes.hh"
39 #define MAX_JOINT_AXIS 2
102 const ignition::math::Pose3d &_pose);
106 public:
virtual void Load(sdf::ElementPtr _sdf);
159 public:
virtual void SetAxis(
const unsigned int _index,
160 const ignition::math::Vector3d &_axis) = 0;
166 public:
virtual void SetDamping(
unsigned int _index,
double _damping) = 0;
186 double _stiffness,
double _damping,
double _reference = 0) = 0;
194 const double _stiffness) = 0;
212 public:
template<
typename T>
214 {
return jointUpdate.Connect(_subscriber);}
219 public: ignition::math::Vector3d
LocalAxis(
const unsigned int _index)
226 unsigned int _index)
const = 0;
231 public:
virtual void SetAnchor(
const unsigned int _index,
232 const ignition::math::Vector3d &_anchor) = 0;
237 public:
virtual ignition::math::Vector3d
Anchor(
238 const unsigned int _index)
const = 0;
268 public:
virtual void SetVelocity(
unsigned int _index,
double _vel) = 0;
273 public:
virtual double GetVelocity(
unsigned int _index)
const = 0;
283 public:
virtual void SetForce(
unsigned int _index,
double _effort) = 0;
298 public:
virtual double GetForce(
unsigned int _index);
340 public:
virtual double Position(
const unsigned int _index = 0) const
345 public: virtual
unsigned int DOF() const = 0;
363 public: virtual
bool SetPosition(
364 const
unsigned int _index, const
double _position,
365 const
bool _preserveWorldVelocity = false);
377 protected:
bool SetPositionMaximal(
378 const
unsigned int _index,
double _position,
379 const
bool _preserveWorldVelocity = false);
388 protected:
bool SetVelocityMaximal(
unsigned int _index,
double _velocity);
396 public: virtual
ignition::math::Vector3d LinkForce(
397 const
unsigned int _index) const = 0;
405 public: virtual
ignition::math::Vector3d LinkTorque(
406 const
unsigned int _index) const = 0;
417 public: virtual
bool SetParam(const std::
string &_key,
419 const
boost::any &_value) = 0;
425 public: virtual
double GetParam(const std::
string &_key,
426 unsigned int _index);
438 public: msgs::
Joint::Type GetMsgType() const;
442 public: virtual
void FillMsg(msgs::
Joint &_msg);
451 public:
double GetInertiaRatio(const
unsigned int _index) const;
462 public:
double InertiaRatio(const
ignition::math::Vector3d &_axis) const;
468 public: virtual
double LowerLimit(
unsigned int _index = 0) const;
481 public: virtual
double UpperLimit(const
unsigned int _index = 0) const;
490 public: virtual
void SetLowerLimit(const
unsigned int _index,
491 const
double _limit);
500 public: virtual
void SetUpperLimit(const
unsigned int _index,
501 const
double _limit);
505 public: virtual
void SetProvideFeedback(
bool _enable);
508 public: virtual
void CacheForceTorque();
513 public:
void SetStopStiffness(
unsigned int _index,
double _stiffness);
518 public:
void SetStopDissipation(
unsigned int _index,
double _dissipation);
523 public:
double GetStopStiffness(
unsigned int _index) const;
528 public:
double GetStopDissipation(
unsigned int _index) const;
533 public:
ignition::math::Pose3d InitialAnchorPose() const;
546 public:
ignition::math::Pose3d ParentWorldPose() const;
553 public:
ignition::math::Pose3d AnchorErrorPose() const;
561 const
unsigned int _index) const;
575 public:
ignition::math::Quaterniond AxisFrameOffset(
576 const
unsigned int _index) const;
582 public:
double GetWorldEnergyPotentialSpring(
unsigned int _index) const;
591 protected: virtual
double PositionImpl(const
unsigned int _index = 0)
604 protected:
bool FindAllConnectedLinks(const
LinkPtr &_originalParentLink,
613 const
unsigned int _index, const
double _position);
616 protected: virtual
void RegisterIntrospectionItems();
620 private:
void RegisterIntrospectionPosition(const
unsigned int _index);
624 private:
void RegisterIntrospectionVelocity(const
unsigned int _index);
628 private:
void LoadImpl(const
ignition::math::Pose3d &_pose);
651 protected:
ignition::math::Pose3d parentAnchorPose;
691 private: static sdf::ElementPtr sdfJoint;
694 protected:
bool provideFeedback;
697 private: std::vector<std::
string>
sensors;
700 private: event::EventT<
void ()> jointUpdate;
703 private:
double staticPosition;
#define MAX_JOINT_AXIS
maximum number of axis per joint anticipated.
Definition: Joint.hh:39
sensors
Definition: SensorManager.hh:35
Base class for most physics classes.
Definition: Base.hh:78
virtual void Reset()
Reset the object.
keeps track of state of a physics::Joint
Definition: JointState.hh:43
Wrench information from a joint.
Definition: JointWrench.hh:41
Base class for all joints.
Definition: Joint.hh:51
virtual void SetStiffnessDamping(unsigned int _index, double _stiffness, double _damping, double _reference=0)=0
Set the joint spring stiffness.
Attribute
Joint attribute types.
Definition: Joint.hh:55
@ SUSPENSION_ERP
Suspension error reduction parameter.
Definition: Joint.hh:60
@ FMAX
Maximum force.
Definition: Joint.hh:78
@ SUSPENSION_CFM
Suspension constraint force mixing.
Definition: Joint.hh:63
@ FUDGE_FACTOR
Fudge factor.
Definition: Joint.hh:57
@ ERP
Error reduction parameter.
Definition: Joint.hh:72
@ HI_STOP
Upper joint limit.
Definition: Joint.hh:84
@ VEL
Velocity.
Definition: Joint.hh:81
@ STOP_CFM
Stop limit constraint force mixing.
Definition: Joint.hh:69
@ STOP_ERP
Stop limit error reduction parameter.
Definition: Joint.hh:66
@ CFM
Constraint force mixing.
Definition: Joint.hh:75
virtual double GetVelocity(unsigned int _index) const =0
Get the rotation rate of an axis(index)
virtual double Position(const unsigned int _index=0) const final
Get the position of an axis according to its index.
virtual void ApplyStiffnessDamping()
Callback to apply spring stiffness and viscous damping effects to joint.
virtual void Fini()
Finialize the object.
virtual void Init()
Initialize a joint.
virtual void SetStiffness(unsigned int _index, const double _stiffness)=0
Set the joint spring stiffness.
virtual void SetVelocityLimit(unsigned int _index, double _velocity)
Set the velocity limit on a joint axis.
virtual void Reset()
Reset the joint.
double CheckAndTruncateForce(unsigned int _index, double _effort)
check if the force against velocityLimit and effortLimit, truncate if necessary.
double GetDamping(unsigned int _index)
Returns the current joint damping coefficient.
double GetStiffness(unsigned int _index)
Returns the current joint spring stiffness coefficient.
virtual LinkPtr GetJointLink(unsigned int _index) const =0
Get the link to which the joint is attached according the _index.
event::ConnectionPtr ConnectJointUpdate(T _subscriber)
Connect a boost::slot the the joint update signal.
Definition: Joint.hh:213
virtual ignition::math::Vector3d Anchor(const unsigned int _index) const =0
Get the anchor point.
virtual JointWrench GetForceTorque(unsigned int _index)=0
get internal force and torque values at a joint.
virtual void SetAxis(const unsigned int _index, const ignition::math::Vector3d &_axis)=0
Set the axis of rotation where axis is specified in local joint frame.
virtual void Attach(LinkPtr _parent, LinkPtr _child)
Attach the two bodies with this joint.
virtual ~Joint()
Destructor.
virtual void SetAnchor(const unsigned int _index, const ignition::math::Vector3d &_anchor)=0
Set the anchor point.
void SetModel(ModelPtr _model)
Set the model this joint belongs too.
virtual void Detach()
Detach this joint from all links.
void Load(LinkPtr _parent, LinkPtr _child, const ignition::math::Pose3d &_pose)
Set pose, parent and child links of a physics::Joint.
ignition::math::Vector3d LocalAxis(const unsigned int _index) const
Get the axis of rotation.
virtual double GetEffortLimit(unsigned int _index)
Get the effort limit on axis(index).
virtual void SetForce(unsigned int _index, double _effort)=0
Set the force applied to this physics::Joint.
virtual ignition::math::Vector3d GlobalAxis(unsigned int _index) const =0
Get the axis of rotation in global cooridnate frame.
virtual void SetDamping(unsigned int _index, double _damping)=0
Set the joint damping.
void SetState(const JointState &_state)
Set the joint state.
double GetSpringReferencePosition(unsigned int _index) const
Get joint spring reference position.
virtual void Load(sdf::ElementPtr _sdf)
Load physics::Joint from a SDF sdf::Element.
virtual void UpdateParameters(sdf::ElementPtr _sdf)
Update the parameters using new sdf values.
virtual void SetVelocity(unsigned int _index, double _vel)=0
Set the velocity of an axis(index).
Joint(BasePtr _parent)
Constructor.
virtual double GetVelocityLimit(unsigned int _index)
Get the velocity limit on axis(index).
virtual double GetForce(unsigned int _index)
void Update()
Update the joint.
virtual bool AreConnected(LinkPtr _one, LinkPtr _two) const =0
Determines of the two bodies are connected by a joint.
virtual void SetEffortLimit(unsigned int _index, double _effort)
Set the effort limit on a joint axis.
Definition: JointMaker.hh:45
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
std::vector< LinkPtr > Link_V
Definition: PhysicsTypes.hh:225
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
Forward declarations for the common classes.
Definition: Animation.hh:27