74 public:
virtual ~
Link();
78 public:
virtual void Load(sdf::ElementPtr _sdf);
81 public:
virtual void Init();
90 public:
void ResetPhysicsStates();
94 public:
virtual void UpdateParameters(sdf::ElementPtr _sdf);
107 public:
virtual void SetEnabled(
bool _enable)
const = 0;
111 public:
virtual bool GetEnabled()
const = 0;
116 public:
virtual bool SetSelected(
bool _set);
120 public:
virtual void SetGravityMode(
bool _mode) = 0;
124 public:
virtual bool GetGravityMode()
const = 0;
130 public:
virtual void SetSelfCollide(
bool _collide) = 0;
140 public:
void SetCollideMode(
const std::string &_mode);
149 public:
bool GetSelfCollide()
const;
153 public:
void SetLaserRetro(
float _retro);
157 public:
virtual void SetLinearVel(
const math::Vector3 &_vel) = 0;
161 public:
virtual void SetAngularVel(
const math::Vector3 &_vel) = 0;
173 public:
virtual void SetForce(
const math::Vector3 &_force) = 0;
177 public:
virtual void SetTorque(
const math::Vector3 &_torque) = 0;
181 public:
virtual void AddForce(
const math::Vector3 &_force) = 0;
186 public:
virtual void AddRelativeForce(
const math::Vector3 &_force) = 0;
191 public:
virtual void AddForceAtWorldPosition(
const math::Vector3 &_force,
198 public:
virtual void AddForceAtRelativePosition(
208 public:
virtual void AddLinkForce(
const math::Vector3 &_force,
213 public:
virtual void AddTorque(
const math::Vector3 &_torque) = 0;
218 public:
virtual void AddRelativeTorque(
const math::Vector3 &_torque) = 0;
257 public:
virtual math::Vector3 GetWorldCoGLinearVel()
const = 0;
321 public:
void SetInertial(
const InertialPtr &_inertial);
328 public:
math::Pose GetWorldInertialPose()
const;
340 public:
CollisionPtr GetCollisionById(
unsigned int _id)
const;
346 public:
CollisionPtr GetCollision(
const std::string &_name);
351 public:
CollisionPtr GetCollision(
unsigned int _index)
const;
360 public:
virtual math::Box GetBoundingBox()
const;
364 public:
virtual void SetLinearDamping(
double _damping) = 0;
368 public:
virtual void SetAngularDamping(
double _damping) = 0;
372 public:
double GetLinearDamping()
const;
376 public:
double GetAngularDamping()
const;
381 public:
virtual void SetKinematic(
const bool &_kinematic);
394 public:
unsigned int GetSensorCount()
const;
407 public: std::string GetSensorName(
unsigned int _index)
const;
412 public:
template<
typename T>
414 {
return enabledSignal.Connect(_subscriber);}
419 {enabledSignal.Disconnect(_conn);}
423 public:
void FillMsg(msgs::Link &_msg);
427 public:
void ProcessMsg(
const msgs::Link &_msg);
431 public:
void AddChildJoint(
JointPtr _joint);
435 public:
void AddParentJoint(
JointPtr _joint);
439 public:
void RemoveParentJoint(
const std::string &_jointName);
443 public:
void RemoveChildJoint(
const std::string &_jointName);
446 public:
virtual void RemoveChild(
EntityPtr _child);
452 public:
void AttachStaticModel(
ModelPtr &_model,
457 public:
void DetachStaticModel(
const std::string &_modelName);
460 public:
void DetachAllStaticModels();
464 public:
virtual void OnPoseChange();
468 public:
void SetState(
const LinkState &_state);
478 public:
virtual void SetAutoDisable(
bool _disable) = 0;
482 public:
Link_V GetChildJointsLinks()
const;
486 public:
Link_V GetParentJointsLinks()
const;
490 public:
void SetPublishData(
bool _enable);
493 public:
Joint_V GetParentJoints()
const;
496 public:
Joint_V GetChildJoints()
const;
500 public:
void RemoveCollision(
const std::string &_name);
505 public:
double GetWorldEnergyPotential()
const;
510 public:
double GetWorldEnergyKinetic()
const;
516 public:
double GetWorldEnergy()
const;
521 public: msgs::Visual GetVisualMessage(
const std::string &_name)
const;
526 public:
virtual void SetLinkStatic(
bool _static) = 0;
536 public:
void MoveFrame(
const math::Pose &_worldReferenceFrameSrc,
553 public:
bool FindAllConnectedLinksHelper(
554 const LinkPtr &_originalParentLink,
555 Link_V &_connectedLinks,
bool _fistLink =
false);
558 private:
void PublishData();
562 private:
void LoadCollision(sdf::ElementPtr _sdf);
566 private:
void SetInertialFromCollisions();
570 private:
void OnCollision(ConstContactsPtr &_msg);
573 private:
void ParseVisuals();
579 private:
bool ContainsLink(
const Link_V &_vector,
const LinkPtr &_value);
583 private:
void UpdateVisualGeomSDF(
const math::Vector3 &_scale);
586 private:
void UpdateVisualMsg();
591 private:
void OnWrenchMsg(ConstWrenchPtr &_msg);
595 private:
void ProcessWrenchMsg(
const msgs::Wrench &_msg);
626 private:
bool enabled;
629 private: std::vector<std::string> sensors;
632 private: std::vector<JointPtr> parentJoints;
635 private: std::vector<JointPtr> childJoints;
638 private: std::vector<ModelPtr> attachedModels;
644 private: msgs::LinkData linkDataMsg;
647 private:
bool publishData;
650 private: boost::recursive_mutex *publishDataMutex;
659 private: std::vector<msgs::Wrench> wrenchMsgs;
662 private: boost::mutex wrenchMsgMutex;
665 private: std::vector<util::OpenALSourcePtr> audioSources;
bool initialized
This flag is set to true when the link is initialized.
Definition: Link.hh:620
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:147
std::vector< JointPtr > Joint_V
Definition: PhysicsTypes.hh:188
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:84
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
virtual void UpdateSurface()
Update surface parameters.
Definition: Link.hh:474
virtual void UpdateMass()
Update the mass matrix.
Definition: Link.hh:471
Mathematical representation of a box and related functions.
Definition: Box.hh:35
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
boost::shared_ptr< Inertial > InertialPtr
Definition: PhysicsTypes.hh:132
virtual math::Vector3 GetWorldLinearVel() const
Get the linear velocity of the origin of the link frame, expressed in the world frame.
Definition: Link.hh:229
InertialPtr inertial
Inertial properties.
Definition: Link.hh:598
virtual bool GetKinematic() const
Implement this function.
Definition: Link.hh:386
Forward declarations for transport.
virtual void Update()
Update the object.
Definition: Base.hh:173
std::vector< std::string > cgVisuals
Center of gravity visual elements.
Definition: Link.hh:601
Link class defines a rigid body entity, containing information on inertia, visual and collision prope...
Definition: Link.hh:67
std::vector< LinkPtr > Link_V
Definition: PhysicsTypes.hh:196
InertialPtr GetInertial() const
Get the inertia of the link.
Definition: Link.hh:317
Information for use in an update event.
Definition: UpdateInfo.hh:30
Visuals_M visuals
Link visual elements.
Definition: Link.hh:608
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:96
boost::shared_ptr< OpenALSink > OpenALSinkPtr
Definition: UtilTypes.hh:42
A 3x3 matrix class.
Definition: Matrix3.hh:34
std::vector< math::Pose > attachedModelsOffset
Offsets for the attached models.
Definition: Link.hh:617
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:76
OpenAL Source.
Definition: OpenAL.hh:131
A quaternion class.
Definition: Quaternion.hh:42
virtual void RemoveChild(unsigned int _id)
Remove a child from this entity.
static const Vector3 Zero
math::Vector3(0, 0, 0)
Definition: Vector3.hh:42
math::Vector3 linearAccel
Linear acceleration.
Definition: Link.hh:611
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:100
Base class for all physics objects in Gazebo.
Definition: Entity.hh:56
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
void DisconnectEnabled(event::ConnectionPtr &_conn)
Disconnect to the add entity signal.
Definition: Link.hh:418
math::Vector3 angularAccel
Angular acceleration.
Definition: Link.hh:614
std::vector< CollisionPtr > Collision_V
Definition: PhysicsTypes.hh:200
std::map< uint32_t, msgs::Visual > Visuals_M
Definition: Link.hh:605
event::ConnectionPtr ConnectEnabled(T _subscriber)
Connect to the add entity signal.
Definition: Link.hh:413
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Store state information of a physics::Link object.
Definition: LinkState.hh:49
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:92
OpenAL Listener.
Definition: OpenAL.hh:95