@@ -25,14 +25,31 @@ Eigen::VectorXd solo_q_start(const RobotModelHandler & model_handler)
2525 return q_start;
2626}
2727
28+ void check_joint_limits (
29+ const RobotModelHandler & model_handler,
30+ const Eigen::VectorXd & q,
31+ const Eigen::VectorXd & v,
32+ const Eigen::VectorXd & tau)
33+ {
34+ for (int i = 0 ; i < model_handler.getModel ().nv - 6 ; i++)
35+ {
36+ BOOST_CHECK_LE (q[7 + i], model_handler.getModel ().upperPositionLimit [7 + i]);
37+ BOOST_CHECK_GE (q[7 + i], model_handler.getModel ().lowerPositionLimit [7 + i]);
38+ BOOST_CHECK_LE (v[6 + i], model_handler.getModel ().upperVelocityLimit [6 + i]);
39+ BOOST_CHECK_GE (v[6 + i], -model_handler.getModel ().upperVelocityLimit [6 + i]);
40+ BOOST_CHECK_LE (tau[6 + i], model_handler.getModel ().upperEffortLimit [6 + i]);
41+ BOOST_CHECK_GE (tau[6 + i], model_handler.getModel ().lowerEffortLimit [6 + i]);
42+ }
43+ }
44+
2845BOOST_AUTO_TEST_CASE (KinodynamicsID_postureTask)
2946{
3047 RobotModelHandler model_handler = getSoloHandler ();
3148 RobotDataHandler data_handler (model_handler);
3249 const double dt = 1e-3 ;
3350
3451 KinodynamicsID solver (
35- model_handler, dt, KinodynamicsID::Settings ().set_kp_posture (10 .).set_w_posture (1 .)); // only a posture task
52+ model_handler, dt, KinodynamicsID::Settings ().set_kp_posture (20 .).set_w_posture (1 .)); // only a posture task
3653
3754 const Eigen::VectorXd q_target = model_handler.getReferenceState ().head (model_handler.getModel ().nq );
3855
@@ -67,6 +84,9 @@ BOOST_AUTO_TEST_CASE(KinodynamicsID_postureTask)
6784 Eigen::VectorXd new_error = pinocchio::difference (model_handler.getModel (), q, q_target);
6885 BOOST_CHECK_LE (new_error.norm (), error.norm ());
6986 error = new_error;
87+
88+ // Check joints limits
89+ check_joint_limits (model_handler, q, v, tau);
7090 }
7191}
7292
@@ -133,6 +153,9 @@ BOOST_AUTO_TEST_CASE(KinodynamicsID_contact)
133153 // Robot had time to reach permanent regime, is it robot free falling ?
134154 BOOST_CHECK_SMALL (a.head (3 ).norm () - model_handler.getModel ().gravity .linear ().norm (), 0.01 );
135155 }
156+
157+ // Check joints limits
158+ check_joint_limits (model_handler, q, v, tau);
136159 }
137160}
138161
@@ -182,6 +205,8 @@ BOOST_AUTO_TEST_CASE(KinodynamicsID_baseTask)
182205 BOOST_CHECK (new_error.norm () < 2e-2 ); // Should have converged by now
183206
184207 error = new_error;
208+ // Check joints limits
209+ check_joint_limits (model_handler, q, v, tau);
185210 }
186211}
187212
@@ -237,6 +262,9 @@ BOOST_AUTO_TEST_CASE(KinodynamicsID_allTasks)
237262 Eigen::VectorXd new_error = pinocchio::difference (model_handler.getModel (), q, q_target);
238263 BOOST_CHECK_LE (new_error.norm (), error.norm ());
239264 error = new_error;
265+
266+ // Check joints limits
267+ check_joint_limits (model_handler, q, v, tau);
240268 }
241269}
242270
0 commit comments