Skip to content

Conversation

Copy link

Copilot AI commented Aug 25, 2025

This PR adds essential preflight validation checks to the drone setup process to prevent deployment issues and ensure consistency across the swarm.

Problem

During drone preflight operations, there was no validation to ensure that:

  1. The ROS2 workspace was properly built on each drone
  2. The drone's local repository was synchronized with the deployment repository

This could lead to runtime failures or inconsistent behavior across the swarm when drones had missing dependencies or outdated code.

Solution

Added a new "Pre-flight Validation Checks" block to ansible/drones_preflight.yml that performs two critical validations for each drone:

1. ROS2 Workspace Validation

- name: Check if ROS2 workspace install directory exists
  ansible.builtin.stat:
    path: "{{ drone_ros_path }}/install"
  register: ros_install_check

Verifies that ~/ros2_swarmnxt_ws/install/ exists, indicating the workspace has been properly built.

2. Git Version Synchronization Check

- name: Get local repository git commit hash
  ansible.builtin.shell: git rev-parse HEAD
  args:
    chdir: "{{ playbook_dir }}/.."
  delegate_to: localhost
  register: local_git_hash

Compares the git commit hash between the local deployment repository and each drone's ~/repos/swarm-nxt to ensure code synchronization.

Behavior

  • Success: If both checks pass, the preflight continues normally
  • Failure: If either check fails, the playbook stops with a descriptive error message indicating:
    • Which drone failed
    • What specific issue was detected
    • Clear guidance on how to resolve the problem

Example failure messages:

  • "ROS2 workspace install directory /home/lis/ros2_swarmnxt_ws/install does not exist on drone-01. Please ensure the workspace is properly built."
  • "Git version mismatch on drone-01. Local: abc123..., Drone: def456.... Please ensure both repositories are synchronized."

Impact

This enhancement improves the reliability of drone operations by catching configuration issues early in the deployment process, reducing the likelihood of mid-flight failures due to missing dependencies or code mismatches.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

nielmistry and others added 30 commits July 30, 2025 17:05
Co-authored-by: Charbel Toumieh <charbel.toumieh@epfl.ch>
Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
…b8-6658fe26c54c

Fix ROS nodes not shutting down cleanly with systemctl stop
…ration

Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
…4e3-6701955ad2ab

Replace ineffective WiFi power saving systemd service with NetworkManager configuration
Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
Copilot AI changed the title [WIP] early in the preflight for the drones, can you add a task in the ansible to: 1. check if ~/ros2_swarmnxt_ws/install/ exists 2. if the git version of ~/repos/swarm-nxt matches the local repo if either of these checks fail i want to fail the play for t... Add preflight validation checks for ROS workspace and git synchronization Aug 25, 2025
Copilot AI requested a review from nielmistry August 25, 2025 14:35
Copilot finished work on behalf of nielmistry August 25, 2025 14:35
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