17 #ifndef _GAZEBO_JOINT_HH_
18 #define _GAZEBO_JOINT_HH_
23 #include <boost/any.hpp>
29 #include "gazebo/msgs/MessageTypes.hh"
39 #define MAX_JOINT_AXIS 2
95 public:
virtual ~
Joint();
106 public:
virtual void Load(sdf::ElementPtr _sdf);
109 public:
virtual void Init();
112 public:
virtual void Fini();
115 public:
void Update();
119 public:
virtual void UpdateParameters(sdf::ElementPtr _sdf);
122 public:
virtual void Reset();
126 public:
void SetState(
const JointState &_state);
130 public:
void SetModel(
ModelPtr _model);
137 public:
virtual LinkPtr GetJointLink(
unsigned int _index)
const = 0;
143 public:
virtual bool AreConnected(
LinkPtr _one,
LinkPtr _two)
const = 0;
151 public:
virtual void Detach();
158 public:
virtual void SetAxis(
unsigned int _index,
165 public:
virtual void SetDamping(
unsigned int _index,
double _damping) = 0;
171 public:
double GetDamping(
unsigned int _index);
180 public: virtual
void ApplyStiffnessDamping();
188 public: virtual
void SetStiffnessDamping(
unsigned int _index,
189 double _stiffness,
double _damping,
double _reference = 0) = 0;
196 public: virtual
void SetStiffness(
unsigned int _index,
197 double _stiffness) = 0;
204 public:
double GetStiffness(
unsigned int _index);
210 public:
double GetSpringReferencePosition(
unsigned int _index) const;
215 public: template<typename T>
217 {
return jointUpdate.Connect(_subscriber);}
222 {jointUpdate.Disconnect(_conn);}
227 public:
math::Vector3 GetLocalAxis(
unsigned int _index)
const;
233 unsigned int _index)
const = 0;
238 public:
virtual void SetAnchor(
unsigned int _index,
244 public:
virtual math::Vector3 GetAnchor(
unsigned int _index)
const = 0;
249 public:
virtual bool SetHighStop(
unsigned int _index,
255 public:
virtual bool SetLowStop(
unsigned int _index,
264 public:
virtual math::Angle GetHighStop(
unsigned int _index) = 0;
272 public:
virtual math::Angle GetLowStop(
unsigned int _index) = 0;
277 public:
virtual double GetEffortLimit(
unsigned int _index);
282 public:
virtual void SetEffortLimit(
unsigned int _index,
double _effort);
287 public:
virtual double GetVelocityLimit(
unsigned int _index);
292 public:
virtual void SetVelocity(
unsigned int _index,
double _vel) = 0;
297 public:
virtual double GetVelocity(
unsigned int _index)
const = 0;
307 public:
virtual void SetForce(
unsigned int _index,
double _effort) = 0;
314 public:
double CheckAndTruncateForce(
unsigned int _index,
double _effort);
322 public:
virtual double GetForce(
unsigned int _index);
346 public:
virtual JointWrench GetForceTorque(
unsigned int _index) = 0;
353 public:
virtual void SetMaxForce(
unsigned int _index,
double _force) = 0;
360 public:
virtual double GetMaxForce(
unsigned int _index) = 0;
365 public:
math::Angle GetAngle(
unsigned int _index)
const;
369 public:
virtual unsigned int GetAngleCount()
const = 0;
380 public:
void SetAngle(
unsigned int _index,
math::Angle _angle);
388 public:
virtual math::Vector3 GetLinkForce(
unsigned int _index)
const = 0;
397 unsigned int _index)
const = 0;
404 public:
virtual bool SetParam(
const std::string &_key,
406 const boost::any &_value) = 0;
414 public:
virtual void SetAttribute(
const std::string &_key,
416 const boost::any &_value)
422 public:
virtual double GetParam(
const std::string &_key,
423 unsigned int _index) = 0;
429 public:
virtual double GetAttribute(
const std::string &_key,
434 public:
LinkPtr GetChild()
const;
438 public:
LinkPtr GetParent()
const;
442 public:
void FillMsg(msgs::Joint &_msg);
451 public:
double GetInertiaRatio(
const unsigned int _index)
const;
462 public:
double GetInertiaRatio(
const math::Vector3 &_axis)
const;
468 public:
math::Angle GetLowerLimit(
unsigned int _index)
const;
474 public:
math::Angle GetUpperLimit(
unsigned int _index)
const;
480 public:
void SetLowerLimit(
unsigned int _index,
math::Angle _limit);
486 public:
void SetUpperLimit(
unsigned int _index,
math::Angle _limit);
490 public:
virtual void SetProvideFeedback(
bool _enable);
503 public:
void SetStopStiffness(
unsigned int _index,
double _stiffness);
508 public:
void SetStopDissipation(
unsigned int _index,
double _dissipation);
513 public:
double GetStopStiffness(
unsigned int _index) const;
518 public:
double GetStopDissipation(
unsigned int _index) const;
523 public: math::Pose GetInitialAnchorPose() const;
529 public: math::Pose GetWorldPose() const;
536 public: math::Pose GetParentWorldPose() const;
543 public: math::Pose GetAnchorErrorPose() const;
550 public: math::Quaternion GetAxisFrame(
unsigned int _index) const;
556 public:
double GetWorldEnergyPotentialSpring(
unsigned int _index) const;
561 protected: virtual math::Angle GetAngleImpl(
562 unsigned int _index) const = 0;
566 private:
void LoadImpl(const math::Pose &_pose);
579 protected: math::Vector3 anchorPos;
586 protected: math::Pose anchorPose;
589 protected: math::Pose parentAnchorPose;
596 protected:
double dampingCoefficient;
603 protected:
double stiffnessCoefficient[MAX_JOINT_AXIS];
606 protected:
double springReferencePosition[MAX_JOINT_AXIS];
612 protected:
double effortLimit[MAX_JOINT_AXIS];
615 protected:
double velocityLimit[MAX_JOINT_AXIS];
618 protected: math::Angle lowerLimit[MAX_JOINT_AXIS];
621 protected: math::Angle upperLimit[MAX_JOINT_AXIS];
630 protected:
bool useCFMDamping;
635 protected:
bool axisParentModelFrame[MAX_JOINT_AXIS];
639 private: static sdf::ElementPtr sdfJoint;
642 protected:
bool provideFeedback;
645 private: std::vector<std::
string> sensors;
648 private: event::EventT<
void ()> jointUpdate;
651 private: math::Angle staticAngle;
654 private:
double stopStiffness[MAX_JOINT_AXIS];
657 private:
double stopDissipation[MAX_JOINT_AXIS];