Skip to content

Commit 9c3885a

Browse files
committed
Cleanup and log levels
1 parent 6c92aa4 commit 9c3885a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

nav2_velocity_smoother/src/velocity_smoother.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ double VelocitySmoother::applyConstraints(
293293
const double v_curr, const double v_cmd,
294294
const double accel, const double decel, const double eta)
295295
{
296-
double scaled = eta * v_cmd;
297-
double diff = scaled - v_curr;
296+
double v_scaled = eta * v_cmd;
297+
double v_diff = v_scaled - v_curr;
298298

299299
double v_component_max;
300300
double v_component_min;
@@ -310,14 +310,14 @@ double VelocitySmoother::applyConstraints(
310310
v_component_min = decel / smoothing_frequency_;
311311
}
312312

313-
auto clamped_diff = std::clamp(diff, v_component_min, v_component_max);
314-
auto restricted_command = v_curr + clamped_diff;
313+
auto v_diff_clamped = std::clamp(v_diff, v_component_min, v_component_max);
314+
auto v_cmd_restricted = v_curr + v_diff_clamped;
315315

316-
if(std::abs(scaled - restricted_command) > 0.0001){
317-
RCLCPP_WARN(get_logger(), "Clamped velocity change: eta * v_cmd = %f, clamped to %f", scaled, restricted_command);
316+
if(std::abs(v_scaled - v_cmd_restricted) > 0.0001){
317+
RCLCPP_DEBUG(get_logger(), "Clamped velocity change: eta * v_cmd = %f, clamped to %f", v_scaled, v_cmd_restricted);
318318
}
319319

320-
return restricted_command;
320+
return v_cmd_restricted;
321321
}
322322

323323
void VelocitySmoother::smootherTimer()
@@ -350,8 +350,8 @@ void VelocitySmoother::smootherTimer()
350350
current_ = odom_smoother_->getTwistStamped();
351351
}
352352

353-
RCLCPP_INFO(get_logger(), "current (odom) velocity: [%f, %f, %f]", current_.twist.linear.x, current_.twist.linear.y, current_.twist.angular.z);
354-
RCLCPP_INFO(get_logger(), "input velocity: [%f, %f, %f]", command_->twist.linear.x, command_->twist.linear.y, command_->twist.angular.z);
353+
RCLCPP_DEBUG(get_logger(), "Current (odom) velocity: [%f, %f, %f]", current_.twist.linear.x, current_.twist.linear.y, current_.twist.angular.z);
354+
RCLCPP_DEBUG(get_logger(), "Input velocity: [%f, %f, %f]", command_->twist.linear.x, command_->twist.linear.y, command_->twist.angular.z);
355355

356356
// Apply absolute velocity restrictions to the command
357357
if(!is_6dof_) {
@@ -385,15 +385,14 @@ void VelocitySmoother::smootherTimer()
385385
max_velocities_[5]);
386386
}
387387

388-
RCLCPP_INFO(get_logger(), "clamped velocity: [%f, %f, %f]", command_->twist.linear.x, command_->twist.linear.y, command_->twist.angular.z);
388+
RCLCPP_DEBUG(get_logger(), "Clamped velocity: [%f, %f, %f]", command_->twist.linear.x, command_->twist.linear.y, command_->twist.angular.z);
389389

390390
// Find if any component is not within the acceleration constraints. If so, store the most
391391
// significant scale factor to apply to the vector <dvx, dvy, dvw>, eta, to reduce all axes
392392
// proportionally to follow the same direction, within change of velocity bounds.
393393
// In case eta reduces another axis out of its own limit, apply accel constraint to guarantee
394394
// output is within limits, even if it deviates from requested command slightly.
395395
double eta = 1.0;
396-
RCLCPP_INFO(get_logger(), "scale_velocities_ = %d", (int) scale_velocities_);
397396
if (scale_velocities_) {
398397
double curr_eta = -1.0;
399398
if(!is_6dof_) {
@@ -452,6 +451,7 @@ void VelocitySmoother::smootherTimer()
452451
}
453452
}
454453
}
454+
RCLCPP_DEBUG(get_logger(), "Eta = %f", eta);
455455

456456
if(!is_6dof_) {
457457
cmd_vel->twist.linear.x = applyConstraints(

0 commit comments

Comments
 (0)