Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the "highway-v0" scene, how can I add obstacles at a specific location? #634

Open
1cai2 opened this issue Nov 21, 2024 · 1 comment
Open

Comments

@1cai2
Copy link

1cai2 commented Nov 21, 2024

1.In the "highway-v0" scene, I want to add an obstacle at the specified coordinates, and this obstacle can appear in the observation space of ego-vehicle and does not collide with surrounding vehicles. How to realize this function?
2.In the "highway-v0" scene,the distance range of surrounding vehicles observed by ego-vehicle?
3.How can I get an observation of the nearest car in front of ego-vehicle in the current lane?

@eleurent
Copy link
Collaborator

eleurent commented Dec 1, 2024

  1. You can add an Obstacles or a Landmark at a specific location.

https://github.com/Farama-Foundation/HighwayEnv/blob/master/highway_env/vehicle/objects.py#L214

They are both collidable, meaning they check for collisions, but only the Obstacle is solid (meaning a collision will result into a crash). So it looks like you need the Landmark.

  1. This depends on your observation type. For the kinematics observation, the max distance is a constant (it should be made configuable, really)
    PERCEPTION_DISTANCE = 5.0 * Vehicle.MAX_SPEED

For the LidarObservation, it is a config:

class LidarObservation(ObservationType):

3.How can I get an observation of the nearest car in front of ego-vehicle in the current lane?

There is no specific observation type for that, you'll have to implement it. You can get the nearest car in front of the ego-vehicle by calling front_vehicle, _ = env.road.neighbour_vehicles(env.vehicle), see

def neighbour_vehicles(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants