Skip to content

Commit

Permalink
Fixed lint issues by removing trailing whitespaces and limiting lines…
Browse files Browse the repository at this point in the history
… to 80 characters

Signed-off-by: Vedant87 <Vedantsr3@gmail.com>
  • Loading branch information
Vedant87 committed Mar 8, 2025
1 parent d1352ac commit 277ca01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ build_*
# Python cache
__pycache__
*.pyc

15 changes: 9 additions & 6 deletions include/gz/sim/Link.hh
Original file line number Diff line number Diff line change
Expand Up @@ -313,22 +313,25 @@ namespace gz
const math::Vector3d &_force,
const math::Vector3d &_position) const;

/// \brief Add a force expressed in link's center of masss coordinates
/// \brief Add a force expressed in link's center of masss coordinates
/// and applied at the center of mass of the link.
/// \param[in] _ecm Mutable Entity-component manager.
/// \param[in] _force Force to be applied expressed in link's center of mass coordinates
/// \param[in] _force Force to be applied expressed in link's
/// center of mass coordinates
public: void AddLinkForce(EntityComponentManager &_ecm,
const math::Vector3d &_force) const;
const math::Vector3d &_force) const;

/// \brief Add a force expressed in link's center of mass coordinates and applied at
/// \brief Add a force expressed in link's center of mass coordinates
/// and applied at
/// an offset from the center of mass of the link.
/// \param[in] _ecm Mutable Entity-component manager.
/// \param[in] _force Force to be applied expressed in link's center of mass coordinates
/// \param[in] _force Force to be applied expressed in link's center
/// of mass coordinates
/// \param[in] _position The point of application of the force expressed
/// in the link-fixed frame.
public: void AddLinkForce(EntityComponentManager &_ecm,
const math::Vector3d &_force,
const math::Vector3d &_position) const;
const math::Vector3d &_position) const;

/// \brief Add a wrench expressed in world coordinates and applied to
/// the link at the link's origin. This wrench is applied for one
Expand Down
12 changes: 2 additions & 10 deletions src/Link.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,7 @@ void Link::AddLinkForce(EntityComponentManager &_ecm,
const math::Vector3d &_force) const
{
auto worldPose = _ecm.ComponentData<components::WorldPose>(this->dataPtr->id)
.value_or(sim::worldPose(this->dataPtr->id, _ecm));


.value_or(sim::worldPose(this->dataPtr->id, _ecm));

// The force is expressed in terms of the link coordinates, but
// ExternalWorldForcecmd applies the force expressed in world coordinates
Expand All @@ -456,29 +454,23 @@ void Link::AddLinkForce(EntityComponentManager &_ecm,

// Apply Force using AddWorldForce method
this->AddWorldForce(_ecm, worldForce);

}

//////////////////////////////////////////////////
void Link::AddLinkForce(EntityComponentManager &_ecm,
const math::Vector3d &_force,
const math::Vector3d &_position) const
{

auto worldPose = _ecm.ComponentData<components::WorldPose>(this->dataPtr->id)
.value_or(sim::worldPose(this->dataPtr->id, _ecm));


.value_or(sim::worldPose(this->dataPtr->id, _ecm));

// The force is expressed in terms of the link coordinates, but
// ExternalWorldForceCmd applies the force expressed in world coordinates
// so we need to compute the force expressed in world coordinates
math::Vector3d worldForce = worldPose.Rot() * _force;


// Apply Force using AddWorldForce method
this->AddWorldForce(_ecm, worldForce, _position);

}

//////////////////////////////////////////////////
Expand Down

0 comments on commit 277ca01

Please sign in to comment.