Skip to content

Commit f01ad49

Browse files
FIX: consider lateral fluctuation margin (#108)
Updated ad_map_access to v2.4.5 Switched to clang-format-10
1 parent b7ea114 commit f01ad49

25 files changed

+170
-136
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ AlwaysBreakTemplateDeclarations: false
2323
BinPackArguments: false
2424
BinPackParameters: false
2525
BraceWrapping:
26+
AfterCaseLabel: true
2627
AfterClass: true
2728
AfterControlStatement: true
2829
AfterEnum: true

.github/workflows/code_format_check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ jobs:
1111

1212
name: Check Code Formatting
1313

14-
runs-on: ubuntu-16.04
14+
runs-on: ubuntu-20.04
1515

1616
steps:
1717
- uses: actions/checkout@v2
1818
with:
1919
submodules: true
2020

2121
- name: Install Dependencies
22-
run: sudo apt-get update && sudo apt-get install clang-format-3.9
22+
run: sudo apt-get update && sudo apt-get install clang-format-10
2323

2424
- name: Check Formatting
25-
run: failed=0; for file in `find . -path ./dependencies -prune -false -o -iname *.cpp -o -iname *.hpp`; do if [ `clang-format-3.9 $file -output-replacements-xml | grep -c "<replacement "` -ne 0 ]; then echo "$file does not match codeing style. Please run clang-format-3.9"; failed=1; fi; if [ $failed -ne 0 ]; then exit 1; fi; done
25+
run: failed=0; for file in `find . -path ./dependencies -prune -false -o -iname *.cpp -o -iname *.hpp`; do if [ `clang-format-10 $file -output-replacements-xml | grep -c "<replacement "` -ne 0 ]; then echo "$file does not match codeing style. Please run clang-format-10"; failed=1; fi; if [ $failed -ne 0 ]; then exit 1; fi; done

ad_rss/generated/src/ad/rss/state/RssStateEvaluator.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ template <>::ad::rss::state::RssStateEvaluator fromString(std::string const &str
6868
if (
6969
str
7070
== std::string(
71-
"::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane")) // LCOV_EXCL_BR_LINE
71+
"::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane")) // LCOV_EXCL_BR_LINE
7272
{
7373
return ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirectionEgoCorrectLane;
7474
}
@@ -85,8 +85,9 @@ template <>::ad::rss::state::RssStateEvaluator fromString(std::string const &str
8585
{
8686
return ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceOppositeDirection;
8787
}
88-
if (str == std::string(
89-
"::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront")) // LCOV_EXCL_BR_LINE
88+
if (str
89+
== std::string(
90+
"::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront")) // LCOV_EXCL_BR_LINE
9091
{
9192
return ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionEgoFront;
9293
}
@@ -96,7 +97,7 @@ template <>::ad::rss::state::RssStateEvaluator fromString(std::string const &str
9697
}
9798
if (str
9899
== std::string(
99-
"::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront")) // LCOV_EXCL_BR_LINE
100+
"::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront")) // LCOV_EXCL_BR_LINE
100101
{
101102
return ::ad::rss::state::RssStateEvaluator::LongitudinalDistanceSameDirectionOtherInFront;
102103
}
@@ -112,17 +113,19 @@ template <>::ad::rss::state::RssStateEvaluator fromString(std::string const &str
112113
{
113114
return ::ad::rss::state::RssStateEvaluator::LateralDistance;
114115
}
115-
if (str == std::string(
116-
"::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop")) // LCOV_EXCL_BR_LINE
116+
if (str
117+
== std::string(
118+
"::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop")) // LCOV_EXCL_BR_LINE
117119
{
118120
return ::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop;
119121
}
120122
if (str == std::string("IntersectionOtherPriorityEgoAbleToStop")) // LCOV_EXCL_BR_LINE
121123
{
122124
return ::ad::rss::state::RssStateEvaluator::IntersectionOtherPriorityEgoAbleToStop;
123125
}
124-
if (str == std::string(
125-
"::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop")) // LCOV_EXCL_BR_LINE
126+
if (str
127+
== std::string(
128+
"::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop")) // LCOV_EXCL_BR_LINE
126129
{
127130
return ::ad::rss::state::RssStateEvaluator::IntersectionEgoPriorityOtherAbleToStop;
128131
}

ad_rss/impl/include/ad/rss/core/RssResponseResolving.hpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ class RssResponseResolving
5757

5858
private:
5959
/*!
60-
* @brief updateAccelerationRestriction
61-
*
62-
* Updates the longitudinal accelerationRestriction
63-
*
64-
* @param[in] state - The unstructured scene state to update the acceleration restrictions with
65-
* @param[inout] driveAwayBrakeMin -- the minimal brakeMin of all drive-away states
66-
* @param[inout] driveAwayToBrakeTransition -- a transition from drive-Away to Brake happened
67-
* @param[inout] response -- the combined RSS response to become RSS safe.
68-
* @param[inout] responseHeadingRanges -- the combined RSS response heading ranges (for driving away)
69-
* @param[inout] accelerationRange - The combined restrictions on the vehicle acceleration to become RSS safe.
70-
*
71-
*/
60+
* @brief updateAccelerationRestriction
61+
*
62+
* Updates the longitudinal accelerationRestriction
63+
*
64+
* @param[in] state - The unstructured scene state to update the acceleration restrictions with
65+
* @param[inout] driveAwayBrakeMin -- the minimal brakeMin of all drive-away states
66+
* @param[inout] driveAwayToBrakeTransition -- a transition from drive-Away to Brake happened
67+
* @param[inout] response -- the combined RSS response to become RSS safe.
68+
* @param[inout] responseHeadingRanges -- the combined RSS response heading ranges (for driving away)
69+
* @param[inout] accelerationRange - The combined restrictions on the vehicle acceleration to become RSS safe.
70+
*
71+
*/
7272
void combineState(state::UnstructuredSceneRssState const &state,
7373
physics::Acceleration &driveAwayBrakeMin,
7474
bool &driveAwayToBrakeTransition,
@@ -77,29 +77,29 @@ class RssResponseResolving
7777
physics::AccelerationRange &accelerationRange);
7878

7979
/*!
80-
* @brief updateAccelerationRestriction
81-
*
82-
* Updates the longitudinal accelerationRestriction
83-
*
84-
* @param[in] state - The longitudinal state to update the acceleration restrictions with
85-
* @param[inout] response -- the combined RSS response to become RSS safe.
86-
* @param[inout] accelerationRange - The combined restrictions on the vehicle acceleration to become RSS safe.
87-
*
88-
*/
80+
* @brief updateAccelerationRestriction
81+
*
82+
* Updates the longitudinal accelerationRestriction
83+
*
84+
* @param[in] state - The longitudinal state to update the acceleration restrictions with
85+
* @param[inout] response -- the combined RSS response to become RSS safe.
86+
* @param[inout] accelerationRange - The combined restrictions on the vehicle acceleration to become RSS safe.
87+
*
88+
*/
8989
void combineState(state::LongitudinalRssState const &state,
9090
state::LongitudinalResponse &response,
9191
physics::AccelerationRange &accelerationRange);
9292

9393
/*!
94-
* @brief updateAccelerationRestriction
95-
*
96-
* Updates the lateral accelerationRestrictions
97-
*
98-
* @param[in] state - The lateral state to update the acceleration restrictions with
99-
* @param[inout] response -- the combined RSS response to become RSS safe.
100-
* @param[inout] accelerationRange - The restrictions on the vehicle acceleration to become RSS safe.
101-
*
102-
*/
94+
* @brief updateAccelerationRestriction
95+
*
96+
* Updates the lateral accelerationRestrictions
97+
*
98+
* @param[in] state - The lateral state to update the acceleration restrictions with
99+
* @param[inout] response -- the combined RSS response to become RSS safe.
100+
* @param[inout] accelerationRange - The restrictions on the vehicle acceleration to become RSS safe.
101+
*
102+
*/
103103
void combineState(state::LateralRssState const &state,
104104
state::LateralResponse &response,
105105
physics::AccelerationRange &accelerationRange);

ad_rss/impl/include/ad/rss/situation/Physics.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace situation {
3939
* @param[in] speed is the current speed
4040
* @param[in] acceleration is the acceleration value to be considered
4141
* @param[in] duration is the (positive) period of time the acceleration is performed
42-
* @param[out] distanceOffset is the distance offset from the current position.
42+
* @param[out] distanceOffset is the distance offset from the current position.
4343
*
4444
* @return true on success, false otherwise
4545
*/

ad_rss/impl/include/ad/rss/unstructured/Geometry.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,4 @@ inline std::string to_string(ad::rss::unstructured::Line value)
331331
stream << "]";
332332
return stream.str();
333333
}
334-
}
334+
} // namespace std

ad_rss/impl/src/core/RssSituationExtraction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ bool RssSituationExtraction::mergeSituations(situation::Situation const &otherSi
435435
|| (otherSituation.situationType != mergedSituation.situationType)
436436
|| !mergeVehicleStates(MergeMode::EgoVehicle, otherSituation.egoVehicleState, mergedSituation.egoVehicleState)
437437
|| !mergeVehicleStates(
438-
MergeMode::OtherVehicle, otherSituation.otherVehicleState, mergedSituation.otherVehicleState))
438+
MergeMode::OtherVehicle, otherSituation.otherVehicleState, mergedSituation.otherVehicleState))
439439
{
440440
return false;
441441
}

ad_rss/impl/src/situation/RssFormulas.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ bool calculateLateralDistanceOffsetAfterStatedBrakingPattern(Speed const &curren
7474
Distance distanceOffsetAfterResponseTime = Distance(0.);
7575

7676
bool result = calculateSpeedInAcceleratedMovement(currentSpeed, acceleration, responseTime, resultingSpeed);
77-
result = result && calculateDistanceOffsetInAcceleratedMovement(
78-
currentSpeed, acceleration, responseTime, distanceOffsetAfterResponseTime);
77+
result = result
78+
&& calculateDistanceOffsetInAcceleratedMovement(
79+
currentSpeed, acceleration, responseTime, distanceOffsetAfterResponseTime);
7980

8081
Distance distanceToStop = Distance(0.);
8182
if (std::signbit(static_cast<double>(resultingSpeed)) != std::signbit(static_cast<double>(deceleration)))
@@ -112,9 +113,9 @@ bool calculateSafeLongitudinalDistanceSameDirection(VehicleState const &leadingV
112113
followingVehicle.dynamics.alphaLon.brakeMin,
113114
distanceStatedBraking);
114115
Distance distanceMaxBrake = Distance(0.);
115-
result = result && calculateStoppingDistance(leadingVehicle.velocity.speedLon.minimum,
116-
leadingVehicle.dynamics.alphaLon.brakeMax,
117-
distanceMaxBrake);
116+
result = result
117+
&& calculateStoppingDistance(
118+
leadingVehicle.velocity.speedLon.minimum, leadingVehicle.dynamics.alphaLon.brakeMax, distanceMaxBrake);
118119

119120
if (result)
120121
{
@@ -256,18 +257,21 @@ bool calculateSafeLateralDistance(VehicleState const &leftVehicle,
256257
leftVehicle.dynamics.alphaLat.brakeMin,
257258
distanceOffsetStatedBrakingLeft);
258259

259-
result = result && calculateLateralDistanceOffsetAfterStatedBrakingPattern( // LCOV_EXCL_LINE: wrong detection
260-
rightVehicle.velocity.speedLat.minimum,
261-
rightVehicle.dynamics.responseTime,
262-
-rightVehicle.dynamics.alphaLat.accelMax,
263-
-rightVehicle.dynamics.alphaLat.brakeMin,
264-
distanceOffsetStatedBrakingRight);
260+
result = result
261+
&& calculateLateralDistanceOffsetAfterStatedBrakingPattern( // LCOV_EXCL_LINE: wrong detection
262+
rightVehicle.velocity.speedLat.minimum,
263+
rightVehicle.dynamics.responseTime,
264+
-rightVehicle.dynamics.alphaLat.accelMax,
265+
-rightVehicle.dynamics.alphaLat.brakeMin,
266+
distanceOffsetStatedBrakingRight);
265267

266268
if (result)
267269
{
268270
// safe distance is the difference of both distances
269-
// Note: The fluctuation margin is already considered in the vehicle bounding boxes
270271
safeDistance = distanceOffsetStatedBrakingLeft - distanceOffsetStatedBrakingRight;
272+
// plus the lateral fluctuation margin: here we use the 0.5*my of both
273+
safeDistance
274+
+= 0.5 * (leftVehicle.dynamics.lateralFluctuationMargin + rightVehicle.dynamics.lateralFluctuationMargin);
271275
safeDistance = std::max(safeDistance, Distance(0.));
272276
}
273277
return result;

ad_rss/impl/src/situation/RssStructuredSceneIntersectionChecker.cpp

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,32 @@ bool RssStructuredSceneIntersectionChecker::checkLateralIntersect(Situation cons
4343
situation.egoVehicleState.distanceToEnterIntersection,
4444
timeToReachEgo);
4545

46-
result = result && calculateTimeToCoverDistance(situation.otherVehicleState.velocity.speedLon.maximum,
47-
situation.egoVehicleState.dynamics.maxSpeedOnAcceleration,
48-
situation.otherVehicleState.dynamics.responseTime,
49-
situation.otherVehicleState.dynamics.alphaLon.accelMax,
50-
situation.otherVehicleState.dynamics.alphaLon.brakeMin,
51-
situation.otherVehicleState.distanceToEnterIntersection,
52-
timeToReachOther);
53-
54-
result = result && calculateTimeToCoverDistance(situation.egoVehicleState.velocity.speedLon.minimum,
55-
situation.egoVehicleState.dynamics.maxSpeedOnAcceleration,
56-
situation.egoVehicleState.dynamics.responseTime,
57-
situation.egoVehicleState.dynamics.alphaLon.brakeMax,
58-
situation.egoVehicleState.dynamics.alphaLon.brakeMax,
59-
situation.egoVehicleState.distanceToLeaveIntersection,
60-
timeToLeaveEgo);
61-
62-
result = result && calculateTimeToCoverDistance(situation.otherVehicleState.velocity.speedLon.minimum,
63-
situation.egoVehicleState.dynamics.maxSpeedOnAcceleration,
64-
situation.otherVehicleState.dynamics.responseTime,
65-
situation.otherVehicleState.dynamics.alphaLon.brakeMax,
66-
situation.otherVehicleState.dynamics.alphaLon.brakeMax,
67-
situation.otherVehicleState.distanceToLeaveIntersection,
68-
timeToLeaveOther);
46+
result = result
47+
&& calculateTimeToCoverDistance(situation.otherVehicleState.velocity.speedLon.maximum,
48+
situation.egoVehicleState.dynamics.maxSpeedOnAcceleration,
49+
situation.otherVehicleState.dynamics.responseTime,
50+
situation.otherVehicleState.dynamics.alphaLon.accelMax,
51+
situation.otherVehicleState.dynamics.alphaLon.brakeMin,
52+
situation.otherVehicleState.distanceToEnterIntersection,
53+
timeToReachOther);
54+
55+
result = result
56+
&& calculateTimeToCoverDistance(situation.egoVehicleState.velocity.speedLon.minimum,
57+
situation.egoVehicleState.dynamics.maxSpeedOnAcceleration,
58+
situation.egoVehicleState.dynamics.responseTime,
59+
situation.egoVehicleState.dynamics.alphaLon.brakeMax,
60+
situation.egoVehicleState.dynamics.alphaLon.brakeMax,
61+
situation.egoVehicleState.distanceToLeaveIntersection,
62+
timeToLeaveEgo);
63+
64+
result = result
65+
&& calculateTimeToCoverDistance(situation.otherVehicleState.velocity.speedLon.minimum,
66+
situation.egoVehicleState.dynamics.maxSpeedOnAcceleration,
67+
situation.otherVehicleState.dynamics.responseTime,
68+
situation.otherVehicleState.dynamics.alphaLon.brakeMax,
69+
situation.otherVehicleState.dynamics.alphaLon.brakeMax,
70+
situation.otherVehicleState.distanceToLeaveIntersection,
71+
timeToLeaveOther);
6972

7073
if (result)
7174
{

ad_rss/impl/src/unstructured/TrajectoryCommon.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ struct TrafficParticipantLocation
172172
};
173173

174174
/*!
175-
* a trajectory
176-
*/
175+
* a trajectory
176+
*/
177177
using Trajectory = std::vector<TrajectoryPoint>;
178178

179179
struct TrajectorySetStepVehicleLocation

0 commit comments

Comments
 (0)