Skip to content

Commit c12907f

Browse files
author
Thibault Poignonec
committed
fix impedance law
1 parent e94d0de commit c12907f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cartesian_vic_controller/src/rules/vanilla_cartesian_impedance_rule.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ bool VanillaCartesianImpedanceRule::compute_controls(
212212
M_inv = M.inverse();
213213
}
214214

215-
216215
// Compute impedance control law in the base frame
217216
// ------------------------------------------------
218217
// VIC rule: M * err_p_ddot + D * err_p_dot + K * err_p = F_ext - F_ref
@@ -278,12 +277,15 @@ bool VanillaCartesianImpedanceRule::compute_controls(
278277
if (parameters_.vic.use_natural_robot_inertia) {
279278
raw_joint_command_effort_ = \
280279
vic_input_data.natural_joint_space_inertia.diagonal().asDiagonal() *
281-
vic_command_data.joint_command_acceleration; // F_ext is already cancelled in IC Eq.
280+
vic_command_data.joint_command_acceleration;
281+
// Note: F_ext is already cancelled in IC Eq.
282+
// See https://www.diag.uniroma1.it/deluca/rob2_en/15_ImpedanceControl.pdf (page 9)
283+
// J_.transpose() * (vic_input_data.natural_cartesian_inertia * M_inv - I_) * F_ext;
282284
} else {
283285
raw_joint_command_effort_ = \
284-
vic_input_data.natural_joint_space_inertia.diagonal().asDiagonal() *
285-
vic_command_data.joint_command_acceleration - \
286-
J_.transpose() * F_ext;
286+
vic_input_data.natural_joint_space_inertia.diagonal().asDiagonal()
287+
* vic_command_data.joint_command_acceleration
288+
+ J_.transpose() * F_ext;
287289
}
288290

289291
// Gravity compensation

0 commit comments

Comments
 (0)