simulation.utils.road.road module

Road class used to define roads as a python class.

A simulated road can be defined through an object of type Road. It contains all sections of that road as a list.

Summary

Classes:

Road

Container object for roads.

Functions:

load

Load road object from file.

Reference

class Road(use_seed: bool = True, sections: List[simulation.utils.road.sections.road_section.RoadSection] = <factory>, length: float = 0)[source]

Bases: object

Container object for roads.

A road consists of multiple road sections that are concatenated. The sections attribute contains these sections in the correct order.

_name: str = None

Name of the road.

The name attribute is determined by the name of the file. It is filled in when the road is generated.

_seed: str = None

Seed used when generating the road.

Determined when generating the road.

use_seed: bool = True

Use a default seed if none is provided.

By default the use_seed attribute is true and a seed is set before creating the road. If use_seed is set to False, the seed is invalidated and there will be different random values every time the road is created.

sections: List[simulation.utils.road.sections.road_section.RoadSection]

All sections of the road.

length: float = 0

Length of road.

append(section: simulation.utils.road.sections.road_section.RoadSection)[source]

Append a road section. Determine id of the section.

Parameters

section – New road section.

close_loop(p_curvature: float = 2)[source]

Append a road section that connects the last section to the beginning.

The road’s beginning and it’s end are connected using a cubic bezier curve.

Parameters

p_curvature – Scale the curvature of the resulting loop.

_get_module(name: str)[source]
load(road_name: str, seed: str = 'KITCAR')simulation.utils.road.road.Road[source]

Load road object from file.

Parameters
  • road_name – Name of the file containing the road definition.

  • seed – Predetermine random values.