@@ -64,23 +64,28 @@ def __init__(
6464 self .__logger = local_logger
6565
6666 def run (
67- self , input : merged_odometry_detections .MergedOdometryDetections
68- ) -> "tuple[bool, tuple[float, float, float]]" :
67+ self , odometry_detections : merged_odometry_detections .MergedOdometryDetections
68+ ) -> "tuple[bool, list[ tuple[float, float, float] ]]" :
6969 """
7070 Calculates the x and y angles in radians of the bounding box based on its center.
7171
72- input : A merged odometry dectections object.
72+ odometry_detections : A merged odometry dectections object.
7373
74- Return: Tuple of the x and y angles in radians respectively and the target distance in meters.
74+ Return: A list of tuples containing the x and y angles in radians
75+ respectively, and the target distance in meters.
76+
77+ ex. [(angle_x_1, angle_y_1, target_dist_1), (angle_x_2, angle_y_2, target_dist_2)]
7578 """
7679
77- for bounding_box in input .detections :
80+ landing_commands = []
81+
82+ for bounding_box in odometry_detections .detections :
7883 x_center , y_center = bounding_box .get_centre ()
7984
8085 angle_x = (x_center - self .im_w / 2 ) * (self .fov_x * (math .pi / 180 )) / self .im_w
8186 angle_y = (y_center - self .im_h / 2 ) * (self .fov_y * (math .pi / 180 )) / self .im_h
8287
83- height_agl = input .odometry_local .position .down * - 1
88+ height_agl = odometry_detections .odometry_local .position .down * - 1
8489
8590 x_dist = math .tan (angle_x ) * height_agl
8691 y_dist = math .tan (angle_y ) * height_agl
@@ -93,5 +98,6 @@ def run(
9398 )
9499
95100 time .sleep (self .period )
101+ landing_commands .append ((angle_x , angle_y , target_to_vehicle_dist ))
96102
97- return True , ( angle_x , angle_y , target_to_vehicle_dist )
103+ return True , landing_commands
0 commit comments