Skip to content

Commit

Permalink
Rename local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed May 25, 2024
1 parent 7554553 commit 4b06b5f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
23 changes: 12 additions & 11 deletions ackermann_steering_controller/src/ackermann_steering_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,29 @@ bool AckermannSteeringController::update_odometry(const rclcpp::Duration & perio
}
else
{
const double rear_right_wheel_value = state_interfaces_[STATE_TRACTION_RIGHT_WHEEL].get_value();
const double rear_left_wheel_value = state_interfaces_[STATE_TRACTION_LEFT_WHEEL].get_value();
const double front_right_steer_position =
state_interfaces_[STATE_STEER_RIGHT_WHEEL].get_value();
const double front_left_steer_position = state_interfaces_[STATE_STEER_LEFT_WHEEL].get_value();
const double traction_right_wheel_value =
state_interfaces_[STATE_TRACTION_RIGHT_WHEEL].get_value();
const double traction_left_wheel_value =
state_interfaces_[STATE_TRACTION_LEFT_WHEEL].get_value();
const double right_steer_position = state_interfaces_[STATE_STEER_RIGHT_WHEEL].get_value();
const double left_steer_position = state_interfaces_[STATE_STEER_LEFT_WHEEL].get_value();
if (
!std::isnan(rear_right_wheel_value) && !std::isnan(rear_left_wheel_value) &&
!std::isnan(front_right_steer_position) && !std::isnan(front_left_steer_position))
!std::isnan(traction_right_wheel_value) && !std::isnan(traction_left_wheel_value) &&
!std::isnan(right_steer_position) && !std::isnan(left_steer_position))
{
if (params_.position_feedback)
{
// Estimate linear and angular velocity using joint information
odometry_.update_from_position(
rear_right_wheel_value, rear_left_wheel_value, front_right_steer_position,
front_left_steer_position, period.seconds());
traction_right_wheel_value, traction_left_wheel_value, right_steer_position,
left_steer_position, period.seconds());
}
else
{
// Estimate linear and angular velocity using joint information
odometry_.update_from_velocity(
rear_right_wheel_value, rear_left_wheel_value, front_right_steer_position,
front_left_steer_position, period.seconds());
traction_right_wheel_value, traction_left_wheel_value, right_steer_position,
left_steer_position, period.seconds());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ bool BicycleSteeringController::update_odometry(const rclcpp::Duration & period)
}
else
{
const double rear_wheel_value = state_interfaces_[STATE_TRACTION_WHEEL].get_value();
const double traction_wheel_value = state_interfaces_[STATE_TRACTION_WHEEL].get_value();
const double steer_position = state_interfaces_[STATE_STEER_AXIS].get_value();
if (!std::isnan(rear_wheel_value) && !std::isnan(steer_position))
if (!std::isnan(traction_wheel_value) && !std::isnan(steer_position))
{
if (params_.position_feedback)
{
// Estimate linear and angular velocity using joint information
odometry_.update_from_position(rear_wheel_value, steer_position, period.seconds());
odometry_.update_from_position(traction_wheel_value, steer_position, period.seconds());
}
else
{
// Estimate linear and angular velocity using joint information
odometry_.update_from_velocity(rear_wheel_value, steer_position, period.seconds());
odometry_.update_from_velocity(traction_wheel_value, steer_position, period.seconds());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,26 @@ bool TricycleSteeringController::update_odometry(const rclcpp::Duration & period
}
else
{
const double rear_right_wheel_value = state_interfaces_[STATE_TRACTION_RIGHT_WHEEL].get_value();
const double rear_left_wheel_value = state_interfaces_[STATE_TRACTION_LEFT_WHEEL].get_value();
const double traction_right_wheel_value =
state_interfaces_[STATE_TRACTION_RIGHT_WHEEL].get_value();
const double traction_left_wheel_value =
state_interfaces_[STATE_TRACTION_LEFT_WHEEL].get_value();
const double steer_position = state_interfaces_[STATE_STEER_AXIS].get_value();
if (
!std::isnan(rear_right_wheel_value) && !std::isnan(rear_left_wheel_value) &&
!std::isnan(traction_right_wheel_value) && !std::isnan(traction_left_wheel_value) &&
!std::isnan(steer_position))
{
if (params_.position_feedback)
{
// Estimate linear and angular velocity using joint information
odometry_.update_from_position(
rear_right_wheel_value, rear_left_wheel_value, steer_position, period.seconds());
traction_right_wheel_value, traction_left_wheel_value, steer_position, period.seconds());
}
else
{
// Estimate linear and angular velocity using joint information
odometry_.update_from_velocity(
rear_right_wheel_value, rear_left_wheel_value, steer_position, period.seconds());
traction_right_wheel_value, traction_left_wheel_value, steer_position, period.seconds());
}
}
}
Expand Down

0 comments on commit 4b06b5f

Please sign in to comment.