Skip to content

Commit

Permalink
Merge branch 'main' of github.com:toppers/hakoniwa-px4sim
Browse files Browse the repository at this point in the history
  • Loading branch information
tmori committed Jul 2, 2024
2 parents 8f2dadb + e3afe2f commit 5cdd2e8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tools/win/template/hakoniwa-px4-win/hakoniwa/bin/create_mmap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@echo off
setlocal


REM HAKO_CONFIG_PATH環境変数からパスを取得
set "HAKO_CONFIG_PATH=%HAKO_CONFIG_PATH%"

for /f "tokens=*" %%i in ('powershell -Command "Get-Content %HAKO_CONFIG_PATH% | ConvertFrom-Json | Select-Object -ExpandProperty core_mmap_path"') do (
set CORE_MMAP_PATH=%%i
)

rem 抽出した値を表示
echo %CORE_MMAP_PATH%

for /f "tokens=1* delims=\\" %%i in ("%CORE_MMAP_PATH%") do (
set DRIVE_LETTER=%%i
set MMAP_PATH=%%j
)

echo CoreMmapPath: %CORE_MMAP_PATH%
echo DriveLetter: %DRIVE_LETTER%
echo MmapDir: %MMAP_PATH%

REM ドライブに移動
cd /d %DRIVE_LETTER% || (
echo Failed to change to drive %DRIVE_LETTER%. Drive may not be available.
exit /b 1
)

REM ディレクトリが存在するか確認
if exist "%MMAP_PATH%" (
echo Directory already exists: %MMAP_PATH%
) else (
mkdir "%MMAP_PATH%"
echo Created directory: %CORE_MMAP_PATH%
)

endlocal
3 changes: 3 additions & 0 deletions tools/win/template/hakoniwa-px4-win/hakoniwa/bin/run-api.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ setlocal
set "HAKO_CUSTOM_JSON_PATH=..\config_api\custom.json"
set "DRONE_CONFIG_PATH=..\config_api"

REM create_mmap.bat を呼び出す
call create_mmap.bat

if not exist "%HAKO_CUSTOM_JSON_PATH%" (
echo ERROR: can not find "%HAKO_CUSTOM_JSON_PATH%"
exit /b 1
Expand Down
3 changes: 3 additions & 0 deletions tools/win/template/hakoniwa-px4-win/hakoniwa/bin/run-api2.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ setlocal
set "HAKO_CUSTOM_JSON_PATH=..\config_api2\custom.json"
set "DRONE_CONFIG_PATH=..\config_api2"

REM create_mmap.bat を呼び出す
call create_mmap.bat

if not exist "%HAKO_CUSTOM_JSON_PATH%" (
echo ERROR: can not find "%HAKO_CUSTOM_JSON_PATH%"
exit /b 1
Expand Down
3 changes: 3 additions & 0 deletions tools/win/template/hakoniwa-px4-win/hakoniwa/bin/run-win.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@echo off
setlocal

REM create_mmap.bat を呼び出す
call create_mmap.bat

for /f "tokens=3" %%a in ('netsh interface ip show address "vEthernet (WSL (Hyper-V firewall))" ^| findstr "IP Address"') do set "WSL_IP=%%a"

if not defined WSL_IP (
Expand Down

0 comments on commit 5cdd2e8

Please sign in to comment.