Skip to content

Conversation

Copy link

Copilot AI commented Sep 5, 2025

This PR implements automated MAVLink log collection from drone flight controllers, integrating it seamlessly into the existing drones_postflight.yml ansible workflow.

Problem

Previously, the postflight system only collected ROS bag files and system logs, missing critical low-level flight controller data stored in MAVLink logs. This data includes parameter changes, system status messages, detailed flight performance metrics, and error logs that are essential for comprehensive flight analysis and debugging.

Solution

Added a new Python script that uses the existing pymavlink dependency to automatically download flight logs from each drone's flight controller:

New Components

ansible/scripts/get_mavlogs.py

  • Connects to flight controller using standard MAVLink protocol
  • Discovers available logs via LOG_REQUEST_LIST messages
  • Downloads complete logs using LOG_REQUEST_DATA with proper chunking
  • Saves logs in standard ArduPilot .bin format for tool compatibility
  • Includes robust error handling, timeouts, and progress tracking

Enhanced ansible/drones_postflight.yml

  • Executes MAVLink collection before existing log synchronization
  • Uses ansible template system for configuration variables
  • Non-blocking execution - doesn't fail if MAVLink logs unavailable
  • Outputs collection status for monitoring

Usage

The MAVLink log collection now runs automatically as part of the standard postflight workflow:

cd /path/to/swarmnxt/ansible
ansible-playbook -i inventory.ini drones_postflight.yml -K

This will collect both ROS bag files and MAVLink logs from all configured drones, consolidating them into timestamped directories on the host computer.

Log Storage

MAVLink logs are saved to ${drone_base_path}/logs/latest/mavlink/ with filenames like mavlink_log_{id}_{timestamp}.bin, and are automatically included in the consolidated log collection.

Documentation

Updated both docs/software-common-tasks.md and docs/flying.md with comprehensive documentation covering the new postflight log collection capabilities, including log formats, locations, and analysis workflows.

Compatibility

  • Leverages existing pymavlink and loguru dependencies
  • Uses existing ansible configuration variables
  • Zero disruption to current workflows
  • Maintains compatibility with standard ArduPilot analysis tools

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits September 5, 2025 11:03
Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
Copilot AI changed the title [WIP] can you write a script to get the mavlogs from pymavlink and integrate it into drones_postflight? Add automated MAVLink log collection to drones_postflight workflow Sep 5, 2025
Copilot AI requested a review from nielmistry September 5, 2025 11:07
Copilot finished work on behalf of nielmistry September 5, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants