17 #ifndef GAZEBO_PHYSICS_LINK_HH_
18 #define GAZEBO_PHYSICS_LINK_HH_
29 #include <ignition/math/Matrix3.hh>
65 public:
virtual ~
Link();
69 public:
virtual void Load(sdf::ElementPtr _sdf);
72 public:
virtual void Init();
82 public:
void ResetPhysicsStates();
86 public:
virtual void UpdateParameters(sdf::ElementPtr _sdf);
95 public:
void SetScale(
const ignition::math::Vector3d &_scale);
99 public:
virtual void SetEnabled(
bool _enable)
const = 0;
103 public:
virtual bool GetEnabled()
const = 0;
108 public:
virtual bool SetSelected(
bool _set);
112 public:
virtual void SetGravityMode(
bool _mode) = 0;
116 public:
virtual bool GetGravityMode()
const = 0;
120 public:
virtual void SetWindMode(
const bool _mode);
124 public:
virtual bool WindMode()
const;
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(
158 const ignition::math::Vector3d &_vel) = 0;
162 public:
virtual void SetAngularVel(
163 const ignition::math::Vector3d &_vel) = 0;
169 public:
void SetLinearAccel(
const ignition::math::Vector3d &_accel)
176 public:
void SetAngularAccel(
const ignition::math::Vector3d &_accel)
181 public:
virtual void SetForce(
182 const ignition::math::Vector3d &_force) = 0;
186 public:
virtual void SetTorque(
187 const ignition::math::Vector3d &_torque) = 0;
191 public:
virtual void AddForce(
const ignition::math::Vector3d &_force) = 0;
196 public:
virtual void AddRelativeForce(
197 const ignition::math::Vector3d &_force) = 0;
202 public:
virtual void AddForceAtWorldPosition(
203 const ignition::math::Vector3d &_force,
204 const ignition::math::Vector3d &_pos) = 0;
214 public:
virtual void AddForceAtRelativePosition(
215 const ignition::math::Vector3d &_force,
216 const ignition::math::Vector3d &_relPos) = 0;
224 public:
virtual void AddLinkForce(
225 const ignition::math::Vector3d &_force,
226 const ignition::math::Vector3d &_offset =
227 ignition::math::Vector3d::Zero) = 0;
231 public:
virtual void AddTorque(
232 const ignition::math::Vector3d &_torque) = 0;
237 public:
virtual void AddRelativeTorque(
238 const ignition::math::Vector3d &_torque) = 0;
244 public: ignition::math::Pose3d WorldCoGPose()
const;
249 public:
virtual ignition::math::Vector3d WorldLinearVel()
const;
258 public:
virtual ignition::math::Vector3d WorldLinearVel(
259 const ignition::math::Vector3d &_offset)
const = 0;
268 public:
virtual ignition::math::Vector3d WorldLinearVel(
269 const ignition::math::Vector3d &_offset,
270 const ignition::math::Quaterniond &_q)
const = 0;
276 public:
virtual ignition::math::Vector3d WorldCoGLinearVel()
const = 0;
280 public: ignition::math::Vector3d RelativeLinearVel()
const;
284 public: ignition::math::Vector3d RelativeAngularVel()
const;
288 public: ignition::math::Vector3d RelativeLinearAccel()
const;
292 public: ignition::math::Vector3d WorldLinearAccel()
const;
296 public: ignition::math::Vector3d RelativeAngularAccel()
const;
303 public: ignition::math::Vector3d WorldAngularMomentum()
const;
312 public: ignition::math::Vector3d WorldAngularAccel()
const;
316 public: ignition::math::Vector3d RelativeForce()
const;
320 public:
virtual ignition::math::Vector3d WorldForce()
const = 0;
324 public: ignition::math::Vector3d RelativeTorque()
const;
329 public:
virtual ignition::math::Vector3d WorldTorque()
const = 0;
341 public:
void SetInertial(
const InertialPtr &_inertial);
348 public: ignition::math::Pose3d WorldInertialPose()
const;
353 public: ignition::math::Matrix3d WorldInertiaMatrix()
const;
360 public:
CollisionPtr GetCollisionById(
unsigned int _id)
const;
366 public:
CollisionPtr GetCollision(
const std::string &_name);
371 public:
CollisionPtr GetCollision(
unsigned int _index)
const;
380 public:
virtual ignition::math::Box BoundingBox()
const;
384 public:
virtual void SetLinearDamping(
double _damping) = 0;
388 public:
virtual void SetAngularDamping(
double _damping) = 0;
392 public:
double GetLinearDamping()
const;
396 public:
double GetAngularDamping()
const;
401 public:
virtual void SetKinematic(
const bool &_kinematic);
414 public:
unsigned int GetSensorCount()
const;
427 public: std::string GetSensorName(
unsigned int _index)
const;
433 std::function<
void (
bool)> _subscriber);
437 public:
void FillMsg(msgs::Link &_msg);
441 public:
void ProcessMsg(
const msgs::Link &_msg);
445 public:
void AddChildJoint(
JointPtr _joint);
449 public:
void AddParentJoint(
JointPtr _joint);
453 public:
void RemoveParentJoint(
const std::string &_jointName);
457 public:
void RemoveChildJoint(
const std::string &_jointName);
460 public:
virtual void RemoveChild(
EntityPtr _child);
466 public:
void AttachStaticModel(
ModelPtr &_model,
467 const ignition::math::Pose3d &_offset);
471 public:
void DetachStaticModel(
const std::string &_modelName);
474 public:
void DetachAllStaticModels();
478 public:
virtual void OnPoseChange();
482 public:
void SetState(
const LinkState &_state);
492 public:
virtual void SetAutoDisable(
bool _disable) = 0;
496 public:
Link_V GetChildJointsLinks()
const;
500 public:
Link_V GetParentJointsLinks()
const;
504 public:
void SetPublishData(
bool _enable);
507 public:
Joint_V GetParentJoints()
const;
510 public:
Joint_V GetChildJoints()
const;
514 public:
void RemoveCollision(
const std::string &_name);
519 public:
double GetWorldEnergyPotential()
const;
524 public:
double GetWorldEnergyKinetic()
const;
530 public:
double GetWorldEnergy()
const;
535 public: msgs::Visual GetVisualMessage(
const std::string &_name)
const;
540 public:
virtual void SetLinkStatic(
bool _static) = 0;
543 public:
virtual void SetStatic(
const bool &_static);
556 public:
void MoveFrame(
557 const ignition::math::Pose3d &_worldReferenceFrameSrc,
558 const ignition::math::Pose3d &_worldReferenceFrameDst,
559 const bool _preserveWorldVelocity =
false);
575 public:
bool FindAllConnectedLinksHelper(
576 const LinkPtr &_originalParentLink,
577 Link_V &_connectedLinks,
bool _fistLink =
false);
581 public:
void SetWindEnabled(
const bool _enable);
586 public:
const ignition::math::Vector3d WorldWindLinearVel()
const;
590 public:
const ignition::math::Vector3d RelativeWindLinearVel()
const;
608 public:
size_t BatteryCount()
const;
614 public:
bool VisualId(
const std::string &_visName, uint32_t &_visualId)
621 public:
bool VisualPose(
const uint32_t _id,
622 ignition::math::Pose3d &_pose)
const;
628 public:
bool SetVisualPose(
const uint32_t _id,
629 const ignition::math::Pose3d &_pose);
632 private:
void PublishData();
636 private:
void LoadCollision(sdf::ElementPtr _sdf);
640 private:
void SetInertialFromCollisions();
644 private:
void OnCollision(ConstContactsPtr &_msg);
647 private:
void ParseVisuals();
653 private:
bool ContainsLink(
const Link_V &_vector,
const LinkPtr &_value);
657 private:
void UpdateVisualGeomSDF(
const ignition::math::Vector3d &_scale);
660 private:
void UpdateVisualMsg();
665 private:
void OnWrenchMsg(ConstWrenchPtr &_msg);
669 private:
void ProcessWrenchMsg(
const msgs::Wrench &_msg);
673 private:
void LoadBattery(
const sdf::ElementPtr _sdf);
676 protected:
virtual void RegisterIntrospectionItems();
700 protected:
bool initialized =
false;
703 private: std::unique_ptr<LinkPrivate> dataPtr;
virtual void UpdateMass()
Update the mass matrix.
Definition: Link.hh:485
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
InertialPtr GetInertial() const
Get the inertia of the link.
Definition: Link.hh:337
std::vector< ignition::math::Pose3d > attachedModelsOffset
Offsets for the attached models.
Definition: Link.hh:697
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
virtual void Update()
Update the object.
Definition: Base.hh:171
virtual void RemoveChild(unsigned int _id)
Remove a child from this entity.
Link class defines a rigid body entity, containing information on inertia, visual and collision prope...
Definition: Link.hh:58
Information for use in an update event.
Definition: UpdateInfo.hh:30
void SetStatic(const bool &_static)
Set whether this entity is static: immovable.
Visuals_M visuals
Link visual elements.
Definition: Link.hh:686
ignition::math::Vector3d linearAccel
Linear acceleration.
Definition: Link.hh:690
std::map< uint32_t, msgs::Visual > Visuals_M
Definition: Link.hh:683
virtual bool GetKinematic() const
Implement this function.
Definition: Link.hh:406
virtual void UpdateSurface()
Update surface parameters.
Definition: Link.hh:488
std::vector< JointPtr > Joint_V
Definition: PhysicsTypes.hh:213
std::vector< CollisionPtr > Collision_V
Definition: PhysicsTypes.hh:229
std::shared_ptr< Battery > BatteryPtr
Definition: CommonTypes.hh:125
boost::shared_ptr< Inertial > InertialPtr
Definition: PhysicsTypes.hh:157
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
Base class for all physics objects in Gazebo.
Definition: Entity.hh:52
ignition::math::Vector3d angularAccel
Angular acceleration.
Definition: Link.hh:694
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:85
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
virtual void Reset()
Reset the entity.
std::vector< LinkPtr > Link_V
Definition: PhysicsTypes.hh:225
Store state information of a physics::Link object.
Definition: LinkState.hh:47
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
InertialPtr inertial
Inertial properties.
Definition: Link.hh:679