From 2d7113fe51e8bd2de28070a14105d4481f8e05d5 Mon Sep 17 00:00:00 2001 From: Uwe Fechner Date: Sun, 31 Mar 2024 15:16:46 +0200 Subject: [PATCH] add autopilot scripts --- bin/autopilot | 13 +++++++++++++ bin/autopilot.bat | 15 +++++++++++++++ src/KiteSimulators.jl | 3 ++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 bin/autopilot create mode 100644 bin/autopilot.bat diff --git a/bin/autopilot b/bin/autopilot new file mode 100644 index 0000000..3b69270 --- /dev/null +++ b/bin/autopilot @@ -0,0 +1,13 @@ +#!/bin/bash +cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" +cd .. + +julia_version=$(julia --version | awk '{print($3)}') +julia_major=${julia_version:0:3} + +echo "Lauching KiteViewer..." +if test -f "bin/kps-image-${julia_major}.so"; then + julia --startup-file=no -t auto -J bin/kps-image-${julia_major}.so --optimize=1 --project -e "include(\"./examples/autopilot.jl\");" +else + julia --startup-file=no -t auto --optimize=2 --project -e "include(\"./examples/autopilot.jl\");" +fi diff --git a/bin/autopilot.bat b/bin/autopilot.bat new file mode 100644 index 0000000..b5fe945 --- /dev/null +++ b/bin/autopilot.bat @@ -0,0 +1,15 @@ +@echo off +REM determine basename of current directory +for /F "delims=" %%i in ("%cd%") do set basename=%%~ni + +if %basename%==bin cd .. +for /f "delims=" %%i in ('julia --version') do set version_string=%%i +for /f "tokens=3 delims= " %%a in ("%version_string%") do set version=%%a + +set julia_major=%version:~0,3% +set image=kps-image-%julia_major%.dll + +echo Lauching KiteViewer... +IF EXIST "bin/%image%" ( + julia --startup-file=no -t auto -J bin/kps-image-%julia_major%.so --optimize=1 --project -e "include(\"./examples/autopilot.jl\");" +) else julia --startup-file=no -t auto --optimize=2 --project -e "include(\"./examples/autopilot.jl\");" diff --git a/src/KiteSimulators.jl b/src/KiteSimulators.jl index e3c05bc..156e2a5 100644 --- a/src/KiteSimulators.jl +++ b/src/KiteSimulators.jl @@ -48,7 +48,8 @@ In addition it copies the README.md file, the default settings in the folder data and helper scripts in the folder test. """ function init_project() - bin_files = ["create_sys_image", "create_sys_image.bat", "run_julia", "run_julia.bat", "joystick", "joystick.bat"] + bin_files = ["create_sys_image", "create_sys_image.bat", "run_julia", "run_julia.bat", "joystick", "joystick.bat", + "autopilot", "autopilot.bat"] test_files = ["create_sys_image.jl", "test_for_precompile.jl", "update_packages.jl"] docs_files = ["Installation.md", "PackageInstallation.md", "kite_power_tools.png", "kite_4p.png", "dir_structure.png", "vscode.png", "logging.md", "plotting.md", "2d_plot.png"]