agrotechsimapi 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.
@@ -0,0 +1,443 @@
1
+ Metadata-Version: 2.4
2
+ Name: agrotechsimapi
3
+ Version: 1.0.0
4
+ Summary: This repository contains the API for the AgroTechAvia simulators. This repository also contains several examples of how to interact with the API.
5
+ Author-email: AgroTechAvia <example@main.com>
6
+ License-Expression: Apache-2.0
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: backports.ssl-match-hostname
12
+ Requires-Dist: contourpy
13
+ Requires-Dist: cycler
14
+ Requires-Dist: fonttools
15
+ Requires-Dist: future
16
+ Requires-Dist: grpcio
17
+ Requires-Dist: grpcio-tools
18
+ Requires-Dist: iso8601
19
+ Requires-Dist: kiwisolver
20
+ Requires-Dist: matplotlib
21
+ Requires-Dist: msgpack-python
22
+ Requires-Dist: msgpack-rpc-python
23
+ Requires-Dist: numpy
24
+ Requires-Dist: opencv-contrib-python
25
+ Requires-Dist: opencv-python
26
+ Requires-Dist: packaging
27
+ Requires-Dist: pillow
28
+ Requires-Dist: protobuf
29
+ Requires-Dist: pynput
30
+ Requires-Dist: pyparsing
31
+ Requires-Dist: python-dateutil
32
+ Requires-Dist: PyYAML
33
+ Requires-Dist: pyserial
34
+ Requires-Dist: six
35
+ Requires-Dist: tornado
36
+ Requires-Dist: transforms3d
37
+ Requires-Dist: inavmspapi
38
+
39
+ # AgroTechSim API
40
+
41
+ ![AgroTechSim API](https://raw.githubusercontent.com/AgroTechAvia/TechSimApi/main/img/header.png)
42
+ [Русский](#русский) | [English](#english)
43
+
44
+ ---
45
+
46
+ ## Русский
47
+
48
+ ### 🚀 Описание
49
+
50
+ **AgroTechSim API** — это Python-библиотека для работы с симулятором AgroTechSim, предназначенная для получения телеметрии с дронов, обработки сенсорных данных и реализации систем автономного управления. Библиотека предоставляет как низкоуровневый доступ к сырым данным сенсоров, так и высокоуровневые абстракции для упрощённого управления дроном.
51
+
52
+ Модуль позволяет разработчикам создавать сложные алгоритмы компьютерного зрения, навигации и управления без необходимости работы с реальным оборудованием, используя полнофункциональный симулятор дронов.
53
+
54
+ ### 📊 Совместимость
55
+
56
+ | Компонент | Версия | Статус |
57
+ |-----------|--------|--------|
58
+ | **AgroTechSim API** | 1.0.0 | ✅ Актуальная |
59
+ | **Симулятор AgroTechSim** | 1.0.3 | ✅ Рекомендуемая |
60
+ | **Python** | 3.10 | ✅ Рекомендуемая |
61
+ | **InavMSPApi** | 1.1.0 | ✅ Зависимость |
62
+
63
+ ### ⚡ Установка
64
+
65
+ #### Вариант 1: Установка из PyPi (рекомендуется)
66
+
67
+ ```bash
68
+ pip install agrotechsimapi
69
+ ```
70
+
71
+ Этот способ автоматически установит все зависимости, включая `inavmspapi` требуемой версии.
72
+
73
+ #### Вариант 2: Установка из исходников
74
+
75
+ 1. Клонируйте репозиторий:
76
+ ```bash
77
+ git clone https://github.com/AgroTechAvia/TechSimApi.git
78
+ cd TechSimApi
79
+ ```
80
+
81
+ 2. Запустите скрипт установки:
82
+ ```bash
83
+ python setup_by_source.py
84
+ ```
85
+
86
+ Скрипт автоматически установит все зависимости и настроит окружение.
87
+
88
+ #### Вариант 3: Ручная установка (для разработчиков)
89
+
90
+ ```bash
91
+ # 1. Создайте виртуальное окружение
92
+ python -m venv .venv
93
+
94
+ # 2. Активируйте окружение
95
+ # Windows:
96
+ .venv\Scripts\activate
97
+ # Linux/Mac:
98
+ source .venv/bin/activate
99
+
100
+ # 3. Установите inavmspapi
101
+ git clone https://github.com/AgroTechAvia/InavMSPApi.git
102
+ cd InavMSPApi
103
+ git checkout v1.1.0
104
+ pip install .
105
+
106
+ # 4. Установите agrotechsimapi
107
+ cd ..
108
+ git clone https://github.com/AgroTechAvia/TechSimApi.git
109
+ cd TechSimApi
110
+ pip install .
111
+ ```
112
+
113
+ ### 🎯 Функционал
114
+
115
+ #### Низкоуровневый API (`SimClient`)
116
+ - 📷 **Камеры**: Получение цветных, тепловизионных, глубинных и спектральных изображений
117
+ - 📡 **Лидар**: 360° сканирование окружения с настраиваемыми параметрами
118
+ - 🎯 **Радар**: Обнаружение ближайших объектов с угловыми координатами
119
+ - 📏 **Дальномер**: Точечное измерение расстояния
120
+ - 💡 **LED управление**: Контроль подсветки дрона
121
+ - 📊 **Кинематика**: Получение позиции, ориентации и скорости дрона
122
+
123
+ #### Высокоуровневый API (`HighLevelSimClient`)
124
+ - 🚁 **Управление полётом**: Взлёт, посадка, удержание высоты
125
+ - 🧭 **Навигация**: Движение к координатам в разных системах отсчёта
126
+ - 🎯 **Стабилизация**: PID-регуляторы для автоматического удержания позиции
127
+ - 👁️ **Обработка изображений**: Детектирование ArUco маркеров и blob-объектов
128
+ - 🔄 **Одометрия**: Отслеживание перемещения относительно начальной точки
129
+
130
+ ### 📁 Примеры использования
131
+
132
+ В репозитории представлены готовые примеры:
133
+
134
+ #### `examples_low_level/` - Низкоуровневые примеры
135
+
136
+ #### `examples_high_level/` - Высокоуровневые примеры
137
+
138
+
139
+ ### 🚀 Быстрый старт
140
+
141
+ ```python
142
+ from agrotechsimapi import SimClient, CaptureType
143
+ import cv2
144
+
145
+ # Подключение к симулятору
146
+ client = SimClient(address="127.0.0.1", port=8080)
147
+
148
+ # Получение изображения с камеры
149
+ image = client.get_camera_capture(camera_id=0, type=CaptureType.color)
150
+
151
+ # Отображение изображения
152
+ cv2.imshow("Drone Camera", image)
153
+ cv2.waitKey(0)
154
+ cv2.destroyAllWindows()
155
+ ```
156
+
157
+ ### 🧪 Тестирование работоспособности
158
+
159
+ Для проверки корректной работы модуля с симулятором используйте интеграционные тесты. Файл `test_sim_client_real.py` содержит тесты, которые проверяют подключение к симулятору и работу всех основных функций.
160
+
161
+ #### 📋 Предварительные требования:
162
+ 1. **Запущенный симулятор AgroTechSim**
163
+ 2. **Дрон появился** в симуляторе
164
+ 3. **Установлен Python 3.10+** и необходимые зависимости
165
+
166
+ #### 🚀 Запуск тестов:
167
+
168
+ ```bash
169
+ # Перейдите в директорию проекта
170
+ cd TechSimApi
171
+
172
+ # Запустите тесты с симулятором
173
+ pytest test/test_sim_client_real.py --with-simulator -v
174
+ ```
175
+
176
+ #### 📊 Что проверяют тесты:
177
+
178
+ Тест `test_sim_client_real.py` последовательно проверяет:
179
+
180
+ 1. **✅ Подключение к симулятору** - проверка соединения
181
+ 2. **✅ Получение изображений с камер** - цветная, тепловизионная, глубинная камеры
182
+ 3. **✅ Кинематические данные** - позиция и ориентация дрона
183
+ 4. **✅ Данные дальномера** - измерение расстояния
184
+ 5. **✅ Сканирование лидаром** - 360° сканирование окружения
185
+ 6. **✅ Радар** - обнаружение ближайших объектов
186
+ 7. **✅ Управление LED** - включение/выключение подсветки
187
+ 8. **✅ Обработка изображений** - добавление шума и артефактов
188
+ 9. **✅ Несколько камер** - работа с разными ID камер
189
+ 10. **✅ Обработка ошибок** - корректная реакция на невалидные параметры
190
+ 11. **✅ Производительность** - время отклика основных функций
191
+
192
+ #### ⚠️ Важные замечания по тестированию:
193
+
194
+ - **Симулятор должен быть запущен** перед запуском тестов
195
+ - **Тесты могут пропускаться**, если определенный сенсор не доступен в текущей конфигурации симулятора
196
+ - **Первые измерения лидара и радара** могут быть некорректными (особенность симулятора)
197
+ - **Для ручной проверки** можно использовать скрипт:
198
+
199
+
200
+ #### 🔧 Пример вывода успешного тестирования:
201
+
202
+ ```
203
+ ============================================================
204
+ Running SimClient Integration Tests with Real Simulator
205
+ ============================================================
206
+
207
+ test_connection: ✓ PASSED
208
+ test_get_camera_capture: ✓ PASSED
209
+ test_get_kinematics_data: ✓ PASSED
210
+ test_get_range_data: ✓ PASSED
211
+ test_get_laser_scan: ✓ PASSED
212
+ test_get_radar_point: ⚠ SKIPPED (Radar not available)
213
+ test_led_control: ✓ PASSED
214
+ test_image_processing_methods: ✓ PASSED
215
+ test_multiple_camera_ids: ✓ PASSED
216
+ test_call_event_action: ✓ PASSED
217
+ test_error_handling: ✓ PASSED
218
+ test_performance: ✓ PASSED
219
+
220
+ ✅ Все основные функции работают корректно!
221
+ ```
222
+
223
+ #### 🐛 Если тесты не проходят:
224
+
225
+ 1. **Проверьте подключение к симулятору:**
226
+ ```python
227
+ from agrotechsimapi import SimClient
228
+ client = SimClient()
229
+ print(f"Connected: {client.is_connected()}")
230
+ ```
231
+
232
+ 2. **Убедитесь, что порт 8080 открыт:**
233
+ ```bash
234
+ # Linux/Mac
235
+ nc -z localhost 8080
236
+ # Windows
237
+ Test-NetConnection -ComputerName localhost -Port 8080
238
+ ```
239
+
240
+ 3. **Проверьте, что дрон заспавнен в симуляторе**
241
+
242
+ Тестирование позволяет убедиться, что все компоненты модуля работают корректно с текущей версией симулятора.
243
+
244
+ ---
245
+
246
+ ## English
247
+
248
+ ### 🚀 Description
249
+
250
+ **AgroTechSim API** is a Python library for working with the AgroTechSim simulator, designed for obtaining drone telemetry, processing sensor data, and implementing autonomous control systems. The library provides both low-level access to raw sensor data and high-level abstractions for simplified drone control.
251
+
252
+ The module enables developers to create complex computer vision, navigation, and control algorithms without the need for real hardware, using a full-featured drone simulator.
253
+
254
+ ### 📊 Compatibility
255
+
256
+ | Component | Version | Status |
257
+ |-----------|---------|--------|
258
+ | **AgroTechSim API** | 1.0.0 | ✅ Current |
259
+ | **AgroTechSim Simulator** | 1.0.3 | ✅ Recommended |
260
+ | **Python** | 3.10+ | ✅ Recommended |
261
+ | **InavMSPApi** | 1.1.0 | ✅ Dependency |
262
+
263
+ ### ⚡ Installation
264
+
265
+ #### Option 1: Install from PyPi (recommended)
266
+
267
+ ```bash
268
+ pip install agrotechsimapi
269
+ ```
270
+
271
+ This method will automatically install all dependencies, including the required version of `inavmspapi`.
272
+
273
+ #### Option 2: Install from source
274
+
275
+ 1. Clone the repository:
276
+ ```bash
277
+ git https://github.com/AgroTechAvia/TechSimApi.git
278
+ cd TechSimApi
279
+ ```
280
+
281
+ 2. Run the installation script:
282
+ ```bash
283
+ python setup_by_source.py
284
+ ```
285
+
286
+ The script will automatically install all dependencies and set up the environment.
287
+
288
+ #### Option 3: Manual installation (for developers)
289
+
290
+ ```bash
291
+ # 1. Create a virtual environment
292
+ python -m venv .venv
293
+
294
+ # 2. Activate the environment
295
+ # Windows:
296
+ .venv\Scripts\activate
297
+ # Linux/Mac:
298
+ source .venv/bin/activate
299
+
300
+ # 3. Install inavmspapi
301
+ git clone https://github.com/AgroTechAvia/InavMSPApi.git
302
+ cd InavMSPApi
303
+ git checkout v1.1.0
304
+ pip install .
305
+
306
+ # 4. Install agrotechsimapi
307
+ cd ..
308
+ git clone https://github.com/AgroTechAvia/TechSimApi.git
309
+ cd TechSimApi
310
+ pip install .
311
+ ```
312
+
313
+ ### 🎯 Features
314
+
315
+ #### Low-Level API (`SimClient`)
316
+ - 📷 **Cameras**: Capture color, thermal, depth, and spectral images
317
+ - 📡 **Lidar**: 360° environment scanning with configurable parameters
318
+ - 🎯 **Radar**: Nearest object detection with angular coordinates
319
+ - 📏 **Rangefinder**: Point distance measurement
320
+ - 💡 **LED Control**: Drone lighting control
321
+ - 📊 **Kinematics**: Get drone position, orientation, and velocity
322
+
323
+ #### High-Level API (`HighLevelSimClient`)
324
+ - 🚁 **Flight Control**: Takeoff, landing, altitude hold
325
+ - 🧭 **Navigation**: Movement to coordinates in different reference frames
326
+ - 🎯 **Stabilization**: PID controllers for automatic position hold
327
+ - 👁️ **Image Processing**: ArUco marker and blob object detection
328
+ - 🔄 **Odometry**: Track movement relative to starting point
329
+
330
+ ### 📁 Usage Examples
331
+
332
+ The repository includes ready-to-use examples:
333
+
334
+ #### `examples_low_level/` - Low-level examples
335
+
336
+ #### `examples_high_level/` - High-level examples
337
+
338
+ ### 🚀 Quick Start
339
+
340
+ ```python
341
+ from agrotechsimapi import SimClient, CaptureType
342
+ import cv2
343
+
344
+ # Connect to simulator
345
+ client = SimClient(address="127.0.0.1", port=8080)
346
+
347
+ # Get camera image
348
+ image = client.get_camera_capture(camera_id=0, type=CaptureType.color)
349
+
350
+ # Display image
351
+ cv2.imshow("Drone Camera", image)
352
+ cv2.waitKey(0)
353
+ cv2.destroyAllWindows()
354
+ ```
355
+
356
+ ### 🧪 Functionality Testing
357
+
358
+ To verify that the module works correctly with the simulator, use the integration tests. The `test_sim_client_real.py` file contains tests that check the connection to the simulator and the operation of all main functions.
359
+
360
+ #### 📋 Prerequisites:
361
+ 1. **Running AgroTechSim simulator** on `localhost:8080`
362
+ 2. **Drone spawned** in the simulator
363
+ 3. **Python 3.10+ installed** with necessary dependencies
364
+
365
+ #### 🚀 Running tests:
366
+
367
+ ```bash
368
+ # Go to the project directory
369
+ cd TechSimApi
370
+
371
+ # Run tests with simulator
372
+ pytest tests/test_sim_client_real.py --with-simulator -v
373
+ ```
374
+
375
+ #### 📊 What the tests check:
376
+
377
+ The `test_sim_client_real.py` test sequentially verifies:
378
+
379
+ 1. **✅ Connection to simulator** - connection check
380
+ 2. **✅ Camera image capture** - color, thermal, depth cameras
381
+ 3. **✅ Kinematic data** - drone position and orientation
382
+ 4. **✅ Rangefinder data** - distance measurement
383
+ 5. **✅ Lidar scanning** - 360° environment scanning
384
+ 6. **✅ Radar** - nearest object detection
385
+ 7. **✅ LED control** - turning lights on/off
386
+ 8. **✅ Image processing** - adding noise and artifacts
387
+ 9. **✅ Multiple cameras** - working with different camera IDs
388
+ 10. **✅ Error handling** - correct response to invalid parameters
389
+ 11. **✅ Performance** - response time of main functions
390
+
391
+ #### ⚠️ Important testing notes:
392
+
393
+ - **Simulator must be running** before starting tests
394
+ - **Tests may be skipped** if a particular sensor is not available in the current simulator configuration
395
+ - **First lidar and radar measurements** may be incorrect (simulator feature)
396
+ - **For manual checking** you can use the script:
397
+
398
+
399
+ #### 🔧 Example of successful test output:
400
+
401
+ ```
402
+ ============================================================
403
+ Running SimClient Integration Tests with Real Simulator
404
+ ============================================================
405
+
406
+ test_connection: ✓ PASSED
407
+ test_get_camera_capture: ✓ PASSED
408
+ test_get_kinematics_data: ✓ PASSED
409
+ test_get_range_data: ✓ PASSED
410
+ test_get_laser_scan: ✓ PASSED
411
+ test_get_radar_point: ⚠ SKIPPED (Radar not available)
412
+ test_led_control: ✓ PASSED
413
+ test_image_processing_methods: ✓ PASSED
414
+ test_multiple_camera_ids: ✓ PASSED
415
+ test_call_event_action: ✓ PASSED
416
+ test_error_handling: ✓ PASSED
417
+ test_performance: ✓ PASSED
418
+
419
+ ✅ All main functions work correctly!
420
+ ```
421
+
422
+ #### 🐛 If tests fail:
423
+
424
+ 1. **Check connection to simulator:**
425
+ ```python
426
+ from agrotechsimapi import SimClient
427
+ client = SimClient()
428
+ print(f"Connected: {client.is_connected()}")
429
+ ```
430
+
431
+ 2. **Make sure port 8080 is open:**
432
+ ```bash
433
+ # Linux/Mac
434
+ nc -z localhost 8080
435
+ # Windows
436
+ Test-NetConnection -ComputerName localhost -Port 8080
437
+ ```
438
+
439
+ 3. **Verify that drone is spawned in simulator**
440
+
441
+ Testing allows you to ensure that all module components work correctly with the current simulator version.
442
+
443
+ ---