diff --git a/README-WINDOWS.md b/README-WINDOWS.md index 4276aed..9d4b98e 100644 --- a/README-WINDOWS.md +++ b/README-WINDOWS.md @@ -19,13 +19,12 @@ It is necessary to complete all the steps for `ros2cs` [Prerequisites](https://g * Source your ROS2 installation (`C:\dev\ros2_foxy\local_setup.ps1`) in the terminal before you proceed. * Run `pull_repositories.ps1`. This will pull `ros2cs` as well as your custom messages. You might be asked for github credentials. * Run `build.ps1` script. - * Optionally, you can build tests by adding `--with-tests` argument to `build` command. - * You can build with `--clean-install` to make sure your installation directory is cleaned before deploying. + * Optionally, you can build tests by adding `-with_tests` argument to `build` command. + * You can build with `-clean_install` to make sure your installation directory is cleaned before deploying. * This ivokes `colcon_build` with `--merge-install` argument to simplify libraries installation. * It deploys built plugins into the Asset directory. Note that only plugins built for the current platform will be deployed (there is no cross-compilation). * It prepares Unity Asset that is ready to import into your Unity project (`install/asset/` directory). - * By default, build process generates standalone libraries on Windows. - You can disable this feature by setting CMake option `STANDALONE_BUILD` to `OFF` (e.g. through editing `build.ps1`). + * Currently Windows OS supports standalone build only. * In order to generate `Ros2ForUnity.unitypackage` please run `create_unity_package.ps1`. Please provide path to your Unity executable when prompted. * Asset can be found in `install\unity_package` directory * In case your Unity license has expired, the `create_unity_package.ps1` won't throw any errors but `Ros2ForUnity.unitypackage` won't be generated too. @@ -69,9 +68,9 @@ pip install numpy ## OS-Specific usage remarks -> If the Asset is built with `STANDALONE_BUILD` option set to `1` (the default), then nothing extra needs to be done. +> If the Asset is built with `-standalone` flag (the default), then nothing extra needs to be done. Otherwise, you have to source your ros distribution before launching either Unity3D Editor or Application. -> Note that after you build the Asset, you can use it on a machine that has no ros2 installation (if built with `STANDALONE_BUILD`). +> Note that after you build the Asset, you can use it on a machine that has no ros2 installation (if built with `-standalone`). > You can simply copy over the `Ros2ForUnity` subdirectory to update your Asset. diff --git a/README.md b/README.md index c4f6fab..1615724 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,14 @@ Supported ROS2 distributions: - Foxy - Galactic -Tested Unity3D version: 2021.1.7f1. +Supported Unity3d: +- 2020+ -For Windows only, this asset can be prepared in two flavors: -- standalone (no ROS2 installation required on target machine, e.g. your Unity3D simulation server). All required dependencies are installed and can be used e.g. as a complete set of Unity3D plugins. -- overlay (assuming existing (supported) ROS2 installation on target machine). Only asset libraries and generated messages are installed. +Older versions of Unity3d may work, but the editor executable most probably won't be detected properly by deployment script. This would require user confirmation for using unsupported version. + +For Windows, this asset can be prepared in standalone mode only (no ROS2 installation required on target machine, e.g. your Unity3D simulation server). All required dependencies are installed and can be used e.g. as a complete set of Unity3D plugins. + +For Ubuntu, this asset can be prepared in overlay mode only (assuming existing (supported) ROS2 installation on target machine). Only asset libraries and generated messages are installed. ## Releases diff --git a/create_unity_package.ps1 b/create_unity_package.ps1 index 52cd71d..3eacba2 100644 --- a/create_unity_package.ps1 +++ b/create_unity_package.ps1 @@ -43,11 +43,20 @@ if(-Not (Test-Path -Path "$output_dir")) { & "$unity_path" -version | Tee-Object -Variable unity_version | Out-Null if ($unity_version -match '^[0-9]{4}\.[0-9]*\.[0-9]*[f]?[0-9]*$') { - Write-Host "Unity editor confirmed..." + Write-Host "Unity editor confirmed." } else { - Write-Host "Can't confirm Unity editor. Exiting." - exit 1 + while (1) { + $confirmation = Read-Host "Can't confirm Unity editor. Do you want to force $unity_path as an Unity editor executable? [y]es or [n]o" + if ($confirmation -eq 'y' -or $confirmation -eq 'Y') { + break; + } elseif ( $confirmation -eq 'n' -or $confirmation -eq 'N' ) { + exit 1; + } else { + Write-Host "Please answer [y]es or [n]o."; + } + } } +Write-Host "Using ${unity_path} editor." $tmp_project_path = Join-Path -Path "$temp_dir" -ChildPath "\ros2cs_unity_project\$unity_version" diff --git a/create_unity_package.sh b/create_unity_package.sh index f51efd9..31635e0 100755 --- a/create_unity_package.sh +++ b/create_unity_package.sh @@ -71,12 +71,21 @@ UNITY_VERSION=`$UNITY_PATH -version` # Test if unity editor is valid if [[ $UNITY_VERSION =~ ^[0-9]{4}\.[0-9]*\.[0-9]*[f]?[0-9]*$ ]]; then - echo "Unity editor confirmed..." + echo "Unity editor confirmed." else - echo "Can't confirm Unity editor. Exiting." - exit 1 + while true; do + read -p "Can't confirm Unity editor. Do you want to force \"$UNITY_PATH\" as an Unity editor executable? [y]es or [N]o: " yn + yn=${yn:-"n"} + case $yn in + [Yy]* ) break;; + [Nn]* ) exit 1;; + * ) echo "Please answer [y]es or [n]o.";; + esac + done fi +echo "Using \"${UNITY_PATH}\" editor." + TMP_PROJECT_PATH=/tmp/ros2cs_unity_project/$UNITY_VERSION # Create temp project if [ -d "$TMP_PROJECT_PATH" ]; then diff --git a/pull_repositories.ps1 b/pull_repositories.ps1 index 15b10ff..1a68b9a 100644 --- a/pull_repositories.ps1 +++ b/pull_repositories.ps1 @@ -8,7 +8,17 @@ if (([string]::IsNullOrEmpty($Env:ROS_DISTRO))) $ros2cs_repos = Join-Path -Path $scriptPath -ChildPath "\ros2cs.repos" $custom_repos = Join-Path -Path $scriptPath -ChildPath "\ros2_for_unity_custom_messages.repos" + +Write-Host "=========================================" +Write-Host "* Pulling ros2cs repository:" vcs import --input $ros2cs_repos + +Write-Host "" +Write-Host "=========================================" +Write-Host "Pulling custom repositories:" vcs import --input $custom_repos +Write-Host "" +Write-Host "=========================================" +Write-Host "Pulling ros2cs dependencies:" & "$scriptPath/src/ros2cs/get_repos.ps1" diff --git a/pull_repositories.sh b/pull_repositories.sh index dab3226..a0d42f2 100755 --- a/pull_repositories.sh +++ b/pull_repositories.sh @@ -8,8 +8,18 @@ if [ -z "${ROS_DISTRO}" ]; then exit 1 fi +echo "=========================================" +echo "* Pulling ros2cs repository:" vcs import < "ros2cs.repos" + +echo "" +echo "=========================================" +echo "Pulling custom repositories:" vcs import < "ros2_for_unity_custom_messages.repos" + +echo "" +echo "=========================================" +echo "Pulling ros2cs dependencies:" cd "$SCRIPTPATH/src/ros2cs" ./get_repos.sh cd - diff --git a/ros2_for_unity_custom_messages.repos b/ros2_for_unity_custom_messages.repos index 7ddcbef..f385d76 100644 --- a/ros2_for_unity_custom_messages.repos +++ b/ros2_for_unity_custom_messages.repos @@ -1,7 +1,7 @@ # NOTE: Use this file if you want to build with custom messages that reside in a separate remote repo. # NOTE: use the following format -#repositories: +repositories: # src/ros2cs/custom_messages/: # type: git # url: