Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions README-WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 12 additions & 3 deletions create_unity_package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
15 changes: 12 additions & 3 deletions create_unity_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions pull_repositories.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
10 changes: 10 additions & 0 deletions pull_repositories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
2 changes: 1 addition & 1 deletion ros2_for_unity_custom_messages.repos
Original file line number Diff line number Diff line change
@@ -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/<package_name>:
# type: git
# url: <repo_url>
Expand Down