Skip to content

Commit

Permalink
avoid sending nan commands to hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurlovekin committed Jan 10, 2025
1 parent bc0a12b commit 09a0d36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions diff_drive_controller/src/diff_drive_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ controller_interface::return_type DiffDriveController::update_and_write_commands
double linear_command = reference_interfaces_[0];
double angular_command = reference_interfaces_[1];

if(std::isnan(linear_command) || std::isnan(angular_command))
{
// NaNs occur when the controller is first initialized and the reference interfaces are not yet set
return controller_interface::return_type::OK;
}

// Apply (possibly new) multipliers:
const double wheel_separation = params_.wheel_separation_multiplier * params_.wheel_separation;
const double left_wheel_radius = params_.left_wheel_radius_multiplier * params_.wheel_radius;
Expand Down

0 comments on commit 09a0d36

Please sign in to comment.