Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if button emulated, init HW clutch to 0.0 #27

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading