-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '4047873b69e878e6dae0bb080ba06fd552cc699b' into extractHALs
- Loading branch information
Showing
2 changed files
with
94 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,24 +35,24 @@ jobs: | |
# Steps represent a sequence of tasks that will be executed as part of the job. | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Cache PlatformIO | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.platformio | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
|
@@ -75,24 +75,24 @@ jobs: | |
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Cache PlatformIO | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.platformio | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
|
@@ -112,24 +112,24 @@ jobs: | |
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Cache PlatformIO | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.platformio | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
|
@@ -152,24 +152,24 @@ jobs: | |
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Cache PlatformIO | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.platformio | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
|
@@ -179,7 +179,7 @@ jobs: | |
pip install --upgrade platformio | ||
- name: Set up graphviz | ||
uses: ts-graphviz/setup-graphviz@v1.2.0 | ||
uses: ts-graphviz/setup-graphviz@v2 | ||
|
||
- name: Set up doxygen and generate documentation for ${{ matrix.environment }} | ||
uses: mattnotmitt/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,102 @@ | ||
@echo off | ||
setlocal | ||
|
||
rem Change working directory to the directory of the batch script. | ||
cd /d %~dp0 | ||
|
||
set PATH=%PATH%; | ||
set WEBOTS_CONTROLLER="%WEBOTS_HOME%\msys64\mingw64\bin\webots-controller.exe" | ||
set PROGRAM_NAME=program.exe | ||
set CONVOY_LEADER_PROGRAM_PATH=.pio\build\ConvoyLeaderSim | ||
set CONVOY_FOLLOWER_PROGRAM_PATH=.pio\build\ConvoyFollowerSim | ||
set CONVOY_LEADER_RX_CHANNEL=1 | ||
set CONVOY_LEADER_TX_CHANNEL=2 | ||
|
||
set CONVOY_LEADER_PIO_ENV_NAME=ConvoyLeaderSim | ||
set CONVOY_LEADER_PIO_PATH=.pio\build\%CONVOY_LEADER_PIO_ENV_NAME% | ||
set CONVOY_LEADER_ROBOT_NAME=leader | ||
set CONVOY_LEADER_RX_CHANNEL=1 | ||
set CONVOY_LEADER_TX_CHANNEL=2 | ||
|
||
set CONVOY_FOLLOWER_PIO_ENV_NAME=ConvoyFollowerSim | ||
set CONVOY_FOLLOWER_PIO_PATH=.pio\build\%CONVOY_FOLLOWER_PIO_ENV_NAME% | ||
set CONVOY_FOLLOWER_ROBOT_NAME=follower_ | ||
|
||
set TEMP_PLATOON_PATH=tmp | ||
set TEMP_PLATOON_LEADER_PATH=%TEMP_PLATOON_PATH%\%CONVOY_LEADER_PIO_ENV_NAME% | ||
set TEMP_PLATOON_LEADER_NEW_PATH=%TEMP_PLATOON_PATH%\%CONVOY_LEADER_ROBOT_NAME% | ||
set TEMP_PLATOON_FOLLOWER_PATH=%TEMP_PLATOON_PATH%\%CONVOY_FOLLOWER_PIO_ENV_NAME% | ||
set TEMP_PLATOON_FOLLOWER_NEW_PATH=%TEMP_PLATOON_PATH%\%CONVOY_FOLLOWER_ROBOT_NAME% | ||
|
||
rem Compile Convoy Leader | ||
%USERPROFILE%\.platformio\penv\Scripts\pio.exe run --environment ConvoyLeaderSim | ||
%USERPROFILE%\.platformio\penv\Scripts\pio.exe run --environment %CONVOY_LEADER_PIO_ENV_NAME% | ||
|
||
rem Compile Convoy Follower | ||
%USERPROFILE%\.platformio\penv\Scripts\pio.exe run --environment ConvoyFollowerSim | ||
%USERPROFILE%\.platformio\penv\Scripts\pio.exe run --environment %CONVOY_FOLLOWER_PIO_ENV_NAME% | ||
|
||
rem If temporary folder doesn't exist, it will be created. | ||
if not exist %TEMP_PLATOON_PATH%\ ( | ||
md %TEMP_PLATOON_PATH% | ||
) | ||
|
||
rem Unzip leader to temporary folder | ||
if exist %TEMP_PLATOON_LEADER_PATH%\ ( | ||
rmdir /s /q %TEMP_PLATOON_LEADER_PATH%\ | ||
) | ||
Call :UnZipFile "%~dp0%TEMP_PLATOON_PATH%\" "%~dp0%CONVOY_LEADER_PIO_PATH%\%CONVOY_LEADER_PIO_ENV_NAME%.zip" | ||
|
||
rem Unzip leader to temporary folder | ||
if exist %TEMP_PLATOON_FOLLOWER_PATH%\ ( | ||
rmdir /s /q %TEMP_PLATOON_FOLLOWER_PATH%\ | ||
) | ||
Call :UnZipFile "%~dp0%TEMP_PLATOON_PATH%\" "%~dp0%CONVOY_FOLLOWER_PIO_PATH%\%CONVOY_FOLLOWER_PIO_ENV_NAME%.zip" | ||
|
||
rem Copy leader folder according to a new folder with the robot's name. | ||
rem The copy ensures that a existing settings.json will be kept. | ||
copy /y %TEMP_PLATOON_LEADER_PATH% %TEMP_PLATOON_LEADER_NEW_PATH% | ||
|
||
rem Copy follower folder according to a new folder with the robot's name. | ||
rem The copy ensures that a existing settings.json will be kept. | ||
for /L %%i in (1, 1, 2) do ( | ||
if exist %TEMP_PLATOON_FOLLOWER_PATH%\ ( | ||
rmdir /s /q %TEMP_PLATOON_FOLLOWER_PATH%\ | ||
) | ||
copy /y %TEMP_PLATOON_FOLLOWER_PATH% %TEMP_PLATOON_FOLLOWER_NEW_PATH%%%i | ||
) | ||
|
||
rem Delete extraced files from .zip | ||
rmdir /s /q %TEMP_PLATOON_LEADER_PATH% | ||
rmdir /s /q %TEMP_PLATOON_FOLLOWER_PATH% | ||
|
||
rem Start the convoy leader | ||
echo Start convoy leader. | ||
start "Convoy Leader" ""%WEBOTS_CONTROLLER%"" --robot-name=leader --stdout-redirect %CONVOY_LEADER_PROGRAM_PATH%\%PROGRAM_NAME% -c --serialRxCh=%CONVOY_LEADER_RX_CHANNEL% --serialTxCh=%CONVOY_LEADER_TX_CHANNEL% -v" | ||
start "Convoy Leader" ""%WEBOTS_CONTROLLER%"" --robot-name=%CONVOY_LEADER_ROBOT_NAME% --stdout-redirect %TEMP_PLATOON_LEADER_NEW_PATH%\%PROGRAM_NAME% -n %CONVOY_LEADER_ROBOT_NAME% -c --serialRxCh=%CONVOY_LEADER_RX_CHANNEL% --serialTxCh=%CONVOY_LEADER_TX_CHANNEL% -v" | ||
|
||
rem Start the followers | ||
for /L %%i in (1, 1, 2) do ( | ||
call :start_follower %%i | ||
echo Start convoy follower %%i. | ||
call :StartFollower %%i | ||
) | ||
|
||
exit /b | ||
|
||
:start_follower | ||
:StartFollower | ||
set INSTANCE=%1 | ||
set ROBOT_NAME=follower_%instance% | ||
set ROBOT_NAME=%CONVOY_FOLLOWER_ROBOT_NAME%%instance% | ||
set /a SERIAL_RX_CHANNEL=(INSTANCE * 2) + 1 | ||
set /a SERIAL_TX_CHANNEL=(INSTANCE * 2) + 2 | ||
echo Start convoy follower %INSTANCE%. | ||
start "Convoy Follower %INSTANCE%" ""%WEBOTS_CONTROLLER%"" --robot-name=%ROBOT_NAME% --stdout-redirect %CONVOY_FOLLOWER_PROGRAM_PATH%\%PROGRAM_NAME% -c --serialRxCh=%SERIAL_RX_CHANNEL% --serialTxCh=%SERIAL_TX_CHANNEL% -v" | ||
start "Convoy Follower %INSTANCE%" ""%WEBOTS_CONTROLLER%"" --robot-name=%ROBOT_NAME% --stdout-redirect %TEMP_PLATOON_FOLLOWER_NEW_PATH%%INSTANCE%\%PROGRAM_NAME% -n %ROBOT_NAME% -c --serialRxCh=%SERIAL_RX_CHANNEL% --serialTxCh=%SERIAL_TX_CHANNEL% -v" | ||
exit /b | ||
|
||
:UnZipFile <extractTo> <newzipfile> | ||
SET vbs="%TEMP%\_.vbs" | ||
IF EXIST %vbs% DEL /f /q %vbs% | ||
>%vbs% ECHO Set fso = CreateObject("Scripting.FileSystemObject") | ||
>>%vbs% ECHO If NOT fso.FolderExists(%1) Then | ||
>>%vbs% ECHO fso.CreateFolder(%1) | ||
>>%vbs% ECHO End If | ||
>>%vbs% ECHO set objShell = CreateObject("Shell.Application") | ||
>>%vbs% ECHO set FilesInZip=objShell.NameSpace(%2).items | ||
>>%vbs% ECHO objShell.NameSpace(%1).CopyHere(FilesInZip) | ||
>>%vbs% ECHO Set fso = Nothing | ||
>>%vbs% ECHO Set objShell = Nothing | ||
cscript //nologo %vbs% | ||
IF EXIST %vbs% DEL /f /q %vbs% |