simulation.utils.road package

Subpackages

Submodules

simulation.utils.road.config module

Classes:

Config()

class Config[source]

Bases: object

Attributes:

road_width

TURN_SF_MARK_WIDTH

TURN_SF_MARK_LENGTH

ROAD_MARKING_DISTANCE

PRIORITY_SIGN_DISTANCE_INTERVALL

TURN_SIGN_DISTANCE_INTERVALL

SURFACE_MARKING_DISTANCE_INTERVALL

SIGN_ROAD_PADDING_INTERVALL

Methods:

get_prio_sign_dist([rand])

get_turn_sign_dist([rand])

get_surface_mark_dist([rand])

get_sign_road_padding([rand])

road_width = 0.4
TURN_SF_MARK_WIDTH = 0.072
TURN_SF_MARK_LENGTH = 0.5
ROAD_MARKING_DISTANCE = 0.2
PRIORITY_SIGN_DISTANCE_INTERVALL = (0.3, 0.5)
TURN_SIGN_DISTANCE_INTERVALL = (0.15, 0.25)
SURFACE_MARKING_DISTANCE_INTERVALL = (0.05, 0.25)
SIGN_ROAD_PADDING_INTERVALL = (0.075, 0.125)
static get_prio_sign_dist(rand=0.5)[source]
static get_turn_sign_dist(rand=0.5)[source]
static get_surface_mark_dist(rand=0.5)[source]
static get_sign_road_padding(rand=0.5)[source]

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.

Classes:

Road(use_seed, sections, length, start_box)

Container object for roads.

Functions:

_get_module(name)

load(road_name[, seed])

Load road object from file.

class Road(use_seed: bool = True, sections: ~typing.List[~simulation.utils.road.sections.road_section.RoadSection] = <factory>, length: float = 0, start_box: bool = False)[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.

Attributes:

_name

Name of the road.

_seed

Seed used when generating the road.

use_seed

Use a default seed if none is provided.

sections

All sections of the road.

length

Length of road.

start_box

Start road with Start Box.

Methods:

append(section)

Append a road section.

close_to_section(target_pose[, p_curvature])

Append a road section that connects the last section to the given target section.

close_loop([p_curvature])

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

close_intersection(intersection, ending[, ...])

Append a road section that connects the last section of the road to the given ending of a intersection.

setup_dynamic_obstacles()

finalize()

get_start_box()

_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[RoadSection]

All sections of the road.

length: float = 0

Length of road.

start_box: bool = False

Start road with Start Box.

append(section: RoadSection)[source]

Append a road section. Determine id of the section.

Parameters:

section – New road section.

close_to_section(target_pose: Pose, p_curvature: float = 2)[source]

Append a road section that connects the last section to the given target section.

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.

close_loop(p_curvature: float = 2)[source]

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

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

Parameters:

p_curvature – Scale the curvature of the resulting loop.

close_intersection(intersection: Intersection, ending: int, turn_direction: int = 0, p_curvature: float = 2)[source]

Append a road section that connects the last section of the road to the given ending of a intersection.

The road’s end and the intersection are connected using a cubic bezier curve.

Parameters:
  • intersection – The intersection object to which the bezier curve connects.

  • ending – The side of the (initial) intersection the bezier curve connects to.

  • turn_direction – Direction in which the car should turn when crossing the intersection a second time.

  • p_curvature – Scale the curvature of the resulting loop.

setup_dynamic_obstacles()[source]
finalize()[source]
get_start_box()[source]
_get_module(name: str)[source]
load(road_name: str, seed: str = 'KITCAR') Road[source]

Load road object from file.

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

  • seed – Predetermine random values.

Module contents

Definition of the road module package.

The road module package contains a number of modules and subpackages that are used to create and render roads as Gazebo worlds.