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.2.tar.gz (23.4 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.2-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pmini_sdk-2.0.2.tar.gz
  • Upload date:
  • Size: 23.4 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

Hashes for pmini_sdk-2.0.2.tar.gz
Algorithm Hash digest
SHA256 10148dc36d424b5b6776c2cdb28fabbca156f6213c45c3a4dd7cc2851f7c2ee4
MD5 28d35fc3ed41e0bd95c2430fe7b9aef6
BLAKE2b-256 35f1966ea12c176146acaa53f9154eb4c596412cb4340d49f5233fce4c12c4e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmini_sdk-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 26.6 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

Hashes for pmini_sdk-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b47bc68f703c5f81429517c30a070178e3749ba8a624dab2d9653f21db8b2d20
MD5 272cb508c861ee49fb63b1182ca2a6b1
BLAKE2b-256 6eeb7b667fe204dc7caa2d0174e580452bb9782d007a7e03fd206e87853a4322

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