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>
32 #include "gazebo/msgs/MessageTypes.hh"
42 #define MAX_JOINT_AXIS 2
98 public:
virtual ~
Joint();
113 const ignition::math::Pose3d &_pose);
117 public:
virtual void Load(sdf::ElementPtr _sdf);
120 public:
virtual void Init();
123 public:
virtual void Fini();
126 public:
void Update();
130 public:
virtual void UpdateParameters(sdf::ElementPtr _sdf);
133 public:
virtual void Reset();
138 public:
void SetState(
const JointState &_state);
142 public:
void SetModel(
ModelPtr _model);
149 public:
virtual LinkPtr GetJointLink(
unsigned int _index)
const = 0;
155 public:
virtual bool AreConnected(
LinkPtr _one,
LinkPtr _two)
const = 0;
163 public:
virtual void Detach();
171 public:
virtual void SetAxis(
unsigned int _index,
179 public:
virtual void SetAxis(
const unsigned int _index,
180 const ignition::math::Vector3d &_axis) = 0;
186 public:
virtual void SetDamping(
unsigned int _index,
double _damping) = 0;
192 public:
double GetDamping(
unsigned int _index);
197 public:
virtual void ApplyStiffnessDamping();
205 public:
virtual void SetStiffnessDamping(
unsigned int _index,
206 double _stiffness,
double _damping,
double _reference = 0) = 0;
213 public:
virtual void SetStiffness(
unsigned int _index,
214 const double _stiffness) = 0;
221 public:
double GetStiffness(
unsigned int _index);
227 public:
double GetSpringReferencePosition(
unsigned int _index)
const;
232 public:
template<
typename T>
234 {
return jointUpdate.Connect(_subscriber);}
241 {jointUpdate.Disconnect(_conn->Id());}
247 public:
math::Vector3 GetLocalAxis(
unsigned int _index)
const
253 public: ignition::math::Vector3d LocalAxis(
const unsigned int _index)
266 public:
virtual ignition::math::Vector3d GlobalAxis(
267 unsigned int _index)
const = 0;
273 public:
virtual void SetAnchor(
unsigned int _index,
279 public:
virtual void SetAnchor(
const unsigned int _index,
280 const ignition::math::Vector3d &_anchor) = 0;
286 public:
virtual math::Vector3 GetAnchor(
unsigned int _index)
const
292 public:
virtual ignition::math::Vector3d Anchor(
293 const unsigned int _index)
const = 0;
299 public:
virtual bool SetHighStop(
unsigned int _index,
306 public:
virtual bool SetLowStop(
unsigned int _index,
316 public:
virtual math::Angle GetHighStop(
unsigned int _index)
326 public:
virtual math::Angle GetLowStop(
unsigned int _index)
332 public:
virtual double GetEffortLimit(
unsigned int _index);
337 public:
virtual void SetEffortLimit(
unsigned int _index,
double _effort);
342 public:
virtual double GetVelocityLimit(
unsigned int _index);
347 public:
virtual void SetVelocityLimit(
unsigned int _index,
357 public:
virtual void SetVelocity(
unsigned int _index,
double _vel) = 0;
362 public:
virtual double GetVelocity(
unsigned int _index)
const = 0;
372 public:
virtual void SetForce(
unsigned int _index,
double _effort) = 0;
379 public:
double CheckAndTruncateForce(
unsigned int _index,
double _effort);
387 public:
virtual double GetForce(
unsigned int _index);
411 public:
virtual JointWrench GetForceTorque(
unsigned int _index) = 0;
417 public:
math::Angle GetAngle(
unsigned int _index)
const
436 public:
virtual double Position(
const unsigned int _index = 0) const
442 public: virtual
unsigned int GetAngleCount() const GAZEBO_DEPRECATED(8.0);
446 public: virtual
unsigned int DOF() const = 0;
456 public: virtual
bool SetPosition(
unsigned int _index,
double _position);
466 protected:
bool SetPositionMaximal(
unsigned int _index,
double _position);
475 protected:
bool SetVelocityMaximal(
unsigned int _index,
double _velocity);
484 public: virtual math::Vector3 GetLinkForce(
unsigned int _index) const
485 GAZEBO_DEPRECATED(8.0);
493 public: virtual ignition::math::Vector3d LinkForce(
494 const
unsigned int _index) const = 0;
503 public: virtual math::Vector3 GetLinkTorque(
504 unsigned int _index) const GAZEBO_DEPRECATED(8.0);
512 public: virtual ignition::math::Vector3d LinkTorque(
513 const
unsigned int _index) const = 0;
524 public: virtual
bool SetParam(const std::
string &_key,
526 const boost::any &_value) = 0;
532 public: virtual
double GetParam(const std::
string &_key,
533 unsigned int _index);
537 public:
LinkPtr GetChild() const;
541 public:
LinkPtr GetParent() const;
545 public: msgs::
Joint::Type GetMsgType() const;
549 public: virtual
void FillMsg(msgs::
Joint &_msg);
558 public:
double GetInertiaRatio(const
unsigned int _index) const;
570 public:
double GetInertiaRatio(const math::Vector3 &_axis) const
571 GAZEBO_DEPRECATED(8.0);
582 public:
double InertiaRatio(const ignition::math::Vector3d &_axis) const;
589 public: math::Angle GetLowerLimit(
unsigned int _index) const
590 GAZEBO_DEPRECATED(8.0);
596 public: virtual
double LowerLimit(
unsigned int _index = 0) const;
603 public: math::Angle GetUpperLimit(
unsigned int _index) const
604 GAZEBO_DEPRECATED(8.0);
617 public: virtual
double UpperLimit(const
unsigned int _index = 0) const;
624 public:
void SetLowerLimit(
unsigned int _index, math::Angle _limit)
625 GAZEBO_DEPRECATED(8.0);
638 public: virtual
void SetLowerLimit(const
unsigned int _index,
639 const
double _limit);
646 public:
void SetUpperLimit(
unsigned int _index, math::Angle _limit)
647 GAZEBO_DEPRECATED(8.0);
653 public: virtual
void SetUpperLimit(const
unsigned int _index,
654 const
double _limit);
658 public: virtual
void SetProvideFeedback(
bool _enable);
661 public: virtual
void CacheForceTorque();
666 public:
void SetStopStiffness(
unsigned int _index,
double _stiffness);
671 public:
void SetStopDissipation(
unsigned int _index,
double _dissipation);
676 public:
double GetStopStiffness(
unsigned int _index) const;
681 public:
double GetStopDissipation(
unsigned int _index) const;
687 public: math::Pose GetInitialAnchorPose() const GAZEBO_DEPRECATED(8.0);
692 public: ignition::math::Pose3d InitialAnchorPose() const;
699 public: math::Pose GetWorldPose() const GAZEBO_DEPRECATED(8.0);
705 public: ignition::math::Pose3d WorldPose() const;
713 public: math::Pose GetParentWorldPose() const GAZEBO_DEPRECATED(8.0);
720 public: ignition::math::Pose3d ParentWorldPose() const;
728 public: math::Pose GetAnchorErrorPose() const GAZEBO_DEPRECATED(8.0);
735 public: ignition::math::Pose3d AnchorErrorPose() const;
743 public: math::Quaternion GetAxisFrame(
unsigned int _index) const
744 GAZEBO_DEPRECATED(8.0);
751 public: ignition::math::Quaterniond AxisFrame(
752 const
unsigned int _index) const;
767 public: math::Quaternion GetAxisFrameOffset(
unsigned int _index) const
768 GAZEBO_DEPRECATED(8.0);
782 public: ignition::math::Quaterniond AxisFrameOffset(
783 const
unsigned int _index) const;
789 public:
double GetWorldEnergyPotentialSpring(
unsigned int _index) const;
795 protected: virtual math::Angle GetAngleImpl(
796 unsigned int _index) const GAZEBO_DEPRECATED(8.0);
805 protected: virtual
double PositionImpl(const
unsigned int _index = 0)
818 protected:
bool FindAllConnectedLinks(const
LinkPtr &_originalParentLink,
827 protected: math::Pose ComputeChildLinkPose(
unsigned int _index,
828 double _position) GAZEBO_DEPRECATED(8.0);
835 protected: ignition::math::Pose3d ChildLinkPose(
836 const
unsigned int _index, const
double _position);
839 protected: virtual
void RegisterIntrospectionItems();
843 private:
void RegisterIntrospectionPosition(const
unsigned int _index);
847 private:
void RegisterIntrospectionVelocity(const
unsigned int _index);
851 private:
void LoadImpl(const ignition::math::Pose3d &_pose);
864 protected: ignition::math::Vector3d anchorPos;
871 protected: ignition::math::Pose3d anchorPose;
874 protected: ignition::math::Pose3d parentAnchorPose;
880 protected:
double dissipationCoefficient[MAX_JOINT_AXIS];
883 protected:
double stiffnessCoefficient[MAX_JOINT_AXIS];
886 protected:
double springReferencePosition[MAX_JOINT_AXIS];
892 protected:
double effortLimit[MAX_JOINT_AXIS];
895 protected:
double velocityLimit[MAX_JOINT_AXIS];
898 protected:
double lowerLimit[MAX_JOINT_AXIS];
901 protected:
double upperLimit[MAX_JOINT_AXIS];
910 protected:
bool axisParentModelFrame[MAX_JOINT_AXIS];
914 private: static sdf::ElementPtr sdfJoint;
917 protected:
bool provideFeedback;
920 private: std::vector<std::
string> sensors;
923 private: event::EventT<
void ()> jointUpdate;
926 private:
double staticPosition;
929 private:
double stopStiffness[MAX_JOINT_AXIS];
932 private:
double stopDissipation[MAX_JOINT_AXIS];
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
Attribute
Joint attribute types.
Definition: Joint.hh:57
Encapsulates a position and rotation in three space.
Definition: Pose.hh:42
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
virtual void Reset()
Reset the object.
Upper joint limit.
Definition: Joint.hh:87
void DisconnectJointUpdate(event::ConnectionPtr &_conn) GAZEBO_DEPRECATED(8.0)
Disconnect a boost::slot the the joint update signal.
Definition: Joint.hh:239
Maximum force.
Definition: Joint.hh:81
event::ConnectionPtr ConnectJointUpdate(T _subscriber)
Connect a boost::slot the the joint update signal.
Definition: Joint.hh:233
Suspension error reduction parameter.
Definition: Joint.hh:63
Base class for most physics classes.
Definition: Base.hh:77
Constraint force mixing.
Definition: Joint.hh:78
Suspension constraint force mixing.
Definition: Joint.hh:66
keeps track of state of a physics::Joint
Definition: JointState.hh:43
Error reduction parameter.
Definition: Joint.hh:75
Fudge factor.
Definition: Joint.hh:60
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:302
Base class for all joints.
Definition: Joint.hh:53
Velocity.
Definition: Joint.hh:84
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
Wrench information from a joint.
Definition: JointWrench.hh:40
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
An angle and related functions.
Definition: Angle.hh:53
Stop limit error reduction parameter.
Definition: Joint.hh:69
std::vector< LinkPtr > Link_V
Definition: PhysicsTypes.hh:225
boost::shared_ptr< Base > BasePtr
Definition: PhysicsTypes.hh:77
Stop limit constraint force mixing.
Definition: Joint.hh:72