High-level Python wrapper around the upstream cosma-tech/kogger_acousticAntenna
driver. Configures a Kogger acoustic antenna as a permanent slave transponder
in a single start() call: address filter, echo filter, optional TDMA sync slot,
permanent response window, and Python callbacks for each ping received.
No modification to the upstream driver — only composes existing public methods
in the right order. Snapshot of upstream driver included read-only under driver/
for reference.
Includes:
- transponder_continu.py (302 lines): the wrapper class + CLI
- examples/auv_slave.py (79 lines): usage example with logging
- README.md: design rationale, usage, multi-AUV TDMA, watchdog, hardware wiring
- driver/: snapshot of cosma-tech/kogger_acousticAntenna at commit 1b539f9
('Add index slot for multi pinger', 2025-03-11)
Built for Cosma context (USV master + N AUVs slaves) following the design
conversation in Discord #ping-pong-ping (2026-04-27). See poulpe/ping-pong-ping
on Gitea for the interactive demo of the protocol.
65 lines
2.4 KiB
Python
Executable File
65 lines
2.4 KiB
Python
Executable File
#! /usr/bin/env python
|
|
import sys
|
|
import subprocess
|
|
from pathlib import Path
|
|
import os # Import the 'os' module for path manipulation
|
|
|
|
# --- Configuration ---
|
|
# Add the names of the scripts you want to run in order.
|
|
scripts_to_run = ['log_to_csv.py', 'log_add_diff.py', 'log_to_human.py', 'log_merge_nav_usbl.py']
|
|
# -------------------
|
|
|
|
def main():
|
|
"""
|
|
Runs a list of scripts, modifying arguments for specific scripts as needed.
|
|
"""
|
|
# Get the absolute path of the directory where this launcher script is located.
|
|
launcher_dir = Path(__file__).parent.resolve()
|
|
|
|
# Get all arguments passed to this launcher.
|
|
args = sys.argv[1:]
|
|
|
|
if not args:
|
|
print("❌ Error: No arguments provided.")
|
|
print(f"Usage: python {sys.argv[0]} ARGUMENT1 ARGUMENT2 ...")
|
|
sys.exit(1)
|
|
|
|
print(f"🚀 Starting launcher with arguments: {', '.join(args)}\n")
|
|
|
|
# Iterate through each script defined in the list.
|
|
for script_name in scripts_to_run:
|
|
# Construct the full, absolute path to the target script.
|
|
script_path = launcher_dir / script_name
|
|
|
|
# For each script, iterate through each argument provided.
|
|
for arg in args:
|
|
|
|
# This is our new logic block
|
|
# ---------------------------------------------------------------
|
|
arg_for_script = arg # Default to the original argument
|
|
|
|
if script_name == 'log_add_diff.py' and arg.lower().endswith('.csv'):
|
|
# Split the argument into the part before the extension and the extension itself
|
|
basename, extension = os.path.splitext(arg)
|
|
# Create the new, modified argument
|
|
arg_for_script = f"{basename}_csv{extension}"
|
|
# ---------------------------------------------------------------
|
|
|
|
# The command now uses the potentially modified argument.
|
|
command = ['python', str(script_path), arg_for_script]
|
|
print(f"▶️ Running: {' '.join(command)}")
|
|
|
|
try:
|
|
subprocess.run(command, check=True, text=True)
|
|
except FileNotFoundError:
|
|
print(f"❌ Error: Script '{script_path}' not found.")
|
|
sys.exit(1)
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"❌ Error running '{' '.join(command)}'. Returned code: {e.returncode}")
|
|
sys.exit(1)
|
|
|
|
print("\n✅ All scripts completed successfully!")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|