-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
58 lines (49 loc) · 1.91 KB
/
config.py
File metadata and controls
58 lines (49 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import math
import numpy as np
"""Configuration constants for SLAM simulation"""
# World settings
WORLD_WIDTH = 2500 # Optimized for 27" 2K display (2560x1440)
WORLD_HEIGHT = 1380
MAP_RESOLUTION = 0.05 # meters per pixel
FPS = 60
ROBOT_RADIUS = 0.18
MAX_VELOCITY = 400.0
MAX_ANGULAR_VELOCITY = 2.0*math.pi
# Lidar settings (long-range 2D laser scanner)
LIDAR_BEAMS = 420 # Increased from 360 for denser point cloud (1 degree resolution)
LIDAR_RANGE = 200.0
LIDAR_FOV = 2 * math.pi
# Reduced noise for cleaner point clouds - distance noise in pixels, angle noise in radians
LIDAR_NOISE_SIGMA = np.array([0.9, 0.001]) # Reduced from [1.0, 0.05] for less scattered points
LIDAR_ENABLE_NOISE = True # Set to False to disable noise completely for testing
LIDAR_SCAN_RATE = 10
# Odometry noise (realistic wheel encoder noise)
ODOM_NOISE_TRANSLATION = 0.05
ODOM_NOISE_ROTATION = 0.03
# SLAM settings (EKF-SLAM parameters)
LANDMARK_DETECTION_THRESHOLD = 1.0
DATA_ASSOCIATION_THRESHOLD = 20.0 # Similarity score threshold for line segment matching (lower = stricter)
# Based on weighted combination of midpoint distance, line distance, and length
MAX_LANDMARK_DISTANCE = 150.0
# Line extraction parameters (seeded region growing algorithm)
LINE_EXTRACTION_EPSILON = 2.0
LINE_EXTRACTION_DELTA = 2.0
LINE_EXTRACTION_S_NUM = 5
LINE_EXTRACTION_P_MIN = 6
LINE_EXTRACTION_L_MIN = 40.0
LINE_EXTRACTION_G_MAX = 8.0
LINE_EXTRACTION_ANGLE_GAP_MAX = 0.08
LINE_EXTRACTION_DISTANCE_JUMP_RATIO = 1.3
# Visualization
BACKGROUND_COLOR = (255, 255, 255)
OBSTACLE_COLOR = (0, 0, 0)
ROBOT_COLOR = (0, 0, 255)
ESTIMATED_ROBOT_COLOR = (255, 0, 0)
LANDMARK_COLOR = (0, 255, 0)
ESTIMATED_LANDMARK_COLOR = (255, 165, 0)
LINE_LANDMARK_COLOR = (0, 255, 255)
ROBOT_PATH_COLOR = (255, 0, 255)
PATH_SAMPLE_DISTANCE = 5.0
# Control sensitivity
KEYBOARD_VELOCITY_SCALE = 1.0
KEYBOARD_ANGULAR_SCALE = 1.0 # Cyan for line segment landmarks