Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Palczuk <[email protected]>
  • Loading branch information
TauTheLepton committed Feb 6, 2025
1 parent 7f418b1 commit ac69fdb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions simulation/traffic_simulator/src/lanelet_wrapper/lane_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,10 @@ auto laneChangeTrajectory(
const LaneletPose & from_lanelet_pose, const Parameter & lane_change_parameter)
-> std::optional<std::pair<Curve, double>>
{
double longitudinal_distance = [&]() {
switch (lane_change_parameter.constraint.type) {
case Constraint::Type::LONGITUDINAL_DISTANCE:
return lane_change_parameter.constraint.value;
default:
return Parameter::default_lanechange_distance;
}
}();
const double longitudinal_distance =
lane_change_parameter.constraint.type == Constraint::Type::LONGITUDINAL_DISTANCE
? lane_change_parameter.constraint.value
: Parameter::default_lanechange_distance;

const auto along_lanelet_pose = pose::alongLaneletPose(from_lanelet_pose, longitudinal_distance);
auto left_boundary_lanelet_pose = along_lanelet_pose;
Expand Down

0 comments on commit ac69fdb

Please sign in to comment.