Skip to content

Commit

Permalink
if button emulated, init HW clutch to 0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Poignonec committed Aug 20, 2024
1 parent 432de6d commit f2055d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fd_hardware/src/fd_effort_hi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ CallbackReturn FDEffortHardwareInterface::on_init(
inertia_interface_name_ = "fd_inertia";
}

// Contingency for emulated button
// (commanded clutch force might be always left to NaN...)
if (emulate_button_ &&
(info_.joints.size() == 4 || info_.joints.size() > 6))
{
// Prevent NaN in clutch cmd
hw_commands_effort_[info_.joints.size() - 1] = 0.0;
}

return CallbackReturn::SUCCESS;
}
// ------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -348,7 +357,6 @@ hardware_interface::return_type FDEffortHardwareInterface::write(
const rclcpp::Time & /*time*/,
const rclcpp::Duration & /*period*/)
{
// TODO(mcbed): write to FD system
bool isNan = false;
for (auto & command : hw_commands_effort_) {
if (command != command) {
Expand Down

0 comments on commit f2055d1

Please sign in to comment.