Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Weird situation where wantsAndCouldChangeLane fails and cooperative action clarification

Hello, if this question needs more information / screenshots - I could try and modify it if it's not clear.

Thank you.

Sincerely,
Hriday


On Wed, 13 Apr 2022 at 19:58, Hriday Sanghvi <sanghvih@xxxxxx> wrote:
Hello,

Lane change mode: 1621 (default)
Lane change model: SL2015
Max. duration given for a vehicle to perform a lane change: 10 s (arbitrary)

1. I am trying to discourage lane changes enforced by TraCI that are not valid, i.e.,

A vehicle trying to move to the right or the left from the rightmost or leftmost lane in the network respectively, or a vehicle that cannot perform a certain lane change operation within the given time due to other vehicles blocking it.

For a lane change operation initiated on a vehicle by

traci.vehicle.changeLaneRelative(vehID=veh_id, indexOffset=dr, duration=lc_max_duration)

The following code should tell me if the lane change will be a success:

lcs = traci.vehicle.getLaneChangeState(vehID=veh_id, direction=dr)[1] # index 1 for TraCI
lc_success = traci.vehicle.wantsAndCouldChangeLane(vehID=veh_id, direction=dr, state=lcs)

However, in the particular case where direction=0 (stay in the same lane), it still returns false. This made sense in a situation where the vehicle was still in the middle of a previous lane change from another lane (where it was between two lanes, and hence cannot "stay" in the same lane).

a. But it also happened to a vehicle that had departed from the rightmost lane and chose to "stay". I could not understand it even with the help of the console output's 'pretty' version of the Lane change state for the TraCI command as shown:

veh id: f.2 (currently on lane 0)
lc success: False
lcs pretty: ['stay', 'TraCI', 'sublane']
Direction: 0

b. On a side note, the pretty version of the lane change state seems to be empty when it encounters a situation where the TraCI command tries to move the vehicle to a lane that doesn't exist, i.e. "move right" on the rightmost lane - just looking for confirmation?

veh id: f.0 (currently on lane 0)
lc success: False
lcs pretty: []
Direction: -1

2. I am trying to program an action that translates to "cooperate" with another vehicle. For this, I need to know what needs to be done in a situation where a leader/follower vehicle on the same or a different lane is blocking another vehicle from changing lanes. So if I can figure out the minimum changes that need to be made to resolve this situation - for example, the lateral distance between the ego vehicle and blocking vehicle has to be at least m and the longitudinal distance between ego and blocking vehicle has to be at least Y m or maybe the relative speed difference has to be at least S m/s, then the lane change can go ahead.

As I understand it, my question would be answered from this:

but there are many components like the TraCI constant tc.LC_BLOCKED and how/when it is set that I don't fully understand.

Please advise. Thank you.

Sincerely,
Hriday

Back to the top