Farama-Foundation / HighwayEnv

A minimalist environment for decision-making in autonomous driving
https://highway-env.farama.org/
MIT License
2.59k stars 739 forks source link

Why my range of controlling the speed of my own vehicle didn't work #575

Open AHPUymhd opened 6 months ago

AHPUymhd commented 6 months ago

My configuration is as follows: image But with a minimum speed of 20 and a maximum of 29.999, it is clear that this speed range is not -10 to 10 that I set image I am very looking forward to hearing from you

AHPUymhd commented 6 months ago

@eleurent Thank you very much

eleurent commented 6 months ago

Hi, This is because this config["observation"]["features_range"]["vx"/"vy"] does not control the range of speeds that can be reached by the vehicle, but only how the observed speed values get normalised into the [-1, 1] range. (i.e. an observed speed of 1 means 10m/s with this config).

To change the range of speeds actually tracked by the vehicles, you must change the action config instead of the observation: Something like

env.configure({
                "action": {
                    "type": "DiscreteMetaAction",
                    "longitudinal": True,
                    "lateral": True,
                    "target_speeds": [-10, 0, 10],
                },
})
AHPUymhd commented 6 months ago

Hi, This is because this config["observation"]["features_range"]["vx"/"vy"] does not control the range of speeds that can be reached by the vehicle, but only how the observed speed values get normalised into the [-1, 1] range. (i.e. an observed speed of 1 means 10m/s with this config).

To change the range of speeds actually tracked by the vehicles, you must change the action config instead of the observation: Something like

env.configure({
                "action": {
                    "type": "DiscreteMetaAction",
                    "longitudinal": True,
                    "lateral": True,
                    "target_speeds": [-10, 0, 10],
                },
})

Thank you very much for answering your questions!!!!!this solved my doubts.