northwind 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- northwind-1.0.0/LICENSE +21 -0
- northwind-1.0.0/PKG-INFO +108 -0
- northwind-1.0.0/README.md +86 -0
- northwind-1.0.0/northwind/__init__.py +45 -0
- northwind-1.0.0/northwind/ai_decision.py +55 -0
- northwind-1.0.0/northwind/data_logging.py +69 -0
- northwind-1.0.0/northwind/mission_control.py +52 -0
- northwind-1.0.0/northwind/navigation.py +61 -0
- northwind-1.0.0/northwind/obstacle_handling.py +64 -0
- northwind-1.0.0/northwind/py.typed +0 -0
- northwind-1.0.0/northwind/stability.py +59 -0
- northwind-1.0.0/northwind.egg-info/PKG-INFO +108 -0
- northwind-1.0.0/northwind.egg-info/SOURCES.txt +15 -0
- northwind-1.0.0/northwind.egg-info/dependency_links.txt +1 -0
- northwind-1.0.0/northwind.egg-info/top_level.txt +1 -0
- northwind-1.0.0/pyproject.toml +32 -0
- northwind-1.0.0/setup.cfg +4 -0
northwind-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Northwind Drone Library
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
northwind-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: northwind
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Drone Navigation Library with AI capabilities
|
|
5
|
+
Project-URL: Homepage, https://github.com/qwert1231231/northwind
|
|
6
|
+
Project-URL: Repository, https://github.com/qwert1231231/northwind.git
|
|
7
|
+
Project-URL: Issues, https://github.com/qwert1231231/northwind/issues
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# Northwind Drone Navigation Library
|
|
24
|
+
|
|
25
|
+
A comprehensive Python library for autonomous drone navigation and control systems, featuring AI-powered decision making, obstacle avoidance, and real-time stability control.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
### 1. Navigation (Powerful Brain)
|
|
30
|
+
- `set_destination(lat, lon)` - Set navigation destination coordinates
|
|
31
|
+
- `calculate_route(start, end)` - Calculate optimal flight route
|
|
32
|
+
- `update_position()` - Update current drone position from sensors
|
|
33
|
+
|
|
34
|
+
### 2. Obstacle Handling (Critical)
|
|
35
|
+
- `detect_obstacle(sensor_data)` - Detect obstacles using sensor data
|
|
36
|
+
- `avoid_obstacle(direction)` - Execute obstacle avoidance maneuvers
|
|
37
|
+
- `recalculate_path()` - Recalculate path around detected obstacles
|
|
38
|
+
|
|
39
|
+
### 3. Stability / Correction (Real Drone Behavior)
|
|
40
|
+
- `correct_drift(gps_error)` - Correct GPS positioning drift
|
|
41
|
+
- `adjust_altitude(wind_data)` - Adjust altitude based on wind conditions
|
|
42
|
+
- `hold_position()` - Maintain stable hover position
|
|
43
|
+
|
|
44
|
+
### 4. Mission Control
|
|
45
|
+
- `start_mission()` - Begin autonomous mission
|
|
46
|
+
- `pause_mission()` - Pause current mission execution
|
|
47
|
+
- `return_home()` - Return to home position safely
|
|
48
|
+
|
|
49
|
+
### 5. Simple AI Decision Layer
|
|
50
|
+
- `choose_action(state)` - Choose optimal action based on current state
|
|
51
|
+
- `predict_next_move()` - Predict next optimal move using AI
|
|
52
|
+
|
|
53
|
+
### 6. Data Logging (For Learning + Cloud)
|
|
54
|
+
- `log_flight_data()` - Log flight telemetry and sensor data
|
|
55
|
+
- `export_data()` - Export logged data to JSON files
|
|
56
|
+
- `send_to_cloud()` - Upload data to cloud storage for analysis
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install git+https://github.com/qwert1231231/northwind.git
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or clone and install locally:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/qwert1231231/northwind.git
|
|
68
|
+
cd northwind
|
|
69
|
+
pip install -e .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import northwind
|
|
76
|
+
|
|
77
|
+
# Set destination coordinates
|
|
78
|
+
northwind.set_destination(37.7749, -122.4194) # San Francisco
|
|
79
|
+
|
|
80
|
+
# Start autonomous mission
|
|
81
|
+
northwind.start_mission()
|
|
82
|
+
|
|
83
|
+
# AI decision making
|
|
84
|
+
action = northwind.choose_action('normal')
|
|
85
|
+
next_move = northwind.predict_next_move()
|
|
86
|
+
|
|
87
|
+
# Log flight data
|
|
88
|
+
northwind.log_flight_data()
|
|
89
|
+
northwind.export_data()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Requirements
|
|
93
|
+
|
|
94
|
+
- Python 3.8+
|
|
95
|
+
- GPS/IMU sensors (for real drone integration)
|
|
96
|
+
- Cloud storage account (optional, for data upload)
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT License - see LICENSE file for details.
|
|
105
|
+
|
|
106
|
+
## Repository
|
|
107
|
+
|
|
108
|
+
[https://github.com/qwert1231231/northwind](https://github.com/qwert1231231/northwind)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Northwind Drone Navigation Library
|
|
2
|
+
|
|
3
|
+
A comprehensive Python library for autonomous drone navigation and control systems, featuring AI-powered decision making, obstacle avoidance, and real-time stability control.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### 1. Navigation (Powerful Brain)
|
|
8
|
+
- `set_destination(lat, lon)` - Set navigation destination coordinates
|
|
9
|
+
- `calculate_route(start, end)` - Calculate optimal flight route
|
|
10
|
+
- `update_position()` - Update current drone position from sensors
|
|
11
|
+
|
|
12
|
+
### 2. Obstacle Handling (Critical)
|
|
13
|
+
- `detect_obstacle(sensor_data)` - Detect obstacles using sensor data
|
|
14
|
+
- `avoid_obstacle(direction)` - Execute obstacle avoidance maneuvers
|
|
15
|
+
- `recalculate_path()` - Recalculate path around detected obstacles
|
|
16
|
+
|
|
17
|
+
### 3. Stability / Correction (Real Drone Behavior)
|
|
18
|
+
- `correct_drift(gps_error)` - Correct GPS positioning drift
|
|
19
|
+
- `adjust_altitude(wind_data)` - Adjust altitude based on wind conditions
|
|
20
|
+
- `hold_position()` - Maintain stable hover position
|
|
21
|
+
|
|
22
|
+
### 4. Mission Control
|
|
23
|
+
- `start_mission()` - Begin autonomous mission
|
|
24
|
+
- `pause_mission()` - Pause current mission execution
|
|
25
|
+
- `return_home()` - Return to home position safely
|
|
26
|
+
|
|
27
|
+
### 5. Simple AI Decision Layer
|
|
28
|
+
- `choose_action(state)` - Choose optimal action based on current state
|
|
29
|
+
- `predict_next_move()` - Predict next optimal move using AI
|
|
30
|
+
|
|
31
|
+
### 6. Data Logging (For Learning + Cloud)
|
|
32
|
+
- `log_flight_data()` - Log flight telemetry and sensor data
|
|
33
|
+
- `export_data()` - Export logged data to JSON files
|
|
34
|
+
- `send_to_cloud()` - Upload data to cloud storage for analysis
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install git+https://github.com/qwert1231231/northwind.git
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or clone and install locally:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone https://github.com/qwert1231231/northwind.git
|
|
46
|
+
cd northwind
|
|
47
|
+
pip install -e .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import northwind
|
|
54
|
+
|
|
55
|
+
# Set destination coordinates
|
|
56
|
+
northwind.set_destination(37.7749, -122.4194) # San Francisco
|
|
57
|
+
|
|
58
|
+
# Start autonomous mission
|
|
59
|
+
northwind.start_mission()
|
|
60
|
+
|
|
61
|
+
# AI decision making
|
|
62
|
+
action = northwind.choose_action('normal')
|
|
63
|
+
next_move = northwind.predict_next_move()
|
|
64
|
+
|
|
65
|
+
# Log flight data
|
|
66
|
+
northwind.log_flight_data()
|
|
67
|
+
northwind.export_data()
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Requirements
|
|
71
|
+
|
|
72
|
+
- Python 3.8+
|
|
73
|
+
- GPS/IMU sensors (for real drone integration)
|
|
74
|
+
- Cloud storage account (optional, for data upload)
|
|
75
|
+
|
|
76
|
+
## Contributing
|
|
77
|
+
|
|
78
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT License - see LICENSE file for details.
|
|
83
|
+
|
|
84
|
+
## Repository
|
|
85
|
+
|
|
86
|
+
[https://github.com/qwert1231231/northwind](https://github.com/qwert1231231/northwind)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Northwind Drone Navigation Library
|
|
2
|
+
# A comprehensive library for drone navigation, obstacle avoidance, stability control, mission management, AI decision making, and data logging.
|
|
3
|
+
|
|
4
|
+
__version__ = "1.0.0"
|
|
5
|
+
|
|
6
|
+
from . import navigation
|
|
7
|
+
from . import obstacle_handling
|
|
8
|
+
from . import stability
|
|
9
|
+
from . import mission_control
|
|
10
|
+
from . import ai_decision
|
|
11
|
+
from . import data_logging
|
|
12
|
+
|
|
13
|
+
# Import functions to package level for convenience
|
|
14
|
+
from .navigation import set_destination, calculate_route, update_position
|
|
15
|
+
from .obstacle_handling import detect_obstacle, avoid_obstacle, recalculate_path
|
|
16
|
+
from .stability import correct_drift, adjust_altitude, hold_position
|
|
17
|
+
from .mission_control import start_mission, pause_mission, return_home
|
|
18
|
+
from .ai_decision import choose_action, predict_next_move
|
|
19
|
+
from .data_logging import log_flight_data, export_data, send_to_cloud
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"navigation",
|
|
23
|
+
"obstacle_handling",
|
|
24
|
+
"stability",
|
|
25
|
+
"mission_control",
|
|
26
|
+
"ai_decision",
|
|
27
|
+
"data_logging",
|
|
28
|
+
"set_destination",
|
|
29
|
+
"calculate_route",
|
|
30
|
+
"update_position",
|
|
31
|
+
"detect_obstacle",
|
|
32
|
+
"avoid_obstacle",
|
|
33
|
+
"recalculate_path",
|
|
34
|
+
"correct_drift",
|
|
35
|
+
"adjust_altitude",
|
|
36
|
+
"hold_position",
|
|
37
|
+
"start_mission",
|
|
38
|
+
"pause_mission",
|
|
39
|
+
"return_home",
|
|
40
|
+
"choose_action",
|
|
41
|
+
"predict_next_move",
|
|
42
|
+
"log_flight_data",
|
|
43
|
+
"export_data",
|
|
44
|
+
"send_to_cloud"
|
|
45
|
+
]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AI Decision Layer module for Northwind drone library.
|
|
3
|
+
Implements simple AI for decision making and move prediction.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import random
|
|
7
|
+
|
|
8
|
+
class AIDecision:
|
|
9
|
+
def __init__(self):
|
|
10
|
+
self.states = ['normal', 'obstacle_detected', 'low_battery', 'high_wind']
|
|
11
|
+
self.actions = ['continue', 'avoid', 'return_home', 'hover', 'land']
|
|
12
|
+
|
|
13
|
+
def choose_action(self, state):
|
|
14
|
+
"""
|
|
15
|
+
Choose an action based on current state.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
state (str): Current drone state
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
str: Chosen action
|
|
22
|
+
"""
|
|
23
|
+
if state == 'obstacle_detected':
|
|
24
|
+
action = 'avoid'
|
|
25
|
+
elif state == 'low_battery':
|
|
26
|
+
action = 'return_home'
|
|
27
|
+
elif state == 'high_wind':
|
|
28
|
+
action = 'hover'
|
|
29
|
+
else:
|
|
30
|
+
action = 'continue'
|
|
31
|
+
|
|
32
|
+
print(f"AI chose action '{action}' for state '{state}'")
|
|
33
|
+
return action
|
|
34
|
+
|
|
35
|
+
def predict_next_move(self):
|
|
36
|
+
"""
|
|
37
|
+
Predict the next optimal move based on current conditions.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
str: Predicted move/action
|
|
41
|
+
"""
|
|
42
|
+
# Simple prediction based on random selection for demonstration
|
|
43
|
+
move = random.choice(self.actions)
|
|
44
|
+
print(f"Predicted next move: {move}")
|
|
45
|
+
return move
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Convenience functions
|
|
49
|
+
_ai = AIDecision()
|
|
50
|
+
|
|
51
|
+
def choose_action(state):
|
|
52
|
+
return _ai.choose_action(state)
|
|
53
|
+
|
|
54
|
+
def predict_next_move():
|
|
55
|
+
return _ai.predict_next_move()
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Data logging module for Northwind drone library.
|
|
3
|
+
Handles flight data logging, export, and cloud transmission.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import datetime
|
|
8
|
+
|
|
9
|
+
class DataLogger:
|
|
10
|
+
def __init__(self):
|
|
11
|
+
self.flight_data = []
|
|
12
|
+
self.log_file = "flight_log.json"
|
|
13
|
+
|
|
14
|
+
def log_flight_data(self):
|
|
15
|
+
"""
|
|
16
|
+
Log current flight data (position, sensors, etc.).
|
|
17
|
+
"""
|
|
18
|
+
timestamp = datetime.datetime.now().isoformat()
|
|
19
|
+
data_entry = {
|
|
20
|
+
'timestamp': timestamp,
|
|
21
|
+
'position': (0.0, 0.0), # Would get from navigation
|
|
22
|
+
'altitude': 10.0, # Would get from sensors
|
|
23
|
+
'battery': 85, # Would get from sensors
|
|
24
|
+
'status': 'flying'
|
|
25
|
+
}
|
|
26
|
+
self.flight_data.append(data_entry)
|
|
27
|
+
print(f"Logged flight data at {timestamp}")
|
|
28
|
+
|
|
29
|
+
def export_data(self):
|
|
30
|
+
"""
|
|
31
|
+
Export logged data to file.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
str: Path to exported file
|
|
35
|
+
"""
|
|
36
|
+
with open(self.log_file, 'w') as f:
|
|
37
|
+
json.dump(self.flight_data, f, indent=2)
|
|
38
|
+
print(f"Data exported to {self.log_file}")
|
|
39
|
+
return self.log_file
|
|
40
|
+
|
|
41
|
+
def send_to_cloud(self):
|
|
42
|
+
"""
|
|
43
|
+
Send logged data to cloud storage.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
bool: Success status
|
|
47
|
+
"""
|
|
48
|
+
# Placeholder: implement cloud upload
|
|
49
|
+
print("Sending data to cloud...")
|
|
50
|
+
# Would integrate with cloud API (AWS S3, Google Cloud, etc.)
|
|
51
|
+
success = True # Simulate success
|
|
52
|
+
if success:
|
|
53
|
+
print("Data sent to cloud successfully")
|
|
54
|
+
else:
|
|
55
|
+
print("Failed to send data to cloud")
|
|
56
|
+
return success
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# Convenience functions
|
|
60
|
+
_logger = DataLogger()
|
|
61
|
+
|
|
62
|
+
def log_flight_data():
|
|
63
|
+
return _logger.log_flight_data()
|
|
64
|
+
|
|
65
|
+
def export_data():
|
|
66
|
+
return _logger.export_data()
|
|
67
|
+
|
|
68
|
+
def send_to_cloud():
|
|
69
|
+
return _logger.send_to_cloud()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Mission control module for Northwind drone library.
|
|
3
|
+
Manages mission lifecycle: start, pause, and return home.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
class MissionController:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.mission_active = False
|
|
9
|
+
self.mission_paused = False
|
|
10
|
+
self.home_position = (0.0, 0.0) # (lat, lon)
|
|
11
|
+
|
|
12
|
+
def start_mission(self):
|
|
13
|
+
"""
|
|
14
|
+
Start the drone mission.
|
|
15
|
+
"""
|
|
16
|
+
if not self.mission_active:
|
|
17
|
+
self.mission_active = True
|
|
18
|
+
self.mission_paused = False
|
|
19
|
+
print("Mission started")
|
|
20
|
+
else:
|
|
21
|
+
print("Mission already active")
|
|
22
|
+
|
|
23
|
+
def pause_mission(self):
|
|
24
|
+
"""
|
|
25
|
+
Pause the current mission.
|
|
26
|
+
"""
|
|
27
|
+
if self.mission_active and not self.mission_paused:
|
|
28
|
+
self.mission_paused = True
|
|
29
|
+
print("Mission paused")
|
|
30
|
+
else:
|
|
31
|
+
print("Mission not active or already paused")
|
|
32
|
+
|
|
33
|
+
def return_home(self):
|
|
34
|
+
"""
|
|
35
|
+
Return drone to home position.
|
|
36
|
+
"""
|
|
37
|
+
print("Returning to home position")
|
|
38
|
+
# Placeholder: set destination to home and engage navigation
|
|
39
|
+
# Would integrate with navigation.set_destination(self.home_position)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# Convenience functions
|
|
43
|
+
_controller = MissionController()
|
|
44
|
+
|
|
45
|
+
def start_mission():
|
|
46
|
+
return _controller.start_mission()
|
|
47
|
+
|
|
48
|
+
def pause_mission():
|
|
49
|
+
return _controller.pause_mission()
|
|
50
|
+
|
|
51
|
+
def return_home():
|
|
52
|
+
return _controller.return_home()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Navigation module for Northwind drone library.
|
|
3
|
+
Handles destination setting, route calculation, and position updates.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
class Navigation:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.destination = None
|
|
9
|
+
self.current_position = (0.0, 0.0) # (lat, lon)
|
|
10
|
+
self.route = []
|
|
11
|
+
|
|
12
|
+
def set_destination(self, lat, lon):
|
|
13
|
+
"""
|
|
14
|
+
Set the destination coordinates for the drone.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
lat (float): Latitude of destination
|
|
18
|
+
lon (float): Longitude of destination
|
|
19
|
+
"""
|
|
20
|
+
self.destination = (lat, lon)
|
|
21
|
+
print(f"Destination set to: {lat}, {lon}")
|
|
22
|
+
|
|
23
|
+
def calculate_route(self, start, end):
|
|
24
|
+
"""
|
|
25
|
+
Calculate a route from start to end coordinates.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
start (tuple): (lat, lon) starting position
|
|
29
|
+
end (tuple): (lat, lon) ending position
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
list: List of waypoints as (lat, lon) tuples
|
|
33
|
+
"""
|
|
34
|
+
# Simple straight-line route for demonstration
|
|
35
|
+
self.route = [start, end]
|
|
36
|
+
print(f"Route calculated: {self.route}")
|
|
37
|
+
return self.route
|
|
38
|
+
|
|
39
|
+
def update_position(self):
|
|
40
|
+
"""
|
|
41
|
+
Update the current position of the drone.
|
|
42
|
+
This would typically integrate with GPS/IMU sensors.
|
|
43
|
+
"""
|
|
44
|
+
# Placeholder: simulate position update
|
|
45
|
+
# In real implementation, this would read from sensors
|
|
46
|
+
self.current_position = (self.current_position[0] + 0.001, self.current_position[1] + 0.001)
|
|
47
|
+
print(f"Position updated to: {self.current_position}")
|
|
48
|
+
return self.current_position
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Convenience functions for direct use
|
|
52
|
+
_nav = Navigation()
|
|
53
|
+
|
|
54
|
+
def set_destination(lat, lon):
|
|
55
|
+
return _nav.set_destination(lat, lon)
|
|
56
|
+
|
|
57
|
+
def calculate_route(start, end):
|
|
58
|
+
return _nav.calculate_route(start, end)
|
|
59
|
+
|
|
60
|
+
def update_position():
|
|
61
|
+
return _nav.update_position()
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Obstacle handling module for Northwind drone library.
|
|
3
|
+
Manages obstacle detection, avoidance, and path recalculation.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
class ObstacleHandler:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.obstacles = []
|
|
9
|
+
self.avoidance_active = False
|
|
10
|
+
|
|
11
|
+
def detect_obstacle(self, sensor_data):
|
|
12
|
+
"""
|
|
13
|
+
Detect obstacles using sensor data.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
sensor_data (dict): Sensor readings (lidar, camera, etc.)
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
bool: True if obstacle detected
|
|
20
|
+
"""
|
|
21
|
+
# Placeholder: simple threshold-based detection
|
|
22
|
+
distance = sensor_data.get('distance', 100) # meters
|
|
23
|
+
if distance < 10: # threshold
|
|
24
|
+
self.obstacles.append(sensor_data)
|
|
25
|
+
print(f"Obstacle detected at distance: {distance}m")
|
|
26
|
+
return True
|
|
27
|
+
return False
|
|
28
|
+
|
|
29
|
+
def avoid_obstacle(self, direction):
|
|
30
|
+
"""
|
|
31
|
+
Execute obstacle avoidance maneuver.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
direction (str): Direction to avoid ('left', 'right', 'up', 'down')
|
|
35
|
+
"""
|
|
36
|
+
self.avoidance_active = True
|
|
37
|
+
print(f"Avoiding obstacle by moving {direction}")
|
|
38
|
+
# Placeholder: implement avoidance logic
|
|
39
|
+
# In real implementation, this would control drone motors/servos
|
|
40
|
+
|
|
41
|
+
def recalculate_path(self):
|
|
42
|
+
"""
|
|
43
|
+
Recalculate the navigation path after obstacle avoidance.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
list: New route waypoints
|
|
47
|
+
"""
|
|
48
|
+
print("Recalculating path around obstacles")
|
|
49
|
+
# Placeholder: implement pathfinding algorithm
|
|
50
|
+
new_route = [] # Would integrate with navigation module
|
|
51
|
+
return new_route
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# Convenience functions
|
|
55
|
+
_handler = ObstacleHandler()
|
|
56
|
+
|
|
57
|
+
def detect_obstacle(sensor_data):
|
|
58
|
+
return _handler.detect_obstacle(sensor_data)
|
|
59
|
+
|
|
60
|
+
def avoid_obstacle(direction):
|
|
61
|
+
return _handler.avoid_obstacle(direction)
|
|
62
|
+
|
|
63
|
+
def recalculate_path():
|
|
64
|
+
return _handler.recalculate_path()
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Stability and correction module for Northwind drone library.
|
|
3
|
+
Handles drift correction, altitude adjustment, and position holding.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
class StabilityController:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.target_altitude = 10.0 # meters
|
|
9
|
+
self.position_hold_active = False
|
|
10
|
+
|
|
11
|
+
def correct_drift(self, gps_error):
|
|
12
|
+
"""
|
|
13
|
+
Correct for GPS drift and positioning errors.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
gps_error (tuple): (lat_error, lon_error) in degrees
|
|
17
|
+
"""
|
|
18
|
+
lat_error, lon_error = gps_error
|
|
19
|
+
print(f"Correcting drift: lat_error={lat_error}, lon_error={lon_error}")
|
|
20
|
+
# Placeholder: implement PID control or Kalman filter
|
|
21
|
+
# Adjust drone position based on error
|
|
22
|
+
|
|
23
|
+
def adjust_altitude(self, wind_data):
|
|
24
|
+
"""
|
|
25
|
+
Adjust drone altitude based on wind conditions.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
wind_data (dict): Wind speed, direction, turbulence data
|
|
29
|
+
"""
|
|
30
|
+
wind_speed = wind_data.get('speed', 0)
|
|
31
|
+
if wind_speed > 15: # high wind threshold
|
|
32
|
+
self.target_altitude += 5 # increase altitude
|
|
33
|
+
print(f"Adjusting altitude to {self.target_altitude}m due to high wind")
|
|
34
|
+
# Placeholder: implement altitude control
|
|
35
|
+
|
|
36
|
+
def hold_position(self):
|
|
37
|
+
"""
|
|
38
|
+
Maintain current position (hover).
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
bool: True if position holding is active
|
|
42
|
+
"""
|
|
43
|
+
self.position_hold_active = True
|
|
44
|
+
print("Holding position")
|
|
45
|
+
# Placeholder: engage stabilization systems
|
|
46
|
+
return self.position_hold_active
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Convenience functions
|
|
50
|
+
_controller = StabilityController()
|
|
51
|
+
|
|
52
|
+
def correct_drift(gps_error):
|
|
53
|
+
return _controller.correct_drift(gps_error)
|
|
54
|
+
|
|
55
|
+
def adjust_altitude(wind_data):
|
|
56
|
+
return _controller.adjust_altitude(wind_data)
|
|
57
|
+
|
|
58
|
+
def hold_position():
|
|
59
|
+
return _controller.hold_position()
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: northwind
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Drone Navigation Library with AI capabilities
|
|
5
|
+
Project-URL: Homepage, https://github.com/qwert1231231/northwind
|
|
6
|
+
Project-URL: Repository, https://github.com/qwert1231231/northwind.git
|
|
7
|
+
Project-URL: Issues, https://github.com/qwert1231231/northwind/issues
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# Northwind Drone Navigation Library
|
|
24
|
+
|
|
25
|
+
A comprehensive Python library for autonomous drone navigation and control systems, featuring AI-powered decision making, obstacle avoidance, and real-time stability control.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
### 1. Navigation (Powerful Brain)
|
|
30
|
+
- `set_destination(lat, lon)` - Set navigation destination coordinates
|
|
31
|
+
- `calculate_route(start, end)` - Calculate optimal flight route
|
|
32
|
+
- `update_position()` - Update current drone position from sensors
|
|
33
|
+
|
|
34
|
+
### 2. Obstacle Handling (Critical)
|
|
35
|
+
- `detect_obstacle(sensor_data)` - Detect obstacles using sensor data
|
|
36
|
+
- `avoid_obstacle(direction)` - Execute obstacle avoidance maneuvers
|
|
37
|
+
- `recalculate_path()` - Recalculate path around detected obstacles
|
|
38
|
+
|
|
39
|
+
### 3. Stability / Correction (Real Drone Behavior)
|
|
40
|
+
- `correct_drift(gps_error)` - Correct GPS positioning drift
|
|
41
|
+
- `adjust_altitude(wind_data)` - Adjust altitude based on wind conditions
|
|
42
|
+
- `hold_position()` - Maintain stable hover position
|
|
43
|
+
|
|
44
|
+
### 4. Mission Control
|
|
45
|
+
- `start_mission()` - Begin autonomous mission
|
|
46
|
+
- `pause_mission()` - Pause current mission execution
|
|
47
|
+
- `return_home()` - Return to home position safely
|
|
48
|
+
|
|
49
|
+
### 5. Simple AI Decision Layer
|
|
50
|
+
- `choose_action(state)` - Choose optimal action based on current state
|
|
51
|
+
- `predict_next_move()` - Predict next optimal move using AI
|
|
52
|
+
|
|
53
|
+
### 6. Data Logging (For Learning + Cloud)
|
|
54
|
+
- `log_flight_data()` - Log flight telemetry and sensor data
|
|
55
|
+
- `export_data()` - Export logged data to JSON files
|
|
56
|
+
- `send_to_cloud()` - Upload data to cloud storage for analysis
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install git+https://github.com/qwert1231231/northwind.git
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or clone and install locally:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/qwert1231231/northwind.git
|
|
68
|
+
cd northwind
|
|
69
|
+
pip install -e .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import northwind
|
|
76
|
+
|
|
77
|
+
# Set destination coordinates
|
|
78
|
+
northwind.set_destination(37.7749, -122.4194) # San Francisco
|
|
79
|
+
|
|
80
|
+
# Start autonomous mission
|
|
81
|
+
northwind.start_mission()
|
|
82
|
+
|
|
83
|
+
# AI decision making
|
|
84
|
+
action = northwind.choose_action('normal')
|
|
85
|
+
next_move = northwind.predict_next_move()
|
|
86
|
+
|
|
87
|
+
# Log flight data
|
|
88
|
+
northwind.log_flight_data()
|
|
89
|
+
northwind.export_data()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Requirements
|
|
93
|
+
|
|
94
|
+
- Python 3.8+
|
|
95
|
+
- GPS/IMU sensors (for real drone integration)
|
|
96
|
+
- Cloud storage account (optional, for data upload)
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT License - see LICENSE file for details.
|
|
105
|
+
|
|
106
|
+
## Repository
|
|
107
|
+
|
|
108
|
+
[https://github.com/qwert1231231/northwind](https://github.com/qwert1231231/northwind)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
northwind/__init__.py
|
|
5
|
+
northwind/ai_decision.py
|
|
6
|
+
northwind/data_logging.py
|
|
7
|
+
northwind/mission_control.py
|
|
8
|
+
northwind/navigation.py
|
|
9
|
+
northwind/obstacle_handling.py
|
|
10
|
+
northwind/py.typed
|
|
11
|
+
northwind/stability.py
|
|
12
|
+
northwind.egg-info/PKG-INFO
|
|
13
|
+
northwind.egg-info/SOURCES.txt
|
|
14
|
+
northwind.egg-info/dependency_links.txt
|
|
15
|
+
northwind.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
northwind
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "northwind"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Drone Navigation Library with AI capabilities"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.8",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
]
|
|
23
|
+
dependencies = []
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/qwert1231231/northwind"
|
|
27
|
+
Repository = "https://github.com/qwert1231231/northwind.git"
|
|
28
|
+
Issues = "https://github.com/qwert1231231/northwind/issues"
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.packages.find]
|
|
31
|
+
where = ["."]
|
|
32
|
+
include = ["northwind*"]
|