Syntax Fixes
This commit is contained in:
@@ -65,9 +65,9 @@ python scripts/run_ardupilot.py --pattern square --size 10 --altitude 15
|
|||||||
The flight controller is in `src/drone_controller.py`:
|
The flight controller is in `src/drone_controller.py`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from src.drone_controller import SimpleDroneController
|
from src.drone_controller import DroneController
|
||||||
|
|
||||||
drone = SimpleDroneController()
|
drone = DroneController()
|
||||||
drone.connect()
|
drone.connect()
|
||||||
drone.set_mode("GUIDED")
|
drone.set_mode("GUIDED")
|
||||||
drone.arm()
|
drone.arm()
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ python scripts/run_ardupilot.py --pattern hover
|
|||||||
### Basic Usage
|
### Basic Usage
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from src.drone_controller import SimpleDroneController
|
from src.drone_controller import DroneController
|
||||||
|
|
||||||
# Create and connect
|
# Create and connect
|
||||||
drone = SimpleDroneController()
|
drone = DroneController()
|
||||||
if not drone.connect():
|
if not drone.connect():
|
||||||
print("Connection failed")
|
print("Connection failed")
|
||||||
exit(1)
|
exit(1)
|
||||||
@@ -66,12 +66,12 @@ drone.fly_square(size=5, altitude=5)
|
|||||||
drone.land()
|
drone.land()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Class: SimpleDroneController
|
### Class: DroneController
|
||||||
|
|
||||||
#### Connection
|
#### Connection
|
||||||
|
|
||||||
```python
|
```python
|
||||||
drone = SimpleDroneController(connection_string="tcp:127.0.0.1:5760")
|
drone = DroneController(connection_string="tcp:127.0.0.1:5760")
|
||||||
drone.connect(timeout=30) # Returns True/False
|
drone.connect(timeout=30) # Returns True/False
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ def main():
|
|||||||
print(f" Size: {args.size}m")
|
print(f" Size: {args.size}m")
|
||||||
print("=" * 50 + "\n")
|
print("=" * 50 + "\n")
|
||||||
|
|
||||||
drone = SimpleDroneController(args.connection)
|
drone = DroneController(args.connection)
|
||||||
|
|
||||||
if not drone.connect():
|
if not drone.connect():
|
||||||
print("\n[ERROR] Could not connect to SITL")
|
print("\n[ERROR] Could not connect to SITL")
|
||||||
|
|||||||
Reference in New Issue
Block a user