eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.53k stars 1.42k forks source link

invalid speed returned by getSpeedWithoutTraCI #10947

Open namdre opened 2 years ago

namdre commented 2 years ago

In MSVehicle::executeMove there is a single point where traci incluences vehicle speed (MSVehicle::procesTraCISpeedControl) and here the originally intended speed is stored with myInfluencer->setOriginalSpeed. This sets the value to be returned by getSpeedWithoutTraCIInfluence.

However, there is an earlier call to myInfluencer->influenceSpeed in MSVehicle::planMove and the effects of this call are currently included in getSpeedWithoutTraCInfluence (even though the speed may have been very different without that influence).

namdre commented 2 years ago

Fixing this may not be easy: The TraCI influence is relevant for the planning process and this could mean the planning (planMoveInternal) would have to be done twice:

The TraCI influence (setSpeedMode + setSpeed) is relevant during planning in the following ways

chambonp commented 2 years ago

Is it possible that this gets fixed before the 1.15 release in October? and conversely, could it take even longer than October 2022?

namdre commented 2 years ago

@PaulChambonUSA. It could indeed take longer than 1.15. However, it is possible that this bug isn't the one causing trouble for your use case discussed in #8661. It really depends on whether your cars are violating red lights are purposefully ignoring foe vehicles on an intersection.

chambonp commented 1 year ago

was a fix for getSpeedWithoutTraCI implemented in release 1.15?

namdre commented 1 year ago

@PaulChambonUSA Unfortunately, no (And due to the complexity outlined above I'm yet targeting this issue for a specific milestone. I think the solution for #8661 is to be found with #11091 which I've re-targeted for the next release.

kvarys commented 7 months ago

Hi,

Has this issue been resolved? My loop looks something like this:

1.  while True:
2.    traci.simulationStep()
3.    traci.vehicle.slowDown(vehID=some_id, speed=some_speed, duration=some_dur)
4.    oracle_speed = traci.vehicle.getSpeedWithoutTraCI(some_id)

The problem is that oracle_speed is equal to some_speed I set on line 3.

I was hoping the method traci.vehicle.getSpeedWithoutTraCI would be able to tell me what the simulator would have done were it not for my interference through traci. But this does not seem to be the case.

Is there another way I could get the "correct speed" the simulator would have chosen? Basically I am trying to measure how off my model is when it selects some_speed. So I would like to compute something like this: my_model_error = oracle_speed - some_speed. Is this possible?

Eclipse SUMO sumo Version 1.19.0

Thank you

namdre commented 7 months ago

It should be:

  1. while True:
  2. traci.simulationStep()
  3. traci.vehicle.slowDown(vehID=some_id, speed=some_speed, duration=some_dur)
  4. traci.executeMove()
  5. oracle_speed = traci.vehicle.getSpeedWithoutTraCI(some_id)