Skip to main content

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 fixtures
  • test_basic.py - Basic tests that don't require simulation
  • test_connection.py - Connection tests that require simulation
  • run_integration_tests.py - Test runner script

Prerequisites

  1. Install dependencies:
pip install pytest pytest-cov
  1. 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

  1. Create a new test file: test_<feature>.py
  2. Use the existing fixtures from conftest.py
  3. Add appropriate markers to your tests
  4. 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:

  1. Ensure your simulation container is running
  2. Check that the simulation is listening on the correct port
  3. Verify network connectivity between test environment and simulation

Import Errors

If you get import errors:

  1. Make sure the SDK is installed: pip install -e .
  2. Check that all dependencies are installed: pip install -r requirements.txt

Test Failures

  • Check the logs for detailed error messages
  • Use -v flag for verbose output
  • Use -s flag to see print statements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pmini_sdk-2.0.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pmini_sdk-2.0.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file pmini_sdk-2.0.0.tar.gz.

File metadata

  • Download URL: pmini_sdk-2.0.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.8.0-94-generic

File hashes

Hashes for pmini_sdk-2.0.0.tar.gz
Algorithm Hash digest
SHA256 02f291af903d0c182b6c2d4786b515259785d2be52ff233e2771c159300e73c7
MD5 0e8153540d369ccb16bf2dd9a2953f92
BLAKE2b-256 38442f0be2fea3879f73f7098e67a2c61012a43f1604ea76c8cb08e8a8c82ecc

See more details on using hashes here.

File details

Details for the file pmini_sdk-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pmini_sdk-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.8.0-94-generic

File hashes

Hashes for pmini_sdk-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce2f3851a33b594e0e6d6d1fab6abffb33a039404d4cdc9831914aa0bde96237
MD5 7f249c706bbeea0463eaa16080edf26e
BLAKE2b-256 33f7642e32bf782172f7e74bf790c4831e5e116e91cd13dda2dc7cff16f24687

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page