src.Roadway package

Submodules

src.Roadway.roadway module

class src.Roadway.roadway.Lane(tag: src.Roadway.roadway.LaneTag, curve: list, width: float = 3.0, speed_limit: src.Roadway.roadway.SpeedLimit = <src.Roadway.roadway.SpeedLimit object>, boundary_left: src.Roadway.roadway.LaneBoundary = <src.Roadway.roadway.LaneBoundary object>, boundary_right: src.Roadway.roadway.LaneBoundary = <src.Roadway.roadway.LaneBoundary object>, exits: list = [], entrances: list = [], next: src.Roadway.roadway.RoadIndex = <src.Roadway.roadway.RoadIndex object>, prev: src.Roadway.roadway.RoadIndex = <src.Roadway.roadway.RoadIndex object>)[source]

Bases: object

Lane class

get_by_ind_roadway(ind: src.curves.CurvePt.CurveIndex, roadway)[source]

get CurvePt by Curve Index and roadway :param ind: Curve Index :param roadway: Roadway object :return: the corresponding CurvePt object

class src.Roadway.roadway.LaneBoundary(style: str, color: str)[source]

Bases: object

class src.Roadway.roadway.LaneConnection(downstream: bool, mylane: src.curves.CurvePt.CurveIndex, target: src.Roadway.roadway.RoadIndex)[source]

Bases: object

LaneConnection{I <: Integer, T <: Real}

Data structure to specify the connection of a lane. It connects mylane to the point target. target would typically be the starting point of a new lane. - downstream::Bool - mylane::CurveIndex{I,T} - target::RoadIndex{I,T}

write(fp)[source]
class src.Roadway.roadway.LaneTag(segment: int, lane: int)[source]

Bases: object

class src.Roadway.roadway.RoadIndex(ind: src.curves.CurvePt.CurveIndex, tag: src.Roadway.roadway.LaneTag)[source]

Bases: object

RoadIndex{I <: Integer, T <: Real}

A data structure to index points in a roadway. Calling roadway[roadind] will return the point associated to the road index. # Fields - ind::CurveIndex{I,T} the index of the point in the curve - tag::LaneTag the lane tag of the point

write(fp)[source]
class src.Roadway.roadway.RoadProjection(curveproj: src.curves.CurvePt.CurveProjection, tag: src.Roadway.roadway.LaneTag)[source]

Bases: object

class src.Roadway.roadway.RoadSegment(id: int, lanes: list = [])[source]

Bases: object

class src.Roadway.roadway.Roadway(segments: list = [])[source]

Bases: object

get_by_id(segid: int)[source]

get seg by a query seg id :param segid: query seg id :return: the seg correspond to the query seg id

get_by_roadindex(roadindex: src.Roadway.roadway.RoadIndex)[source]

get lane by a query road index :param roadindex: query road index :return: the lane correspond to the query road index

get_by_tag(tag: src.Roadway.roadway.LaneTag)[source]

get lane by a query lane tag :param tag: query LaneTag :return: the lane correspond to the query lane tag

has_segment(segid: int)[source]

check if the roadway object has a seg given the seg id :param segid: seg id :return: true if there is, false otherwise

write(filepath: str)[source]

write the roadway information to the file given the filepath :param filepath: the file to write, string :return: no return

class src.Roadway.roadway.SpeedLimit(lo: float, hi: float)[source]

Bases: object

src.Roadway.roadway.connect(source: src.Roadway.roadway.Lane, dest: src.Roadway.roadway.Lane)[source]
src.Roadway.roadway.get_closest_perpendicular_point_between_points(A: src.Vec.VecSE2.VecSE2, B: src.Vec.VecSE2.VecSE2, Q: src.Vec.VecSE2.VecSE2, tolerance: float = 0.01, max_iter: int = 50)[source]

get closest perpendicular point between given points CONDITIONS: a < b, either f(a) < 0 and f(b) > 0 or f(a) > 0 and f(b) < 0 :param A: start point :param B: end point :param Q: query point :param tolerance: acceptable error in perpendicular component :param max_iter: maximum number of iterations :return: value which differs from a root of f(x)=0 by less than TOL

src.Roadway.roadway.has_next(lane: src.Roadway.roadway.Lane)[source]

check if the given lane has next lane :param lane: the given lane :return: true if there is, false otherwise

src.Roadway.roadway.has_prev(lane: src.Roadway.roadway.Lane)[source]

check if the given lane has previous lane :param lane: the given lane :return: true if there is, false otherwise

src.Roadway.roadway.is_between_segments_hi(ind: src.curves.CurvePt.CurveIndex, curve: list)[source]

check if the given CurveIndex is the last :param ind: CurveIndex :return: true if is the last, false otherwise

src.Roadway.roadway.is_between_segments_lo(ind: src.curves.CurvePt.CurveIndex)[source]

check if the given CurveIndex is the first :param ind: CurveIndex :return: true if is the first, false otherwise

src.Roadway.roadway.is_in_entrances(lane: src.Roadway.roadway.Lane, target: src.Roadway.roadway.LaneTag)[source]

check if the given LaneTag object is in entrances list :param lane: Lane object :param target: LaneTag object :return: true if in entrances list, false otherwise

src.Roadway.roadway.is_in_exits(lane: src.Roadway.roadway.Lane, target: src.Roadway.roadway.LaneTag)[source]

check if the given LaneTag object is in exits list :param lane: Lane object :param target: LaneTag object :return: true if in exits list, false otherwise

src.Roadway.roadway.n_lanes_left(lane: src.Roadway.roadway.Lane, roadway: src.Roadway.roadway.Roadway)[source]
Parameters
  • lane – Lane object

  • roadway – Roadway object

Returns

how many lane on the right of the given lane

src.Roadway.roadway.n_lanes_right(lane: src.Roadway.roadway.Lane, roadway: src.Roadway.roadway.Roadway)[source]
Parameters
  • lane – Lane object

  • roadway – Roadway object

Returns

how many lane on the left of the given lane

src.Roadway.roadway.next_lane(lane: src.Roadway.roadway.Lane, roadway: src.Roadway.roadway.Roadway)[source]

get next lane :param lane: Lane object :param roadway: Roadway object :return: the lane after the given lane

src.Roadway.roadway.next_lane_point(lane: src.Roadway.roadway.Lane, roadway: src.Roadway.roadway.Roadway)[source]

get next lane point :param lane: Lane object :param roadway: Roadway object :return: the lane point after the given lane

src.Roadway.roadway.parse_lane_connection(line: str)[source]
src.Roadway.roadway.prev_lane(lane: src.Roadway.roadway.Lane, roadway: src.Roadway.roadway.Roadway)[source]

get previous lane :param lane: Lane object :param roadway: Roadway object :return: the lane before the given lane

src.Roadway.roadway.prev_lane_point(lane: src.Roadway.roadway.Lane, roadway: src.Roadway.roadway.Roadway)[source]

get previous lane point :param lane: Lane object :param roadway: Roadway object :return: the lane point before the given lane

src.Roadway.roadway.proj_1(posG: src.Vec.VecSE2.VecSE2, lane: src.Roadway.roadway.Lane, roadway: src.Roadway.roadway.Roadway, move_along_curves: bool = True)[source]

proj(posG::VecSE2, lane::Lane, roadway::Roadway; move_along_curves::Bool=true) Return the RoadProjection for projecting posG onto the lane. This will automatically project to the next or prev curve as appropriate. if move_along_curves is false, will only project to lane.curve

src.Roadway.roadway.proj_2(posG: src.Vec.VecSE2.VecSE2, roadway: src.Roadway.roadway.Roadway)[source]

proj(posG::VecSE2, seg::RoadSegment, roadway::Roadway) Return the RoadProjection for projecting posG onto the roadway. Tries all of the lanes and gets the closest one

src.Roadway.roadway.read_roadway(fp)[source]

parse roadway file and read it to a file given the file pointer :param fp: the file pointer :return: no return

src.Roadway.roadway.sign(a)[source]

check the sign of a given real number :param a: the given real number :return: 1 if >0, -1 if <0, 0 if ==0

src.Roadway.utils module

src.Roadway.utils.mod2pi2(x: float)[source]
Parameters

x – angle x

Returns

x mod 2*pi

Module contents