Skip to content

Configuration

Lars Knol edited this page Jun 14, 2024 · 2 revisions

The application's configuration is stored in YAML files within the config directory. These files provide a flexible way to manage environment-specific settings and defaults.

File Structure

  • config/config.default.yaml This file contains the default configuration values used by all environments.
  • config/config.{ENVIRONMENT}.yaml This file can override the defaults for a specific environment, determined by the ENVIRONMENT environment variable. If not set, development is assumed.

Loading and Merging

The config.defaults.yaml file is loaded first. If the ENVIRONMENT environment variable is set, the corresponding config/{ENVIRONMENT}.yaml file is loaded. Values from this file override any identically named values from config.defaults.yaml.

Accessing Configuration

The loaded configuration is accessible through the config object within your program. This object behaves like a dictionary, allowing you to retrieve specific configuration values using key lookups.

from config import config

database_url = config.database_url

if config.debug_mode:
    print("Debug mode is enabled")

Configuration Values

The configuration file is divided into several domains. These domains and their values are described below.

Kart

Key Default Description
lidar_offset 0.26 The lidar offset in meters from the front of the kart.
max_steering_angle 20 The maximum steering angle of the kart in degrees.

Dimensions

Key Default Description
length 1.9 The length of the kart in meters.
width 1.325 The width of the kart in meters.

Speed Modes

Key Default Description
selected 10 The selected speed mode.
options The options for speed modes.
options.slow 10 Speed of slow mode.
options.normal 20 Speed of normal mode.
options.fast 30 Speed of fast mode.
options.very_fast 40 Speed of very fast mode.

Braking

Key Default Description
margin 1.0 How much faster we may go than the target speed before braking.
max_force 50 Maximum braking force, used to completely stop the kart.
min_force 30 Minimum braking force, used to slow down the kart.

Lane Assist

Preprocessing

Key Default Description
gamma
gamma.enabled true Whether to enable gamma correction.
gamma.left 0.62 The gamma value for the left camera.
gamma.center 1.0 The gamma value for the center camera.
gamma.right 0.62 The gamma value for the right camera.
white_threshold 180 Threshold for white parts of the image.
filter_threshold 170 Threshold for image filtering.

Line Detection

Key Default Description
max_angle_difference 30 The maximum angle difference between the last detected point and the current point.
max_angle_junction 60 The maximum angle for a junction.
Window
Key Default Description
height 0.5 The height of the window in meters.
min_width 1.0 The minimum width of the window in meters.
max_width 2.0 The maximum width of the window in meters.
min_pixels 3 The minimum number of pixels in the window.
min_shift 0.3 The minimum shift of the window in percentage.
margin_growth 0.3 The margin growth of the window in percentage.
Thresholds
Key Default Description
zebra_crossing 0.6 The threshold for filtering zebra crossings in meters.
Filtering
Key Default Description
active true Whether to enable filtering.
rel_height 0.95 Relative height of the peaks to filter.
min_distance 1.0 Minimum distance for filtering in meters.
margin 0.2 Margin for filtering in meters.

Line Following

Key Default Description
requested_lane Requested lane configuration.
requested_lane.override false Whether to override requested lane.
requested_lane.lane 0 The lane to drive on.
initial_speed 5 Initial speed of the kart in km/h.
no_lane_offset 1.5 Offset when no lane is detected in meters.
max_steering_range 20 Maximum steering range in degrees.
look_ahead_distance 0.5 Look ahead distance in meters.
PID
Key Default Description
kp 20.0 Proportional gain.
ki 1.0 Integral gain.
kd 0.5 Derivative gain.

Dynamic Speed

Key Default Description
friction_coefficient 0.3 Friction coefficient of the kart.
static true Whether to enable static speed.
static_speed 4 Static speed of the kart in km/h.

Camera IDs

Key Default Description
left 0 ID of the left camera.
center 0 ID of the center camera.
right 0 ID of the right camera.

Camera Calibration

Key Default Description
aruco_dict 1 The ArUco dictionary used for calibration.
board_height 8 The amount of squares in the calibration board (vertical).
board_width 10 The amount of squares in the calibration board (horizontal).
calibration_file "./data/calibration/latest.npz" The file with the calibrated data to use.
max_image_height 250 Maximum image height for the bird's eye view.
max_image_width 250 Maximum image width for the bird's eye view.
marker_length 0.086 The real-world length of the markers.
render_distance The render distance of the bird's eye view.
render_distance.front 12.0 How much to render in front of the kart.
render_distance.side 6.0 How much to render on the sides of the kart.
save_dir "./data/calibration" Directory to save calibration data.
square_length 0.115 The real-world length of squares on the calibration board.
vanishing_line_offset 0.02 Offset of the vanishing line (percentage).

Object Detection

Key Default Description
model_path "./models/yolo8s.pt" Path to the YOLO model.
max_frame_rate 10.0 The maximum frame rate of object detection. This will make sure the other modules can run smoothly.
min_confidence 0.6 The minimum confidence of the model.
verbose false Whether to enable verbose mode.
image_size 1280 The size of the input images.

Speed Limit

Key Default Description
height_ratio 3.1 Height ratio of the sign.
min_distance 3 The minimum distance to the sign in meters.
class_to_speed Mapping of classes to speeds.

Traffic Light

Key Default Description
min_distance 2 The minimum distance to the stop line in meters.

Overtaking Manoeuvre

Key Default Description
consecutive_scans 3 Number of consecutive scans needed to switch lanes.
force_move Configuration for forced steering when overtaking.
force_move.enabled true Whether to enable forced steering.
force_move.angle -1.25 Angle of forced movement in percentage.
force_move.duration 1.5 Duration of forced steering in seconds.
force_move.straight_duration 1.0 Duration to move straight in seconds.
force_return Configuration for forced return after overtaking.
force_return.enabled true Whether to enable forced return.
force_return.angle 1.25 Angle of forced return in percentage.
force_return.duration 1.5 Duration of forced return in seconds.
force_return.straight_duration 1.0 Duration to move straight in seconds.
min_distance 7.0 Minimum distance for starting the overtaking manoeuvre in meters.
max_points 5 Maximum number of points allowed in the range before switching back to the original lane.
min_angle 270 Minimum angle to check if we have finished passing the vehicle.
max_angle 280 Maximum angle to check if we have finished passing the vehicle.
range_threshold 4 The maximum distance to check for the vehicle in meters.

Parking Manoeuvre

Key Default Description
available_space Configuration for the available space in the parking spot.
available_space.static true Whether to use static value for available space.
available_space.static_value 4.5 The static value for available space in meters.
max_speed 3.0 The maximum speed for parking in km/h.
min_barrier_distance 0.0 The minimum distance to the barrier in meters.
min_distance 2.0 The minimum distance for starting the parking manoeuvre in meters.
angle_tolerance 7 The tolerance for the 45-degree angle while steering into the parking spot.
straight_angle_margin 3 How many degrees we can be off the straight angle. Setting this too high can cause the kart to stop steering too early.
start_steering_offset -0.2 The offset to start steering into the parking spot in meters.

Crosswalk

Key Default Description
lost_frames 10 Number of frames required to consider a pedestrian lost.
min_distance 3 The minimum distance to crosswalks in meters.
overlap_margin 0.25 Margin for a pedestrian to overlap with the crosswalk.
safe_zone_margin 0.15 Margin for the pedestrian to be in the safe zone.

Telemetry

Key Default Description
enabled true Whether to enable telemetry.
server Server configuration for telemetry.
server.port 8000 The port of the telemetry server.
server.host 0.0.0.0 The host of the telemetry server.
server.root_url 192.168.1.89 The IP address of the server. This is used for the connection to the server from the frontend.

Gamepad

Key Default Description
max_trig_bits 10 The maximum trigger bits.
max_joy_bits 15 The maximum joystick bits.

Lidar

Key Default Description
port_name "/dev/ttyUSB0" The port name for the lidar.
min_distance 500 The minimum distance for lidar in millimeters.
max_distance_between_points 1000 The maximum distance between points in millimeters.