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 informationmerge_point::VecSE2{Float64}
coordinate of the merge point in cartesian frame (0.0, 0.0, 0.0) by defaultmerge_proj::RoadProjection{Int64, Float64}
projection of the merge point on the roadwaymerge_index::RoadIndex
AutonomousMerging.generate_merging_roadway
— Function.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.
AutonomousMerging.main_lane
— Function.main_lane(env::MergingEnvironment)
returns the main lane of the merging scenario
AutonomousMerging.merge_lane
— Function.merge_lane(env::MergingEnvironment)
returns the merging lane of the merging scenario
Features and Helper functions
AutonomousMerging.get_front_neighbor
— Function.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
AutonomousMerging.get_neighbors
— Function.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
AutonomousMerging.dist_to_merge
— Function.dist_to_merge(env::MergingEnvironment, veh::Vehicle)
returns the distance to the merge point.
AutonomousMerging.time_to_merge
— Function.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.
AutonomousMerging.find_merge_vehicle
— Function.find_merge_vehicle(env::MergingEnvironment, scene::Scene)
returns the id of the merging vehicle if there is a vehicle on the merge lane.
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 environmentveh::Vehicle
the initial state of the vehicleacc::Float64
the current acceleration of the vehicletime::Float64
the prediction horizonv_des::Float64
the desired speed of the vehicle (assumes that the vehicle will not exceed that speed)
AutonomousMerging.distance_projection
— Function.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.
AutonomousMerging.collision_time
— Function.collision_time(env::MergingEnvironment, veh::Vehicle, mergeveh::Vehicle, acc_merge::Float64, acc_min::Float64)
compute the collision time between two vehicles assuming constant acceleration.
AutonomousMerging.braking_distance
— Function.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