Python SDK for Pmini quadcopter
Project description
Pmini SDK Python
Get started
python -m venv venv
source venv/bin/activate
poetry build
pip install ./dist/pmini-0.0.0-py3-none-any.whl --force-reinstall
Examples
After installing the package, go to the examples folder and run any of the examples
cd examples
Run example
python3 takeoff.py
Integration Tests for Pmini SDK
This directory contains integration tests for the Pmini SDK Python library.
Test Structure
conftest.py- Pytest configuration and fixturestest_basic.py- Basic tests that don't require simulationtest_connection.py- Connection tests that require simulationrun_integration_tests.py- Test runner script
Prerequisites
- Install dependencies:
pip install pytest pytest-cov
- Install the SDK:
pip install -e .
Running Tests
Note
For the integration testing, autopilot simulation is required. You can use this repository to start the simulation: https://gitlab.com/regislab/pathfindermini/pf_mini_gazebo
git clone git@gitlab.com:regislab/pathfindermini/pf_mini_gazebo.git && cd pf_mini_gazebo
Launch the simulation with the following command
make run
Basic Tests (No Simulation Required)
# Run basic tests only
python -m pytest test/test_basic.py -v
# Or use the test runner
python test/run_integration_tests.py --test-path test/test_basic.py
Connection Tests (Requires Simulation)
# Start your simulation container first, then:
python -m pytest test/test_connection.py -v
All Tests
# Run all tests
python -m pytest test/ -v
With Markers
# Run only integration tests
python -m pytest test/ -m integration
# Run only connection tests
python -m pytest test/ -m connection
# Exclude slow tests
python -m pytest test/ -m "not slow"
Test Configuration
The tests are configured to connect to a simulation running on:
- Host:
192.168.4.1 - Port:
8080 - Protocol:
UDP
You can modify the connection settings in conftest.py if your simulation uses different parameters.
Test Categories
Basic Tests (test_basic.py)
- SDK import verification
- Configuration object creation
- Enum availability
- Logging setup
Connection Tests (test_connection.py)
- Connection establishment
- Connection stability
- MAVLink client functionality
- Optical flow data availability
- Connection timeout handling
- Connection recovery
Adding New Tests
- Create a new test file:
test_<feature>.py - Use the existing fixtures from
conftest.py - Add appropriate markers to your tests
- Follow the existing test patterns
Example:
import pytest
import logging
class TestNewFeature:
@pytest.mark.integration
def test_new_feature(self, pmini_instance, wait_for_connection):
logger = logging.getLogger(__name__)
logger.info("Testing new feature")
# Your test logic here
assert True
logger.info("✅ New feature test passed")
Troubleshooting
Connection Timeout
If tests fail with connection timeout:
- Ensure your simulation container is running
- Check that the simulation is listening on the correct port
- Verify network connectivity between test environment and simulation
Import Errors
If you get import errors:
- Make sure the SDK is installed:
pip install -e . - Check that all dependencies are installed:
pip install -r requirements.txt
Test Failures
- Check the logs for detailed error messages
- Use
-vflag for verbose output - Use
-sflag to see print statements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pmini_sdk-2.0.1.tar.gz.
File metadata
- Download URL: pmini_sdk-2.0.1.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.17.0-14-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e81bb6d96cc63cd096582ccd7a81b27389b173e01cccf360c7ec621f28fde97
|
|
| MD5 |
b23b6c2c25d5fe434f1218ec0304b433
|
|
| BLAKE2b-256 |
4fd7611230efd4b09aac19643f40221459171fa45f53a74af66f1e9b73df37e3
|
File details
Details for the file pmini_sdk-2.0.1-py3-none-any.whl.
File metadata
- Download URL: pmini_sdk-2.0.1-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.17.0-14-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec7466773fc00282b6ec7235a3dc6cf0b9c9e3828a889ef75306c27506fd5f0b
|
|
| MD5 |
184f0957ea1b901e59039d0aad802ff7
|
|
| BLAKE2b-256 |
50556bbbd8a911b9ef4c402a46f74c5c2ae50f71aaa10ee97d5c00d418cfc515
|