Skip to content

Commit f63c3c5

Browse files
committed
[fix] in read/write, replace if-else with if clauses
* with if-else clauses, the block exits after first true condition, leaving vel/acc interfaces unread/unwritten
1 parent 29aafc7 commit f63c3c5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

admittance_controller/src/admittance_controller.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,13 @@ void AdmittanceController::read_state_from_hardware(
484484
state_interfaces_[pos_ind * num_joints_ + joint_ind].get_value();
485485
nan_position |= std::isnan(state_current.positions[joint_ind]);
486486
}
487-
else if (has_velocity_state_interface_)
487+
if (has_velocity_state_interface_)
488488
{
489489
state_current.velocities[joint_ind] =
490490
state_interfaces_[vel_ind * num_joints_ + joint_ind].get_value();
491491
nan_velocity |= std::isnan(state_current.velocities[joint_ind]);
492492
}
493-
else if (has_acceleration_state_interface_)
493+
if (has_acceleration_state_interface_)
494494
{
495495
state_current.accelerations[joint_ind] =
496496
state_interfaces_[acc_ind * num_joints_ + joint_ind].get_value();
@@ -536,12 +536,12 @@ void AdmittanceController::write_state_to_hardware(
536536
command_interfaces_[pos_ind * num_joints_ + joint_ind].set_value(
537537
state_commanded.positions[joint_ind]);
538538
}
539-
else if (has_velocity_command_interface_)
539+
if (has_velocity_command_interface_)
540540
{
541541
command_interfaces_[vel_ind * num_joints_ + joint_ind].set_value(
542542
state_commanded.velocities[joint_ind]);
543543
}
544-
else if (has_acceleration_command_interface_)
544+
if (has_acceleration_command_interface_)
545545
{
546546
command_interfaces_[acc_ind * num_joints_ + joint_ind].set_value(
547547
state_commanded.accelerations[joint_ind]);

0 commit comments

Comments
 (0)