HighwayEnv icon indicating copy to clipboard operation
HighwayEnv copied to clipboard

Change the observation space

Open piccupl opened this issue 2 years ago • 2 comments

Hi @eleurent,

In merge-v0, I would like to add a state to distinguish between a main road and an on-ramp,How Do I change the source code? Looking forward to your reply. Thanks!

piccupl avatar May 25 '22 17:05 piccupl

In addition, how to obtain the ID of the road where the vehicle is located

piccupl avatar May 26 '22 03:05 piccupl

To add a new observation type, you should edit the envs/common/observation.py file.

You can add a new Type, and in its observe() method you can access the current vehicle lane with self.observer_vehicle.lane_index, which will be a tuple (lane_start_node_id, lane_end_node_id, lane_number). To use them as numeric observations, it is probably best to rename the node ids in the scene as integers, so you have a tuple of integers. And then, you can optionally convert them to one-hot encodings if needed for the representation.

eleurent avatar May 29 '22 14:05 eleurent