Skip to content

Commit

Permalink
Add joint limits task in the IK
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRomualdi committed Sep 18, 2024
1 parent 1257b6e commit 9b9a4d8
Show file tree
Hide file tree
Showing 18 changed files with 192 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"

Expand All @@ -24,5 +26,14 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"

Expand All @@ -24,5 +26,14 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand Down Expand Up @@ -26,6 +27,16 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.002
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"

Expand All @@ -24,5 +26,14 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.002
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand Down Expand Up @@ -26,6 +27,17 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.001
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true


[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand Down Expand Up @@ -26,6 +27,16 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.001
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"

Expand All @@ -24,5 +26,14 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.001
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand Down Expand Up @@ -26,6 +27,16 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.001
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand Down Expand Up @@ -26,6 +27,16 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.001
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"

Expand All @@ -24,5 +26,14 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.001
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand All @@ -20,6 +21,16 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@ frame_name "l_sole"
kp_linear 4.0
kp_angular 2.0

[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand Down Expand Up @@ -26,6 +27,17 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true


[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"

Expand Down Expand Up @@ -25,5 +27,14 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false


[IK]
robot_velocity_variable_name "robot_velocity"
Expand All @@ -20,6 +22,16 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0

[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use_feedforward_term_for_joint_retargeting false
use_joints_limits_task false

[IK]
robot_velocity_variable_name "robot_velocity"
Expand All @@ -20,6 +21,16 @@ frame_name "l_sole"
kp_linear 7.0
kp_angular 5.0


[JOINT_LIMITS_TASK]
sampling_time 0.01
klim (1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
use_model_limits true

[include TORSO_TASK "./tasks/torso.ini"]
[include JOINT_REGULARIZATION_TASK "./tasks/regularization.ini"]
[include JOINT_RETARGETING_TASK "./tasks/retargeting.ini"]
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <BipedalLocomotion/ContinuousDynamicalSystem/MultiStateWeightProvider.h>
#include <BipedalLocomotion/IK/CoMTask.h>
#include <BipedalLocomotion/IK/JointTrackingTask.h>
#include <BipedalLocomotion/IK/JointLimitsTask.h>
#include <BipedalLocomotion/IK/QPInverseKinematics.h>
#include <BipedalLocomotion/IK/R3Task.h>
#include <BipedalLocomotion/IK/SE3Task.h>
Expand Down Expand Up @@ -64,11 +65,13 @@ class BLFIK
std::shared_ptr<BipedalLocomotion::IK::R3Task> m_rootTask;
std::shared_ptr<BipedalLocomotion::IK::JointTrackingTask> m_jointRetargetingTask;
std::shared_ptr<BipedalLocomotion::IK::JointTrackingTask> m_jointRegularizationTask;
std::shared_ptr<BipedalLocomotion::IK::JointLimitsTask> m_jointLimitsTask;

iDynTree::VectorDynSize m_jointVelocity;
bool m_usejointRetargeting{false};
bool m_useRootLinkForHeight{false};
bool m_useFeedforwardTermForJointRetargeting{false};
bool m_useJointLimitsTask{false};
};

} // namespace WalkingControllers
Expand Down
12 changes: 12 additions & 0 deletions src/WholeBodyControllers/src/BLFIK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ bool BLFIK::initialize(
m_useRootLinkForHeight = false;
ptr->getParameter("use_root_link_for_height", m_useRootLinkForHeight);

m_useJointLimitsTask = false;
ptr->getParameter("use_joints_limits_task", m_useJointLimitsTask);

// weight providers
bool ok = m_qpIK.initialize(ptr->getGroup("IK"));
auto group = ptr->getGroup("IK").lock();
Expand Down Expand Up @@ -110,6 +113,15 @@ bool BLFIK::initialize(
m_jointRetargetingWeight);
}


if (m_useJointLimitsTask)
{
m_jointLimitsTask = std::make_shared<BipedalLocomotion::IK::JointLimitsTask>();
ok = ok && m_jointLimitsTask->setKinDyn(kinDyn);
ok = ok && m_jointLimitsTask->initialize(ptr->getGroup("JOINT_LIMITS_TASK"));
ok = ok && m_qpIK.addTask(m_jointLimitsTask, "joint_limits_task", highPriority);
}

if (m_useRootLinkForHeight)
{
m_rootTask = std::make_shared<BipedalLocomotion::IK::R3Task>();
Expand Down

0 comments on commit 9b9a4d8

Please sign in to comment.