Skip to content

Commit

Permalink
Added suggestions to improve the distance and gravity task computations
Browse files Browse the repository at this point in the history
Co-authored-by: Giulio Romualdi <giulio.romualdi@gmail.com>
  • Loading branch information
S-Dafarra and GiulioRomualdi committed Sep 27, 2023
1 parent 972ab04 commit 88eb49a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/IK/src/DistanceTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,9 @@ bool DistanceTask::update()
m_jacobian.rightCols(m_kinDyn->getNrOfDegreesOfFreedom()) = m_relativeJacobian;
}

m_computedDistance = sqrt(pow(m_framePosition(0), 2) + pow(m_framePosition(1), 2)
+ pow(m_framePosition(2), 2));
m_computedDistance = m_framePosition.norm();

toEigen(this->subA(m_robotVelocityVariable))
toEigen(this->subA(m_robotVelocityVariable)).noalias()
= (m_framePosition.transpose() * m_jacobian.topRows<3>())
/ (std::max(0.001, m_computedDistance));
m_b(0) = m_kp * (m_desiredDistance - m_computedDistance);
Expand Down
3 changes: 2 additions & 1 deletion src/IK/src/GravityTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ bool GravityTask::update()
}

toEigen(this->subA(m_robotVelocityVariable)) = m_Am * m_jacobian.bottomRows<3>();
m_b = -m_kp * m_bm * desiredZDirectionAbsolute + feedforwardAbsolute.topRows<2>();
m_b = feedforwardAbsolute.topRows<2>();
m_b.noalias() -= m_kp * m_bm * desiredZDirectionAbsolute;

m_isValid = true;
return m_isValid;
Expand Down

0 comments on commit 88eb49a

Please sign in to comment.