Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Different behavior when setting Lane change mode vs. setting lcParameters

Hello,

I have pasted the TraCI code in the message body:

import os
import sys

if 'SUMO_HOME' in os.environ:
sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools'))
from traci.exceptions import TraCIException
import traci.constants as tc
import libsumo as traci
else:
sys.exit("please declare environment variable 'SUMO_HOME'")

sumo_cfg = './scenario_sublane/sumo.cfg.xml'#.format(pathlib.Path(__file__).parent.absolute())
sumo_parameters = ['sumo', '-c', sumo_cfg]

# traci.start(sumo_parameters) # without GUI

traci.init(9999) # with GUI

END = 86400.0
NUMBER_OF_VEH = 100
LC_MODE = 1557 # everything except drive right changes; 512 to disable ALL

GHOST_POS = 750.0
BLOCK_LENGTH = 250.0
BLOCK_LANE = 0

type_id = 'ghost'
traci.vehicletype.copy('DEFAULT_VEHTYPE', type_id)

traci.vehicle.add(vehID='ghost1', routeID='r0', typeID='ghost', depart=0, departLane=BLOCK_LANE, departPos=GHOST_POS, departSpeed='random', arrivalLane='current', arrivalPos=GHOST_POS)

traci.vehicle.setColor(typeID='ghost1',color=(255,0,0))
traci.vehicle.setLength(typeID='ghost1',length=BLOCK_LENGTH)
traci.vehicle.setStop(vehID='ghost1', edgeID='1f2', pos=GHOST_POS, laneIndex=BLOCK_LANE, duration=10, until=END)

STEP = 0
arrived = 0
while arrived < NUMBER_OF_VEH:

print('################ SIM TIME: {} ##################'.format(traci.simulation.getTime()))
print('################ SIM STEP COUNT: {} ################'.format(STEP))
print('\n')

for vh in traci.vehicle.getIDList():
if 'ghost' not in vh:
traci.vehicle.setLaneChangeMode(vh, LC_MODE)
else:
continue

STEP+=1

arrived += traci.simulation.getArrivedNumber()
traci.simulationStep()
traci.close()

print('ARRIVED: {}'.format(arrived))

>>The ego vehicle computes speed adaptations for itself and the surrounding vehicles that would help in completing the lane change in future steps.
Optimal adaptation means that all vehicles use these exact speeds (whereas the adaptations are reduced at lower levels of cooperation).

How far ahead into the future does it make these adaptations? (in steps, I presume?)

Thank you.

Sincerely,
Hriday


On Thu, 19 May 2022 at 11:57, Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
I'm assuming your scenario uses traci to create the blockage but the relevant code is missing from your zip archive. Possibly there is some sort of filtering going on so you might want to try renaming your python files to .txt.

>> lcCooperative="0" prevents cooperative changing if there is any inconvenience.
> What would be considered an 'inconvenient' speed adaptation for a lane change when setting lcCooperative to 0 instead of -1?

if the vehicle expects to travel slower on the target lane, this is an inconvenience.

>> if you set lcCooperative to 1  then "optimal" speed adaptations will take place
> What would be considered an 'optimal' speed adaptation?

The ego vehicle computes speed adaptations for itself and the surrounding vehicles that would help in completing the lane change in future steps.
Optimal adaptation means that all vehicles use these exact speeds (whereas the adaptations are reduced at lower levels of cooperation).

Am Mi., 18. Mai 2022 um 10:07 Uhr schrieb Hriday Sanghvi via sumo-user <sumo-user@xxxxxxxxxxx>:
Hello,

>> lcCooperative="0" prevents cooperative changing if there is any inconvenience.

What would be considered an 'inconvenient' speed adaptation for a lane change when setting lcCooperative to 0 instead of -1?

>> if you set lcCooperative to 1  then "optimal" speed adaptations will take place

What would be considered an 'optimal' speed adaptation?

Thank you.

Sincerely,
Hriday


On Wed, 18 May 2022 at 08:13, Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
In a simulation where you do not send any traci commands, the behavior should be the same in both cases (and this was the situation I had in mind for my previous explanation).

If you are requesting lane changes, than vehicles will still perform some amount of speed adaptation to resolve blockings and this adaptation is subject to
lcCooperativeSpeed (which defaults to the value of lcCooperative).

- if you set lcCooperative to 0 (or -1) then no speed adaptations will ever take place (this holds for all sumo version)
- if you set lcCooperative to 1  then "optimal" speed adaptations will take place

The difference in speed adaption should be fully responsible for the changes you are seeing.

Am Mi., 18. Mai 2022 um 08:43 Uhr schrieb Hriday Sanghvi via sumo-user <sumo-user@xxxxxxxxxxx>:

Hello again,

What I have observed is that even after setting the laneChangeMode to 512, setting the parameters lcStrategic, lcSpeedGain, lcCooperative to different values have different effects. That is what is being captured by the table:

+-----------------+---------+------+
lc_params       | lc_mode | Time |
+-----------------+---------+------+
| Set to 1        | 512     | 241  |
+-----------------+---------+------+
| Unset (default) | 512     | 241  |
+-----------------+---------+------+
| Set to 0        | 512     | 172  |
+-----------------+---------+------+

As you can see, keeping the lane change mode fixed in all cases (at 512), if I either set the parameters to 1 or let them inherit the default value (of 1), the time taken for the simulation is 241 steps. However, with the parameters set to 0, the time taken for the same simulation with the same lane change mode is 172 steps. This is the part I don't understand. Please advise.

Thank you.

Sincerely,
Hriday

On Wed, 18 May 2022 at 07:21, Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:

So what I now understand is:

Only in the development version, if I set lane change mode to 512 (it disables everything else apart from safety), now it will behave as expected - that is, no strategic, speed gain or cooperative changes.
But if I use an older version before the changes have been implemented, I should also set lcStrategic to -1 and lcCooperative to -1.

Please confirm. Thank you.



a) In all sumo versions, setting laneChangeMode to 0 or 512 disables all autonomous changing. In this mode, cars only change if you tell them to change (i.e. with traci.vehicle.changeLane)

Only in the development version:
b) If you do not set laneChangeMode but instead set lcStrategic=-1, lcSpeedGain=0 and lcCooperative=-1 lcKeepRight=0 , you will achieve the same effect: cars only change if you tell them to change (i.e. with traci.vehicle.changeLane)

Thus, in the development version combining both settings (a + b) has no additional effect over only doing a) or b) alone.

in older versions, b) still permits some autonomous changes to happen so if you want to disable all changes, you have to use a)


 
Sincerely,
Hriday

On Tue, 17 May 2022 at 08:34, Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
 No.
To disable strategic laneChanging completely, you can either
- set laneChangeMode
- or set lcStrategic="-1"

because only setting lcStrategic="0" still allows changing at the end of the lane.

b)
lcSpeedGain="0"  still is equivalent to lcSpeedGain="0.001" in version 1.13.0 but disables changing for speedGain completely in the development version (https://github.com/eclipse/sumo/issues/10709)

c)
lcCooperative="0" prevents cooperative changing if there is any inconvenience. However, if you set lcSpeedGain="0" lcCooperative="0" a vehicle might still perform a cooperative change if the target lane affords higher speed. To achieve the same affect as disabled-via-lane-change-mode you can set lcCooperative="-1" (again, this requires the dev version)

regards,
Jakob




Am Do., 12. Mai 2022 um 08:49 Uhr schrieb Hriday Sanghvi via sumo-user <sumo-user@xxxxxxxxxxx>:
Hello Jakob,

Thank you for the update. So if I understand correctly: to completely disable strategic lane changing by SUMO, I have to
1. set the laneChangeMode bits 0 and 1 (for strategic lane changes) to 0
AND also
2. set lcStrategic to -1 in my routes files for the vType
Because only setting relevant laneChangeMode bits and then setting lcStrategic=1 may still allow strategic lane changes at the end of the lane?

Is this also true for lcSpeedGain and lcCooperative? Since there are also changes in behaviour when I isolate lcCooperative parameter (keeping lcStrategic and lcSpeedGain fixed at 1), i.e.,
a. when I set laneChangeMode bits 2 and 3 to 0, and set lcCooperative to 1,
vs.
b. when I set laneChangeMode bits 2 and 3 to 0, and set lcCooperative to 0,

I would have expected a. and b. to give me the same behaviour/time to complete the simulation, since I believe laneChangeMode completely disabled certain types of lane changes - but it seems that the lcParams still have some effect. Please advise.

Thank you.

Sincerely,
Hriday


On Thu, 12 May 2022 at 06:36, Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
The key difference is that the laneChangeMode completely disables strategic lane changing whereas lcStrategic="0" only sets the strategic lookahead distance to the minimum possible value. Vehicles will still perform a strategic laneChange when reaching the very end of their lane.
You can set lcStrategic to a negative value to disable strategic lane changing completely but this was (until now) undocumented.

regards,
Jakob

Am Di., 10. Mai 2022 um 19:11 Uhr schrieb Hriday Sanghvi via sumo-user <sumo-user@xxxxxxxxxxx>:
Hello again,

I use lc_params to refer to the 3 parameters lcStrategic, lcCooperative, and lcSpeedGain in the previous email, and lc_mode to refer to the lane changing mode. To clarify, here are some experimental results for each case for 100 vehicles on a 1000 m road with 2 free lanes (NO blockages):
+-----------------+---------+------+
lc_params       | lc_mode | Time |
+-----------------+---------+------+
| Set to 1        | 512     | 241  |
+-----------------+---------+------+
| Unset (default) | 512     | 241  |
+-----------------+---------+------+
| Set to 0        | 512     | 172  |
+-----------------+---------+------+
| Set to 1        | 1621    | 204  |
+-----------------+---------+------+
| Unset (default) | 1621    | 204  |
+-----------------+---------+------+
| Set to 0        | 1621    | 218  |
+-----------------+---------+------+

As seen from the table, Regardless of whether the lc_params are set to their default value (1) explicitly, or if they are unset (default value is used), the result (time in steps) of the simulation stays the same in both cases of the lc_mode (512 and 1621). This is in line with my understanding. However, when the lc_mode is set to 512, lc_params should in fact make no difference since the behaviour controlled by these lc_params were already deactivated - namely, do no strategic changes, do no cooperative changes and do no speed gain changes.

So what I gather is that there is some form of hierarchy - Which parameter do I set to overwrite the other no matter what? Or why would setting lc_params to 0 in the case of lc_mode = 512 make a difference?

Thank you.

Sincerely,
Hriday

On Tue, 10 May 2022 at 14:01, Hriday Sanghvi <sanghvih@xxxxxx> wrote:
Hello,

My belief: The lane change mode 512 is supposed to disable all autonomous lane-changing except for safety-gap enforcement and collision avoidance. So setting lcSpeedGain=0 or lcStrategic=0 should be pointless, since that is the same effect achieved by setting lane change mode to 512, since bits 0 through 6 are all set to 0 : do no strategic changes, do no cooperative changes, do no speed gain changes, do no right drive changes;

Discovery: When I set lcStrategic=0, lcCooperative=0, and lcSpeedGain=0  on my vType anyway as such:
<vType lcStrategic="0" lcCooperative="0" lcSpeedGain="0" carFollowModel="Krauss" color="0,1,0" id="veh" latAlignment="center" lcKeepRight="0" lcLookaheadLeft="1" lcOvertakeRight="1" lcSpeedGainRight="1" length="5" sigma="0" speedDev="0" speedFactor="1.0" />
The behaviour seems to have changed drastically.

With an LC mode of 512,
1. Without setting the 3 lcParams, it takes 100 vehicles 477s to reach the end of a 1000m road with 2 lanes, with a small blockage from (500 - 750m) on one of the lanes.
2. Setting the 3 lcParams, it takes the same only 262s

Doubt: Am I misunderstanding what autonomous lane-changing means? Or are the two: lcParams and lane change mode not equivalent in the way I have mentioned?

Please advise.

Thank you.

Sincerely,
Hriday
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top