55from shapely .geometry import Polygon
66from typing import List , Tuple
77import math
8+ import yaml
9+
810
911Pose = Tuple [float , float , float ] # (x, y, yaw)
1012Dims = Tuple [float , float ] # (width, length)
1113Obstacle = Tuple [float , float , float , Dims ] # (x, y, yaw, (width, length))
1214
1315class ReedsSheppParking :
14- def __init__ (self , vehicle_pose = ( 0.0 , 0.0 , 0.0 ), vehicle_dims = (1.7 , 3.2 ), compact_parking_spot_size = ( 2.44 , 4.88 ) ,
16+ def __init__ (self , vehicle_pose = None , vehicle_dims = (1.7 , 3.2 ), compact_parking_spot_size = None ,
1517 shift_from_center_to_rear_axis = 1.25 , search_step_size = 0.1 , closest = False , parking_lot_axis_shift_margin = 2.44 ,
1618 search_bound_threshold = 0.5 ,
1719 vehicle_turning_radius = 3.657 ,
@@ -29,36 +31,39 @@ def __init__(self, vehicle_pose = (0.0, 0.0, 0.0), vehicle_dims = (1.7, 3.2), co
2931 self .detected_cones = detected_cones
3032 self .parked_cars = []
3133 self .objects_to_avoid_collisions = []
34+
35+ yaml_path = "GEMstack/knowledge/defaults/ReedsShepp_param.yaml"
36+ with open (yaml_path ,'r' ) as file :
37+ params = yaml .safe_load (file )
38+
39+
3240
33- self .static_horizontal_curb_xy_coordinates = static_horizontal_curb_xy_coordinates
34- self .static_horizontal_curb_size = static_horizontal_curb_size
35- self .add_static_vertical_curb_as_obstacle = add_static_vertical_curb_as_obstacle
41+ self .static_horizontal_curb_xy_coordinates = None
42+ self .static_horizontal_curb_size = params [ 'reeds_shepp_parking' ][ ' static_horizontal_curb_size' ]
43+ self .add_static_vertical_curb_as_obstacle = params [ 'reeds_shepp_parking' ][ ' add_static_vertical_curb_as_obstacle' ]
3644
37- self .static_vertical_curb_size = static_vertical_curb_size
38- self .static_vertical_curb_xy_coordinates = static_vertical_curb_xy_coordinates
39- self .add_static_horizontal_curb_as_obstacle = add_static_horizontal_curb_as_obstacle
45+ self .static_vertical_curb_size = params [ 'reeds_shepp_parking' ][ ' static_vertical_curb_size' ]
46+ self .static_vertical_curb_xy_coordinates = []
47+ self .add_static_horizontal_curb_as_obstacle = params [ 'reeds_shepp_parking' ][ ' add_static_horizontal_curb_as_obstacle' ]
4048
41- self .all_parking_spots_in_parking_lot_var = all_parking_spots_in_parking_lot
49+ self .all_parking_spots_in_parking_lot_var = []
4250
43- self .vehicle_pose = vehicle_pose
51+ self .vehicle_pose = [ 0 , 0 , 0 ] # default
4452 self .x_axis_of_search = self .vehicle_pose [0 ]
4553
4654
47- self .vehicle_dims = vehicle_dims
48- self .compact_parking_spot_size = compact_parking_spot_size # US Compact Space for parking (2.44, 4.88)
49- self .shift_from_center_to_rear_axis = shift_from_center_to_rear_axis # TODO: Check
50- self .search_step_size = search_step_size
51- self .parking_lot_axis_shift_margin = parking_lot_axis_shift_margin
52- self .search_bound_threshold = search_bound_threshold
55+ self .vehicle_dims = params ['vehicle' ]['vehicle_dim' ]
56+ self .vehicle_turning_radius = params ['vehicle' ]['vehicle_turning_radius' ]
57+ self .compact_parking_spot_size = params ['reeds_shepp_parking' ]['compact_parking_spot_size' ]
58+ self .shift_from_center_to_rear_axis = params ['reeds_shepp_parking' ]['shift_from_center_to_rear_axis' ] # TODO: Check
59+ self .search_step_size = params ['reeds_shepp_parking' ]['search_step_size' ]
60+ self .parking_lot_axis_shift_margin = params ['reeds_shepp_parking' ]['parking_lot_axis_shift_margin' ]
61+ self .search_bound_threshold = params ['reeds_shepp_parking' ]['search_bound_threshold' ]
5362 # TODO: Add thrid option: park in the middle
54- self .closest = closest # If True, the closest parking spot will be selected, otherwise the farthest one will be selected
55- self .vehicle_turning_radius = vehicle_turning_radius
56- self .clearance_step = clearance_step
63+ self .closest = params ['reeds_shepp_parking' ]['closest' ] # If True, the closest parking spot will be selected, otherwise the farthest one will be selected
64+ self .clearance_step = params ['reeds_shepp_parking' ]['clearance_step' ]
5765 self .search_axis_direction_var = False
5866
59-
60-
61-
6267
6368
6469 def reeds_shepp_path (self ,start_pose , final_pose , step_size = 0.1 , vehicle_turning_radius = 3.657 ):# Runing
0 commit comments