Skip to content

Commit ae62f2f

Browse files
authored
Merge pull request #34 from RobotecAI/fixes_and_improvements
Fixes and improvements
2 parents 6dc8983 + e115312 commit ae62f2f

7 files changed

+57
-17
lines changed

README-WINDOWS.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ It is necessary to complete all the steps for `ros2cs` [Prerequisites](https://g
1919
* Source your ROS2 installation (`C:\dev\ros2_foxy\local_setup.ps1`) in the terminal before you proceed.
2020
* Run `pull_repositories.ps1`. This will pull `ros2cs` as well as your custom messages. You might be asked for github credentials.
2121
* Run `build.ps1` script.
22-
* Optionally, you can build tests by adding `--with-tests` argument to `build` command.
23-
* You can build with `--clean-install` to make sure your installation directory is cleaned before deploying.
22+
* Optionally, you can build tests by adding `-with_tests` argument to `build` command.
23+
* You can build with `-clean_install` to make sure your installation directory is cleaned before deploying.
2424
* This ivokes `colcon_build` with `--merge-install` argument to simplify libraries installation.
2525
* 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).
2626
* It prepares Unity Asset that is ready to import into your Unity project (`install/asset/` directory).
27-
* By default, build process generates standalone libraries on Windows.
28-
You can disable this feature by setting CMake option `STANDALONE_BUILD` to `OFF` (e.g. through editing `build.ps1`).
27+
* Currently Windows OS supports standalone build only.
2928
* In order to generate `Ros2ForUnity.unitypackage` please run `create_unity_package.ps1`. Please provide path to your Unity executable when prompted.
3029
* Asset can be found in `install\unity_package` directory
3130
* 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
6968

7069
## OS-Specific usage remarks
7170

72-
> If the Asset is built with `STANDALONE_BUILD` option set to `1` (the default), then nothing extra needs to be done.
71+
> If the Asset is built with `-standalone` flag (the default), then nothing extra needs to be done.
7372
Otherwise, you have to source your ros distribution before launching either Unity3D Editor or Application.
7473

75-
> Note that after you build the Asset, you can use it on a machine that has no ros2 installation (if built with `STANDALONE_BUILD`).
74+
> Note that after you build the Asset, you can use it on a machine that has no ros2 installation (if built with `-standalone`).
7675
7776
> You can simply copy over the `Ros2ForUnity` subdirectory to update your Asset.

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ Supported ROS2 distributions:
2020
- Foxy
2121
- Galactic
2222

23-
Tested Unity3D version: 2021.1.7f1.
23+
Supported Unity3d:
24+
- 2020+
2425

25-
For Windows only, this asset can be prepared in two flavors:
26-
- 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.
27-
- overlay (assuming existing (supported) ROS2 installation on target machine). Only asset libraries and generated messages are installed.
26+
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.
27+
28+
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.
29+
30+
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.
2831

2932
## Releases
3033

create_unity_package.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,20 @@ if(-Not (Test-Path -Path "$output_dir")) {
4343
& "$unity_path" -version | Tee-Object -Variable unity_version | Out-Null
4444

4545
if ($unity_version -match '^[0-9]{4}\.[0-9]*\.[0-9]*[f]?[0-9]*$') {
46-
Write-Host "Unity editor confirmed..."
46+
Write-Host "Unity editor confirmed."
4747
} else {
48-
Write-Host "Can't confirm Unity editor. Exiting."
49-
exit 1
48+
while (1) {
49+
$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"
50+
if ($confirmation -eq 'y' -or $confirmation -eq 'Y') {
51+
break;
52+
} elseif ( $confirmation -eq 'n' -or $confirmation -eq 'N' ) {
53+
exit 1;
54+
} else {
55+
Write-Host "Please answer [y]es or [n]o.";
56+
}
57+
}
5058
}
59+
Write-Host "Using ${unity_path} editor."
5160

5261
$tmp_project_path = Join-Path -Path "$temp_dir" -ChildPath "\ros2cs_unity_project\$unity_version"
5362

create_unity_package.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,21 @@ UNITY_VERSION=`$UNITY_PATH -version`
7171

7272
# Test if unity editor is valid
7373
if [[ $UNITY_VERSION =~ ^[0-9]{4}\.[0-9]*\.[0-9]*[f]?[0-9]*$ ]]; then
74-
echo "Unity editor confirmed..."
74+
echo "Unity editor confirmed."
7575
else
76-
echo "Can't confirm Unity editor. Exiting."
77-
exit 1
76+
while true; do
77+
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
78+
yn=${yn:-"n"}
79+
case $yn in
80+
[Yy]* ) break;;
81+
[Nn]* ) exit 1;;
82+
* ) echo "Please answer [y]es or [n]o.";;
83+
esac
84+
done
7885
fi
7986

87+
echo "Using \"${UNITY_PATH}\" editor."
88+
8089
TMP_PROJECT_PATH=/tmp/ros2cs_unity_project/$UNITY_VERSION
8190
# Create temp project
8291
if [ -d "$TMP_PROJECT_PATH" ]; then

pull_repositories.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ if (([string]::IsNullOrEmpty($Env:ROS_DISTRO)))
88

99
$ros2cs_repos = Join-Path -Path $scriptPath -ChildPath "\ros2cs.repos"
1010
$custom_repos = Join-Path -Path $scriptPath -ChildPath "\ros2_for_unity_custom_messages.repos"
11+
12+
Write-Host "========================================="
13+
Write-Host "* Pulling ros2cs repository:"
1114
vcs import --input $ros2cs_repos
15+
16+
Write-Host ""
17+
Write-Host "========================================="
18+
Write-Host "Pulling custom repositories:"
1219
vcs import --input $custom_repos
1320

21+
Write-Host ""
22+
Write-Host "========================================="
23+
Write-Host "Pulling ros2cs dependencies:"
1424
& "$scriptPath/src/ros2cs/get_repos.ps1"

pull_repositories.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@ if [ -z "${ROS_DISTRO}" ]; then
88
exit 1
99
fi
1010

11+
echo "========================================="
12+
echo "* Pulling ros2cs repository:"
1113
vcs import < "ros2cs.repos"
14+
15+
echo ""
16+
echo "========================================="
17+
echo "Pulling custom repositories:"
1218
vcs import < "ros2_for_unity_custom_messages.repos"
19+
20+
echo ""
21+
echo "========================================="
22+
echo "Pulling ros2cs dependencies:"
1323
cd "$SCRIPTPATH/src/ros2cs"
1424
./get_repos.sh
1525
cd -

ros2_for_unity_custom_messages.repos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NOTE: Use this file if you want to build with custom messages that reside in a separate remote repo.
22
# NOTE: use the following format
33

4-
#repositories:
4+
repositories:
55
# src/ros2cs/custom_messages/<package_name>:
66
# type: git
77
# url: <repo_url>

0 commit comments

Comments
 (0)