From b6816285e53bf9e3b7e70be5bebee13f8d7579d0 Mon Sep 17 00:00:00 2001 From: Stephen Dade Date: Mon, 12 Jun 2017 12:58:45 +1000 Subject: [PATCH] Tools: APM source is not required to be in Cygwin dir --- ...ygwinAPM.ps1 => InstallDevEnvironment.ps1} | 52 +++++++++---------- .../InstallDevEnvironmentAndAPMSource.ps1 | 27 ++++++++++ Tools/autotest/win_sitl/RunCopter.bat | 14 ++++- Tools/autotest/win_sitl/RunPlane.bat | 14 ++++- Tools/autotest/win_sitl/RunRover.bat | 14 ++++- Tools/autotest/win_sitl/UpdateAPMSource.bat | 16 +++++- .../{apm_install.sh => jsbsimAPM_install.sh} | 0 Tools/autotest/win_sitl/jsbsim_install.sh | 11 ++++ Tools/autotest/win_sitl/readme.txt | 27 +++++----- 9 files changed, 127 insertions(+), 48 deletions(-) rename Tools/autotest/win_sitl/{InstallCygwinAPM.ps1 => InstallDevEnvironment.ps1} (65%) create mode 100644 Tools/autotest/win_sitl/InstallDevEnvironmentAndAPMSource.ps1 rename Tools/autotest/win_sitl/{apm_install.sh => jsbsimAPM_install.sh} (100%) create mode 100644 Tools/autotest/win_sitl/jsbsim_install.sh diff --git a/Tools/autotest/win_sitl/InstallCygwinAPM.ps1 b/Tools/autotest/win_sitl/InstallDevEnvironment.ps1 similarity index 65% rename from Tools/autotest/win_sitl/InstallCygwinAPM.ps1 rename to Tools/autotest/win_sitl/InstallDevEnvironment.ps1 index 97d2c5aa4c..6f8134ed55 100644 --- a/Tools/autotest/win_sitl/InstallCygwinAPM.ps1 +++ b/Tools/autotest/win_sitl/InstallDevEnvironment.ps1 @@ -1,27 +1,27 @@ -#Powershell script to donwload and configure the APM SITL environment - -Import-Module BitsTransfer - -Write-Output "Starting Downloads" - -Write-Output "Downloading MAVProxy (1/6)" -Start-BitsTransfer -Source "http://firmware.ardupilot.org/Tools/MAVProxy/MAVProxySetup-latest.exe" -Destination "$PSScriptRoot\MAVProxySetup-latest.exe" - -Write-Output "Downloading Cygwin x64 (2/6)" -Start-BitsTransfer -Source "https://cygwin.com/setup-x86_64.exe" -Destination "$PSScriptRoot\setup-x86_64.exe" - -Write-Output "Installing Cygwin x64 (3/6)" -& $PSScriptRoot\setup-x86_64.exe --root="C:\cygwin" --no-startmenu --local-package-dir=$env:USERPROFILE\Downloads --site="http://cygwin.mirror.constant.com" --packages autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel, libxml2-devel,python-libxml2,libxslt-devel,python-devel,procps-ng --quiet-mode | Out-Null -Start-Process -wait -FilePath $PSScriptRoot\setup-x86_64.exe -ArgumentList "--root=C:\cygwin --no-startmenu --local-package-dir=$env:USERPROFILE\Downloads --site=http://cygwin.mirror.constant.com --packages autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel, libxml2-devel,python-libxml2,libxslt-devel,python-devel,procps-ng --quiet-mode" - -Write-Output "Configuring Cygwin (4/6)" -Copy-Item apm_install.sh C:\cygwin\home - -Write-Output "Downloading APM Source Code Cygwin (5/6)" -Start-Process -wait -FilePath "C:\cygwin\bin\bash" -ArgumentList "--login -i -c ../apm_install.sh" - -Write-Output "Installing MAVProxy (6/6)" -& $PSScriptRoot\MAVProxySetup-latest.exe /SILENT | Out-Null - -Write-Host "Finished. Press any key to continue ..." +#Powershell script to download and configure the APM SITL environment + +Import-Module BitsTransfer + +Write-Output "Starting Downloads" + +Write-Output "Downloading MAVProxy (1/6)" +Start-BitsTransfer -Source "http://firmware.ardupilot.org/Tools/MAVProxy/MAVProxySetup-latest.exe" -Destination "$PSScriptRoot\MAVProxySetup-latest.exe" + +Write-Output "Downloading Cygwin x64 (2/6)" +Start-BitsTransfer -Source "https://cygwin.com/setup-x86_64.exe" -Destination "$PSScriptRoot\setup-x86_64.exe" + +Write-Output "Installing Cygwin x64 (3/6)" +#& $PSScriptRoot\setup-x86_64.exe --root="C:\cygwin" --no-startmenu --local-package-dir=$env:USERPROFILE\Downloads --site="http://cygwin.mirror.constant.com" --packages autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel, libxml2-devel,python-libxml2,libxslt-devel,python-devel,procps-ng --quiet-mode | Out-Null +Start-Process -wait -FilePath $PSScriptRoot\setup-x86_64.exe -ArgumentList "--root=C:\cygwin --no-startmenu --local-package-dir=$env:USERPROFILE\Downloads --site=http://cygwin.mirror.constant.com --packages autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel, libxml2-devel,python-libxml2,libxslt-devel,python-devel,procps-ng --quiet-mode" + +Write-Output "Copying JSBSim install script Cygwin (4/6)" +Copy-Item jsbsim_install.sh C:\cygwin\home + +Write-Output "Downloading JSBSim Cygwin (5/6)" +Start-Process -wait -FilePath "C:\cygwin\bin\bash" -ArgumentList "--login -i -c ../jsbsim_install.sh" + +Write-Output "Installing MAVProxy (6/6)" +& $PSScriptRoot\MAVProxySetup-latest.exe /SILENT | Out-Null + +Write-Host "Finished. Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") \ No newline at end of file diff --git a/Tools/autotest/win_sitl/InstallDevEnvironmentAndAPMSource.ps1 b/Tools/autotest/win_sitl/InstallDevEnvironmentAndAPMSource.ps1 new file mode 100644 index 0000000000..5d7df2f1cd --- /dev/null +++ b/Tools/autotest/win_sitl/InstallDevEnvironmentAndAPMSource.ps1 @@ -0,0 +1,27 @@ +#Powershell script to download and configure the APM SITL environment + +Import-Module BitsTransfer + +Write-Output "Starting Downloads" + +Write-Output "Downloading MAVProxy (1/6)" +Start-BitsTransfer -Source "http://firmware.ardupilot.org/Tools/MAVProxy/MAVProxySetup-latest.exe" -Destination "$PSScriptRoot\MAVProxySetup-latest.exe" + +Write-Output "Downloading Cygwin x64 (2/6)" +Start-BitsTransfer -Source "https://cygwin.com/setup-x86_64.exe" -Destination "$PSScriptRoot\setup-x86_64.exe" + +Write-Output "Installing Cygwin x64 (3/6)" +#& $PSScriptRoot\setup-x86_64.exe --root="C:\cygwin" --no-startmenu --local-package-dir=$env:USERPROFILE\Downloads --site="http://cygwin.mirror.constant.com" --packages autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel, libxml2-devel,python-libxml2,libxslt-devel,python-devel,procps-ng --quiet-mode | Out-Null +Start-Process -wait -FilePath $PSScriptRoot\setup-x86_64.exe -ArgumentList "--root=C:\cygwin --no-startmenu --local-package-dir=$env:USERPROFILE\Downloads --site=http://cygwin.mirror.constant.com --packages autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel, libxml2-devel,python-libxml2,libxslt-devel,python-devel,procps-ng --quiet-mode" + +Write-Output "Copying JSBSim APM install script Cygwin (4/6)" +Copy-Item jsbsimAPM_install.sh C:\cygwin\home + +Write-Output "Downloading JSBSim and APM (5/6)" +Start-Process -wait -FilePath "C:\cygwin\bin\bash" -ArgumentList "--login -i -c ../jsbsimAPM_install.sh" + +Write-Output "Installing MAVProxy (6/6)" +& $PSScriptRoot\MAVProxySetup-latest.exe /SILENT | Out-Null + +Write-Host "Finished. Press any key to continue ..." +$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") \ No newline at end of file diff --git a/Tools/autotest/win_sitl/RunCopter.bat b/Tools/autotest/win_sitl/RunCopter.bat index c1f2aca38b..9ba69f0317 100644 --- a/Tools/autotest/win_sitl/RunCopter.bat +++ b/Tools/autotest/win_sitl/RunCopter.bat @@ -1,4 +1,14 @@ rem File run APM:Copter SITL +SETLOCAL enableextensions +@echo off + rem Assumes a Cgywin install at C:\cygwin -chdir C:\cygwin\bin -bash --login -i -c "cd ./ardupilot/ArduCopter && ../Tools/autotest/sim_vehicle.py" +if "%CYGWIN_LOCATION%" == "" (set "CYGWIN_LOCATION=C:\cygwin") + +rem get current dir for Cygwin +set pth=%CD:~2,99% +set pth=%pth:\=/% +set drv=%CD:~0,1% +set "fullpath=/cygdrive/%drv%%pth%" + +%CYGWIN_LOCATION%\bin\bash.exe --login -i -c "cd ""%fullpath%"" && cd ../../../ArduCopter && ../Tools/autotest/sim_vehicle.py" diff --git a/Tools/autotest/win_sitl/RunPlane.bat b/Tools/autotest/win_sitl/RunPlane.bat index e779c0454b..abf90eae22 100644 --- a/Tools/autotest/win_sitl/RunPlane.bat +++ b/Tools/autotest/win_sitl/RunPlane.bat @@ -1,4 +1,14 @@ rem File run APM:Plane SITL +SETLOCAL enableextensions +@echo off + rem Assumes a Cgywin install at C:\cygwin -chdir C:\cygwin\bin -bash --login -i -c "cd ./ardupilot/ArduPlane && ../Tools/autotest/sim_vehicle.py" +if "%CYGWIN_LOCATION%" == "" (set "CYGWIN_LOCATION=C:\cygwin") + +rem get current dir for Cygwin +set pth=%CD:~2,99% +set pth=%pth:\=/% +set drv=%CD:~0,1% +set "fullpath=/cygdrive/%drv%%pth%" + +%CYGWIN_LOCATION%\bin\bash.exe --login -i -c "cd ""%fullpath%"" && cd ../../../ArduPlane && ../Tools/autotest/sim_vehicle.py" diff --git a/Tools/autotest/win_sitl/RunRover.bat b/Tools/autotest/win_sitl/RunRover.bat index 3f27513c4a..85d2b7d74f 100644 --- a/Tools/autotest/win_sitl/RunRover.bat +++ b/Tools/autotest/win_sitl/RunRover.bat @@ -1,4 +1,14 @@ rem File run APM:Rover SITL +SETLOCAL enableextensions +@echo off + rem Assumes a Cgywin install at C:\cygwin -chdir C:\cygwin\bin -bash --login -i -c "cd ./ardupilot/APMrover2 && ../Tools/autotest/sim_vehicle.py" +if "%CYGWIN_LOCATION%" == "" (set "CYGWIN_LOCATION=C:\cygwin") + +rem get current dir for Cygwin +set pth=%CD:~2,99% +set pth=%pth:\=/% +set drv=%CD:~0,1% +set "fullpath=/cygdrive/%drv%%pth%" + +%CYGWIN_LOCATION%\bin\bash.exe --login -i -c "cd ""%fullpath%"" && cd ../../../APMrover2 && ../Tools/autotest/sim_vehicle.py" diff --git a/Tools/autotest/win_sitl/UpdateAPMSource.bat b/Tools/autotest/win_sitl/UpdateAPMSource.bat index fbe6243b24..057ce18041 100644 --- a/Tools/autotest/win_sitl/UpdateAPMSource.bat +++ b/Tools/autotest/win_sitl/UpdateAPMSource.bat @@ -1,5 +1,17 @@ rem File to update the APM source rem Assumes a Cgywin install at C:\cygwin -chdir C:\cygwin\bin -bash --login -i -c "cd ./ardupilot && git pull && git submodule update --init --recursive" +@echo off + +rem get current dir for Cygwin +set pth=%CD:~2,99% +set pth=%pth:\=/% +set drv=%CD:~0,1% +set "fullpath=/cygdrive/%drv%%pth%" + +rem update the source +C:\cygwin\bin\bash.exe --login -i -c "cd ""%fullpath%"" && cd ../../../ && git pull && git submodule update --init --recursive" + +rem re-configure build config +C:\cygwin\bin\bash.exe --login -i -c "cd ""%fullpath%"" && cd ../../../ && ./modules/waf/waf-light configure --board=sitl" + pause diff --git a/Tools/autotest/win_sitl/apm_install.sh b/Tools/autotest/win_sitl/jsbsimAPM_install.sh similarity index 100% rename from Tools/autotest/win_sitl/apm_install.sh rename to Tools/autotest/win_sitl/jsbsimAPM_install.sh diff --git a/Tools/autotest/win_sitl/jsbsim_install.sh b/Tools/autotest/win_sitl/jsbsim_install.sh new file mode 100644 index 0000000000..fa56286311 --- /dev/null +++ b/Tools/autotest/win_sitl/jsbsim_install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +#A simple script to install the APM SITL environment into cygwin + +python -m ensurepip --user +python -m pip install --user future +git clone git://github.com/tridge/jsbsim.git +cd jsbsim +./autogen.sh +make +cp src/JSBSim.exe /usr/local/bin diff --git a/Tools/autotest/win_sitl/readme.txt b/Tools/autotest/win_sitl/readme.txt index 88b0807e9b..5281578775 100644 --- a/Tools/autotest/win_sitl/readme.txt +++ b/Tools/autotest/win_sitl/readme.txt @@ -1,6 +1,6 @@ SITL for Windows Automatic Installation Scripts -This is a collection of batch files to automatically install and run APM SITL (http://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html) on a Windows-based PC/laptop. +This is a collection of batch files to automatically install and run APM SITL required libraries (http://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html) on a Windows-based PC/laptop. The scripts are based on the SITL setup instructions here: http://ardupilot.org/dev/docs/sitl-native-on-windows.html Prerequisites: @@ -8,16 +8,21 @@ Prerequisites: None! The scripts will take care of everything. You will need an Internet connection and an hour of time (will be less with a fast Internet connection) for the scripts to download and install everything. -Assumptions: +1) Assumptions: - The scripts will install Cygwin, MAVProxy and the APM source to C:\cygwin. So access to the C:\ drive is required. + The scripts will install Cygwin (to C:\cygwin) and MAVProxy. So access to the C:\ drive is required. + + There are 2 options for installation: Just the development environment (2A) , or the development environment plus APM source code (2B). The first option is for users that already have the APM source code on their computer (or wish to have it in a particular folder). The second option will download and configure the APM source code too, which is easier for new users. -Installing: +2A) Installing just the Development Environment: - Download these scripts and unzip - Run the script "InstallCygwinAPM.ps1" (right click -> Run in Powershell). This will install Cygwin to C:\cygwin and MAVProxy to C:\Program Files (x86)\MAVProxy + Run the script "InstallDevEnvironment.ps1" (right click -> Run in Powershell). This will install Cygwin to C:\cygwin and MAVProxy to C:\Program Files (x86)\MAVProxy + +2B) Installing the Development Environment and APM source code: -Running SITL: + Run the script "InstallDevEnvironmentAndAPMSource.ps1" (right click -> Run in Powershell). This will install Cygwin to C:\cygwin and MAVProxy to C:\Program Files (x86)\MAVProxy. The APM source code will be in C:\cygwin\home\\ardupilot + +3) Running SITL: There are several options for running SITL. In all cases, SITL will output a mavlink stream on 127.0.0.1:14550 (UDP) for connection to any GCS software (Such as Mission Planner). @@ -29,13 +34,7 @@ To continue with the current EEPROM, run: RunPlane.bat for running APM:Plane RunRover.bat for running APM:Rover -To delete the old EEPROM and start with all default settings, run: - - ResetRunCopter.bat for a quadcopter running APM:Copter - ResetRunPlane.bat for running APM:Plane - ResetRunRover.bat for running APM:Rover - -Updating the APM source code +4) Updating the APM source code To update the APM code with the latest of Github, run UpdateAPMSource.bat. Note this is bleeding-edge source code and some bugs may be present. Deleting the SITL environment