File tree Expand file tree Collapse file tree 2 files changed +22
-12
lines changed
stars-importer-carla/src/main/kotlin/tools/aqua/stars/importer/carla Expand file tree Collapse file tree 2 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ All notable changes to this project will be documented in this file.
3030
3131### Fixed
3232- Fix `` TotalTickDifferenceMetric `` throwing `` IllegalStateException `` when presented the same tick twice.
33+ - Fix yield calculation for specific CARLA maps.
3334
3435### Changed
3536- Change implementation of ` TotalTickDifferenceMetric ` to use new ` TickAndTickSequenceMetricProvider ` .
Original file line number Diff line number Diff line change @@ -482,20 +482,29 @@ private fun Lane.update() {
482482 // both lanes are straight -> use angle of points at contact area
483483 // for "left before right" calculation
484484 this .isStraight && otherLane.isStraight -> {
485- val thisYaw =
486- this .laneMidpoints
487- .first {
488- checkNotNull(this .contactPointPos(otherLane)) > it.distanceToStart
485+ val thisContactPoint = checkNotNull(this .contactPointPos(otherLane))
486+ val otherContactPoint = checkNotNull(otherLane.contactPointPos(this ))
487+
488+ val thisMid =
489+ this .laneMidpoints.firstOrNull { thisContactPoint > it.distanceToStart }
490+ ? : this .laneMidpoints.firstOrNull {
491+ thisContactPoint >= it.distanceToStart
489492 }
490- .rotation
491- .yaw
492- val otherYaw =
493- otherLane.laneMidpoints
494- .first {
495- checkNotNull(otherLane.contactPointPos(this )) > it.distanceToStart
493+ ? : error(
494+ " No midpoint found for this lane: cp=$thisContactPoint , midpoints=${this .laneMidpoints.size} "
495+ )
496+
497+ val otherMid =
498+ otherLane.laneMidpoints.firstOrNull { otherContactPoint > it.distanceToStart }
499+ ? : otherLane.laneMidpoints.firstOrNull {
500+ otherContactPoint >= it.distanceToStart
496501 }
497- .rotation
498- .yaw
502+ ? : error(
503+ " No midpoint found for other lane: cp=$otherContactPoint , midpoints=${otherLane.laneMidpoints.size} "
504+ )
505+
506+ val thisYaw = thisMid.rotation.yaw
507+ val otherYaw = otherMid.rotation.yaw
499508
500509 thisYaw > otherYaw
501510 /*
You can’t perform that action at this time.
0 commit comments