HighwayEnv
HighwayEnv copied to clipboard
Change the observation space
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!
In addition, how to obtain the ID of the road where the vehicle is located
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.