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.0b0.tar.gz (16.3 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.0b0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pmini_sdk-2.0.0b0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/5.15.154+

File hashes

Hashes for pmini_sdk-2.0.0b0.tar.gz
Algorithm Hash digest
SHA256 b9d8220328a20d9334279fa5441eb82bf0ea53c6babb0627a53be9947926f82b
MD5 857d2075eff14a6be0c74bb5b05615e3
BLAKE2b-256 c2941a3c4748668746629b7b00b5dbdc7a22da5bdbdbc5317cf33c5ef8ae2081

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmini_sdk-2.0.0b0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/5.15.154+

File hashes

Hashes for pmini_sdk-2.0.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 29561b337f473c8272f0a7cba25c2e0d4056e868f1cb111de293b646df8724c6
MD5 7299b306263f6e7a6be0e3bf9aae5f5c
BLAKE2b-256 f1eb151eaae6385ab965b73aafb1ef3f19cb70e153e9c6fce095e5f2c2c7aedb

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