Aerothon ROS Report
Simulation Specifications:
OS: Ubuntu Jammy Jellyfish (22.04)
ROS2 distro: Humble
Simulation software: Gazebo-Classic
Model: Iris_vision.sdf
World: custom_world.world
Control Mode: OFFBOARD
Bridge: MAVROS (MAVLINK Integration)
ROS Nodes:
1. PX4_sitl node: Launches the PX4 simulation with Gazebo.
2. YOLO Node: Applies YOLOv10n on drone’s camera feed to detect objects and publish their
centers.
3. MAVLINK controller: Interfaces MAVROS with PX4, arms drone, and sends target commands
via /target_point.
4. Path Planner node: Converts 2D bounding box coordinates into 3D world coordinates and sends
movement commands.
Mapping YOLO coordinates to Real-World Coordinates
Mapping YOLO coordinates to Real-World Coordinates
The path_planner.py node handles the transformation of 2D YOLO bounding box data into
actionable 3D world coordinates. Here’s the process in detail:
1. Input
Bounding box center coordinates (x_center, y_center) received on /bbox_center.
Camera intrinsics:
Focal length along X and Y axes: fx and fy
Coordinates of center of video frame: cx and cy
2. Camera Intrinsics Normalization
The pinhole camera model is used to normalize 2D points:
This produces a 3D ray direction in the camera frame (ray_cam = [x_norm, y_norm, 1.0]).
3. Obtaining “camera_link” transform frame
The camera_link transform relative to base_link is obtained via a static transform published by the
static_transform_publisher node in my launch file. This defines the camera's fixed
position/orientation on the drone:
The “camera_link” is defined 0.1m below the
base_link of the drone.
4. TF2 Transform lookup
The latest transform from “camera_link” to “map” is retrieved using this:
5. Rotation Matrix from Quaternion (Math Foundation)
The rotation matrix R is calculated from a quaternion q = (x, y, z, w) using the following formula:
Quaternion Normalization Ensures proper rotation representation.
6. Ray Transformation to World frame
The camera ray direction is rotated into the world frame:
7. Averaging Nearby points
To handle repeated detections in the same region: As the drone moves, the YOLO model may detect
the same object multiple times from slightly different angles or positions.
• Each new detection is compared with previously recorded points using Euclidean distance.
• If the new point is within a minimum distance threshold (min_dist_threshold), it is
considered to be part of the same target.
• Instead of storing each close detection separately, the system treats it as a duplicate of an
already known point.
• The coordinates of nearby points are averaged using a moving average.
• Maintains historical points for path planning
Final Simulation