diff --git a/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeMode.java b/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeMode.java index c347d4229..748ea7b32 100644 --- a/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeMode.java +++ b/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeMode.java @@ -40,17 +40,19 @@ public static SumoLaneChangeMode translateFromEnum(final LaneChangeMode laneChan mode.setSublaneChanges(false, false); mode.setRespectOtherDrivers(RESPECT_SPEED_GAPS_OF_OTHER_DRIVERS_ADAPT_SPEED); break; + // For strategic lane changes (change lanes to continue the route), + // we always let SUMO overwrite requested lane changes (overrideTraci = true) case FOLLOW_ROUTE: mode.setSublaneChanges(false, false); - mode.setStrategicChanges(true, false); + mode.setStrategicChanges(true, true); mode.setRespectOtherDrivers(RESPECT_SPEED_GAPS_OF_OTHER_DRIVERS_ADAPT_SPEED); break; case AGGRESSIVE: - mode.setStrategicChanges(true, false); + mode.setStrategicChanges(true, true); mode.setSpeedChanges(true, false); break; case CAUTIOUS: - mode.setStrategicChanges(true, false); + mode.setStrategicChanges(true, true); mode.setCooperativeChanges(true, false); mode.setSpeedChanges(true, false); mode.setRightDriveChanges(true, false); @@ -59,7 +61,7 @@ public static SumoLaneChangeMode translateFromEnum(final LaneChangeMode laneChan case PASSIVE: case COOPERATIVE: case DEFAULT: - mode.setStrategicChanges(true, false); + mode.setStrategicChanges(true, true); mode.setCooperativeChanges(true, false); mode.setSpeedChanges(true, false); mode.setRightDriveChanges(true, false); diff --git a/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeModeTest.java b/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeModeTest.java index 7430ccff6..ae3330d45 100644 --- a/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeModeTest.java +++ b/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/bridge/api/complex/SumoLaneChangeModeTest.java @@ -90,13 +90,13 @@ public void testGetAsInteger_overrideTraci() { @Test public void testTranslateFromEnum() { - assertEquals(1621, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.DEFAULT).getAsInteger()); + assertEquals(1622, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.DEFAULT).getAsInteger()); assertEquals(512, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.OFF).getAsInteger()); - assertEquals(513, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.FOLLOW_ROUTE).getAsInteger()); - assertEquals(1041, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.AGGRESSIVE).getAsInteger()); - assertEquals(1621, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.COOPERATIVE).getAsInteger()); - assertEquals(1877, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.CAUTIOUS).getAsInteger()); - assertEquals(1621, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.PASSIVE).getAsInteger()); + assertEquals(514, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.FOLLOW_ROUTE).getAsInteger()); + assertEquals(1042, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.AGGRESSIVE).getAsInteger()); + assertEquals(1622, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.COOPERATIVE).getAsInteger()); + assertEquals(1878, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.CAUTIOUS).getAsInteger()); + assertEquals(1622, SumoLaneChangeMode.translateFromEnum(LaneChangeMode.PASSIVE).getAsInteger()); } }