Skip to content

Commit

Permalink
fix inconsitent sign of braking command
Browse files Browse the repository at this point in the history
  • Loading branch information
ralwing authored and Grzegorz Głowacki committed Sep 23, 2022
1 parent 1b23f84 commit af9366c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions vehicle/raw_vehicle_cmd_converter/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ void RawVehicleCommandConverterNode::publishActuationCmd()
}
if (!current_twist_ptr_ || !control_cmd_ptr_ || !current_steer_ptr_) {
RCLCPP_WARN_EXPRESSION(
get_logger(), is_debugging_, "some of twist/control_cmd/steer pointer is null");
get_logger(), is_debugging_, "some pointers are null: %s, %s, %s",
!current_twist_ptr_ ? "twist" : "", !control_cmd_ptr_ ? "cmd" : "",
!current_steer_ptr_ ? "steer" : "");
return;
}
double desired_accel_cmd = 0.0;
Expand All @@ -124,9 +126,9 @@ void RawVehicleCommandConverterNode::publishActuationCmd()
if (accel_cmd_is_zero) {
desired_brake_cmd = calculateBrakeMap(vel, acc);
}
} else {
// if conversion is disabled use acceleration as brake cmd
desired_brake_cmd = (acc < 0) ? acc : 0;
} else if (acc < 0) {
// if conversion is disabled use negative acceleration as brake cmd
desired_brake_cmd = -acc;
}
if (convert_steer_cmd_) {
desired_steer_cmd = calculateSteer(vel, steer, steer_rate);
Expand Down

0 comments on commit af9366c

Please sign in to comment.