Docs and Controllers Update

This commit is contained in:
2026-01-02 07:53:44 +00:00
parent 72f85c37a5
commit 61c47f82fc
8 changed files with 289 additions and 208 deletions

View File

@@ -174,36 +174,25 @@ class DroneController(Node):
landing_pad = telemetry.get('landing_pad', None)
# Camera image is available in telemetry['camera']['image']
# Decode with: base64.b64decode(telemetry['camera']['image'])
# Descent control
if altitude > 1.0:
target_descent_rate = -0.5
else:
target_descent_rate = -0.2
# Default target
target_x = 0.0
target_y = 0.0
descent_error = target_descent_rate - vertical_vel
thrust = self._Kp_z * descent_error
# Use landing pad detection for positioning
# Horizontal control
if landing_pad is not None:
target_x = landing_pad.get('relative_x', 0.0)
target_y = landing_pad.get('relative_y', 0.0)
# TODO: Implement your GPS-denied landing algorithm
# You can use the camera image for custom vision processing
# Simple PD controller for altitude
target_altitude = 0.0
altitude_error = target_altitude - altitude
Kp_z, Kd_z = 0.5, 0.3
thrust = Kp_z * altitude_error - Kd_z * vertical_vel
# Horizontal control based on landing pad detection
Kp_xy, Kd_xy = 0.3, 0.2
if landing_pad is not None:
pitch = Kp_xy * target_x - Kd_xy * vel_x
roll = Kp_xy * target_y - Kd_xy * vel_y
pitch = self._Kp_xy * target_x - self._Kd_xy * vel_x
roll = self._Kp_xy * target_y - self._Kd_xy * vel_y
else:
pitch = -Kd_xy * vel_x
roll = -Kd_xy * vel_y
pitch = -self._Kd_xy * vel_x
roll = -self._Kd_xy * vel_y
yaw = 0.0