Docs Update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# DroneController Guide
|
||||
|
||||
Implement your GPS-denied landing algorithm in `drone_controller.py`.
|
||||
Implement your GPS-denied landing algorithm.
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -9,25 +9,14 @@ Implement your GPS-denied landing algorithm in `drone_controller.py`.
|
||||
3. Implement your algorithm
|
||||
4. Test: `python standalone_simulation.py`
|
||||
|
||||
## Sensors Available
|
||||
|
||||
| Sensor | Description |
|
||||
|--------|-------------|
|
||||
| IMU | Orientation, angular velocity |
|
||||
| Altimeter | Altitude, vertical velocity |
|
||||
| Velocity | Estimated velocity (x, y, z) |
|
||||
| Camera | 320x240 downward image |
|
||||
| Landing Pad | Relative position (may be null!) |
|
||||
|
||||
## Function to Implement
|
||||
|
||||
```python
|
||||
def calculate_landing_maneuver(self, telemetry, rover_telemetry):
|
||||
# Your code here
|
||||
return (thrust, pitch, roll, yaw)
|
||||
```
|
||||
|
||||
## Sensor Data
|
||||
## Sensors (GPS-Denied)
|
||||
|
||||
```python
|
||||
# Altitude
|
||||
@@ -58,23 +47,23 @@ if landing_pad:
|
||||
|
||||
```python
|
||||
def calculate_landing_maneuver(self, telemetry, rover_telemetry):
|
||||
altimeter = telemetry.get('altimeter', {})
|
||||
altitude = altimeter.get('altitude', 5.0)
|
||||
vertical_vel = altimeter.get('vertical_velocity', 0.0)
|
||||
alt = telemetry.get('altimeter', {})
|
||||
altitude = alt.get('altitude', 5.0)
|
||||
vert_vel = alt.get('vertical_velocity', 0.0)
|
||||
|
||||
velocity = telemetry.get('velocity', {})
|
||||
vel_x = velocity.get('x', 0.0)
|
||||
vel_y = velocity.get('y', 0.0)
|
||||
vel = telemetry.get('velocity', {})
|
||||
vel_x = vel.get('x', 0.0)
|
||||
vel_y = vel.get('y', 0.0)
|
||||
|
||||
landing_pad = telemetry.get('landing_pad')
|
||||
pad = telemetry.get('landing_pad')
|
||||
|
||||
# Altitude control
|
||||
thrust = 0.5 * (0 - altitude) - 0.3 * vertical_vel
|
||||
# Altitude PD control
|
||||
thrust = 0.5 * (0 - altitude) - 0.3 * vert_vel
|
||||
|
||||
# Horizontal control
|
||||
if landing_pad:
|
||||
pitch = 0.3 * landing_pad['relative_x'] - 0.2 * vel_x
|
||||
roll = 0.3 * landing_pad['relative_y'] - 0.2 * vel_y
|
||||
if pad:
|
||||
pitch = 0.3 * pad['relative_x'] - 0.2 * vel_x
|
||||
roll = 0.3 * pad['relative_y'] - 0.2 * vel_y
|
||||
else:
|
||||
pitch = -0.2 * vel_x
|
||||
roll = -0.2 * vel_y
|
||||
@@ -82,33 +71,16 @@ def calculate_landing_maneuver(self, telemetry, rover_telemetry):
|
||||
return (thrust, pitch, roll, 0.0)
|
||||
```
|
||||
|
||||
## Using the Camera
|
||||
|
||||
```python
|
||||
import cv2
|
||||
import numpy as np
|
||||
import base64
|
||||
|
||||
camera = telemetry.get('camera', {})
|
||||
image_b64 = camera.get('image')
|
||||
|
||||
if image_b64:
|
||||
image_bytes = base64.b64decode(image_b64)
|
||||
nparr = np.frombuffer(image_bytes, np.uint8)
|
||||
image = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||
# Process image...
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
# Easy - stationary
|
||||
# Easy
|
||||
python standalone_simulation.py --pattern stationary
|
||||
|
||||
# Medium - circular
|
||||
# Medium
|
||||
python standalone_simulation.py --pattern circular --speed 0.3
|
||||
|
||||
# Hard - random
|
||||
# Hard
|
||||
python standalone_simulation.py --pattern random --speed 0.5
|
||||
```
|
||||
|
||||
@@ -118,9 +90,9 @@ Edit `config.py`:
|
||||
|
||||
```python
|
||||
CONTROLLER = {
|
||||
"Kp_z": 0.5, # Altitude proportional
|
||||
"Kd_z": 0.3, # Altitude derivative
|
||||
"Kp_xy": 0.3, # Horizontal proportional
|
||||
"Kd_xy": 0.2, # Horizontal derivative
|
||||
"Kp_z": 0.5,
|
||||
"Kd_z": 0.3,
|
||||
"Kp_xy": 0.3,
|
||||
"Kd_xy": 0.2,
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user