Merging Environment

Merging Environment

Environment

MergingEnvironment

A road network with a main lane and a merging lane. The geometry can be modified by passing the parameters as keyword arguments in the constructor

Parameters

  • lane_width::Float64 = 3.0
  • main_lane_vmax::Float64 = 15.0
  • merge_lane_vmax::Float64 = 10.0
  • main_lane_length::Float64 = 100.0
  • main_lane_angle::Float64 = float(pi)/4
  • merge_lane_angle::Float64 = float(pi)/4
  • merge_lane_length::Float64 = 50.0
  • after_merge_length::Float64 = 50.0

Internals

  • roadway::Roadway{Float64} contains all the road segment and lane information
  • merge_point::VecSE2{Float64} coordinate of the merge point in cartesian frame (0.0, 0.0, 0.0) by default
  • merge_proj::RoadProjection{Int64, Float64} projection of the merge point on the roadway
  • merge_index::RoadIndex
source
generate_merging_roadway(lane_width::Float64 = 3.0, main_lane_vmax::Float64 = 20.0, merge_lane_vmax::Float64 = 15.0, main_lane_length::Float64 = 20.0, merge_lane_length::Float64 = 20.0, after_merge_length::Float64 = 20.0, main_lane_angle::Float64 = float(pi)/4, merge_lane_angle::Float64 = float(pi)/4)

Generate a Roadway object representing a merging scenario. The merge point is defined at (0., 0.) by default.

source
main_lane(env::MergingEnvironment)

returns the main lane of the merging scenario

source
merge_lane(env::MergingEnvironment)

returns the merging lane of the merging scenario

source

Features and Helper functions

get_front_neighbor(env::MergingEnvironment, scene::Scene, egoid::Int64)

returns the front neighbor of egoid in its lane. It returns an object of type NeighborLongitudinalResult

source
get_neighbors(env::MergingEnvironment, scene::Scene, egoid::Int64)

returns the following neighbors id and relative distance (if they exist) - the front neighbor of vehicle egoid - the vehicle right behind the merge point (if egoid is on the main lane) - the front neighbor of the projection of egoid on the main lane - the rear neighbor of the projection of egoid on the merge lane

source
dist_to_merge(env::MergingEnvironment, veh::Vehicle)

returns the distance to the merge point.

source
time_to_merge(env::MergingEnvironment, veh::Vehicle, a::Float64 = 0.0)

return the time to reach the merge point using constant acceleration prediction. If the acceleration, a is not specified, it performs a constant velocity prediction.

source
find_merge_vehicle(env::MergingEnvironment, scene::Scene)

returns the id of the merging vehicle if there is a vehicle on the merge lane.

source
constant_acceleration_prediction(env::MergingEnvironment, veh::Vehicle, acc::Float64, time::Float64, v_des::Float64)

returns the state of vehicle veh after time time using a constant acceleration prediction.

inputs

  • env::MergingEnvironment the environment
  • veh::Vehicle the initial state of the vehicle
  • acc::Float64 the current acceleration of the vehicle
  • time::Float64 the prediction horizon
  • v_des::Float64 the desired speed of the vehicle (assumes that the vehicle will not exceed that speed)
source
distance_projection(env::MergingEnvironment, veh::Vehicle)

Performs a projection of veh onto the main lane. It returns the longitudinal position of the projection of veh on the main lane. The projection is computing by conserving the distance to the merge point.

source
collision_time(env::MergingEnvironment, veh::Vehicle, mergeveh::Vehicle, acc_merge::Float64, acc_min::Float64)

compute the collision time between two vehicles assuming constant acceleration.

source
braking_distance(v::Float64, t_coll::Float64, acc::Float64)

computes the distance to reach a velocity of 0. at constant acceleration acc in time t_coll with initial velocity v

source