You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README-UBUNTU.md
+44-10Lines changed: 44 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,48 @@ This readme contains information specific to Ubuntu 20.04. For general informati
4
4
5
5
## Building
6
6
7
+
We assume that working directory is `~/ros2-for-unity` and we are using `ROS2 galactic` (replace with `foxy` or `humble` where applicable).
8
+
7
9
### Prerequisites
8
10
9
11
Start with installation of dependencies. Make sure to complete each step of `ros2cs`[Prerequisites section](https://github.com/RobotecAI/ros2cs/blob/master/README-UBUNTU.md#prerequisites).
10
12
11
13
### Steps
12
14
13
-
* Clone this project.
14
-
* You need to source your ROS2 installation (`source /opt/ros/foxy/setup.bash`) before you proceed, for each new open terminal. It is convenient to include this command in your `~/.profile` file.
15
-
* Run `pull_repositories.sh`. This will pull `ros2cs` as well as your custom messages. You might be asked for gitlab credentials. Remember to **pull this repository with each update** (e.g. with `vcs pull`).
16
-
* Run `build.sh` script.
17
-
* You can build tests by adding `--with-tests` argument to `build` command.
18
-
* You can build with `--clean-install` to make sure your installation directory is cleaned before deploying.
19
-
* It invokes `colcon_build` with `--merge-install` argument to simplify libraries installation.
20
-
* 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).
21
-
* It prepares Unity Asset that is ready to import into your Unity project (`install/asset/` directory).
22
-
* Run `create_unity_package.sh -u <your-path-to-unity-editor-executable>` to generate .unitypackage file in `install/unity_package`
* You need to source your ROS2 installation before you proceed, foreach new open terminal. It is convenient to include this commandin your `~/.profile` file.
20
+
```bash
21
+
# galactic
22
+
. /opt/ros/galactic/setup.bash
23
+
```
24
+
* Enter `Ros2ForUnity` working directory.
25
+
```bash
26
+
cd~/ros2-for-unity
27
+
```
28
+
* Set up you custom messages in`ros2_for_unity_custom_messages.repos`
29
+
* Import necessary and custom messages repositories.
30
+
```bash
31
+
./pull_repositories.sh
32
+
```
33
+
>*NOTE*`pull_repositories.sh` script doesn't update already existing repositories, you have to remove `src/ros2cs` folder to re-import new versions.
34
+
* Build `Ros2ForUnty`. You can build it in standalone or overlay mode.
35
+
```bash
36
+
# standalone mode
37
+
./build.sh --standalone
38
+
39
+
# overlay mode
40
+
./build.sh
41
+
```
42
+
* You can add `--clean-install` flag to make sure your installation directory is cleaned before deploying.
43
+
* Unity Asset is ready to import into your Unity project. You can find it in `install/asset/` directory.
44
+
* (optionally) To create `.unitypackage` in `install/unity_package`
@@ -30,5 +56,13 @@ Running Unity Editor through Unity Hub is also supported.
30
56
31
57
## Usage troubleshooting
32
58
59
+
**No ROS environment sourced. You need to source your ROS2 (..)**
60
+
33
61
* If you see `"No ROS environment sourced. You need to source your ROS2 (..)"` message in Unity3D Editor, it means your environment was not sourced properly. This could happen if you run Unity but it redirects to Hub and ignores your console environment variables (this behavior can depend on Unity3D version). In such case, run project directly with `-projectPath` or add ros2 sourcing to your `~/.profile` file (you need to re-log for it to take effect).
62
+
34
63
* Keep in mind that `UnityHub` stays in the background after its first launch and Unity Editor launch without `-projectPath` will redirect to it and the Hub will start Unity Editor. Since environment variables for the process are set on launch and inherited by child processes, your sourced ros2 environment in the console launching the Editor this way won't be applied. To make sure it applies (and to change between different ros2 distributions), make sure to terminate existing UnityHub process and run it with the correct ros2 distribution sourced.
64
+
65
+
**There are no errors but I can't see topics published by Ros2ForUnity**
66
+
67
+
* Make sure your dds config is correct.
68
+
* Sometimes ROS2 daemon brakes up when changing network interfaces or ROS2 version. Try to stop it forcefully (`pkill -9 _ros2_daemon`) and restart (`ros2 daemon start`).
Copy file name to clipboardExpand all lines: README-WINDOWS.md
+34-17Lines changed: 34 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# ROS2 For Unity - Windows 10
2
2
3
-
This readme contains information specific to Window 10. For general information, please see README.md
3
+
This readme contains information specific to Window 10. For general information, please see [README.md](README.md).
4
4
5
5
## Building
6
6
7
-
We assume working directory is `C:\dev` and we are using `ROS2 foxy` (replace with `Galactic` where applicable).
7
+
We assume that working directory is `C:\dev` and we are using `ROS2 galactic` (replace with `foxy` or `humble` where applicable).
8
8
9
9
### Prerequisites
10
10
@@ -15,22 +15,39 @@ It is necessary to complete all the steps for `ros2cs` [Prerequisites](https://g
15
15
* Make sure [long paths on Windows are enabled](https://github.com/RobotecAI/ros2cs/blob/master/README-WINDOWS.md#important-notices)
16
16
* Make sure you open [`Developer PowerShell for VS` with administrator privileges](https://github.com/RobotecAI/ros2cs/blob/master/README-WINDOWS.md#important-notices)
17
17
* For `ros2 galactic` distribution, it is best to [create a `C:\ci\ws\install\include` directory](https://github.com/RobotecAI/ros2cs/blob/master/README-WINDOWS.md#important-notices)
* Source your ROS2 installation (`C:\dev\ros2_foxy\local_setup.ps1`) in the terminal before you proceed.
20
-
* Run `pull_repositories.ps1`. This will pull `ros2cs` as well as your custom messages. You might be asked for github credentials.
21
-
* Run `build.ps1` script.
22
-
* Optionally, you can build tests by adding `-with_tests` argument to `build` command.
23
+
```
24
+
C:\dev\ros2_foxy\local_setup.ps1
25
+
```
26
+
* Enter `Ros2ForUnity` working directory.
27
+
```powershell
28
+
cd C:\dev\ros2-for-unity
29
+
```
30
+
* Set up you custom messages in `ros2_for_unity_custom_messages.repos`
31
+
* Import necessary and custom messages repositories.
32
+
```powershell
33
+
.\pull_repositories.ps1
34
+
```
35
+
> *NOTE* `pull_repositories.ps1` script doesn't update already existing repositories, you have to remove `src\ros2cs` folder to re-import new versions.
36
+
* Build `Ros2ForUnty`. You can build it in standalone or overlay mode.
37
+
```powershell
38
+
# standalone mode
39
+
./build.ps1 -standalone
40
+
41
+
# overlay mode
42
+
./build.ps1
43
+
```
23
44
* You can build with `-clean_install` to make sure your installation directory is cleaned before deploying.
24
-
* This ivokes `colcon_build` with `--merge-install` argument to simplify libraries installation.
25
-
* 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).
26
-
* It prepares Unity Asset that is ready to import into your Unity project (`install/asset/` directory).
27
-
* Currently Windows OS supports standalone build only.
28
-
* In order to generate `Ros2ForUnity.unitypackage` please run `create_unity_package.ps1`. Please provide path to your Unity executable when prompted.
29
-
* Asset can be found in `install\unity_package` directory
30
-
* 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.
31
-
* At this moment you have two valid forms of the Asset.
32
-
* One is available as `src\Ros2ForUnity` folder which you can simply copy to Unity3D `Assets` directory.
33
-
* Second one is `Ros2ForUnity.unitypackage` which you can import in Unity3D.
45
+
* Unity Asset is ready to import into your Unity project. You can find it in `install/asset/` directory.
46
+
* (optionally) To create `.unitypackage` in `install/unity_package`
47
+
```powershell
48
+
create_unity_package.ps1
49
+
```
50
+
> *NOTE* Please provide path to your Unity executable when prompted. Unity license is required. 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.
34
51
35
52
## Build troubleshooting
36
53
@@ -59,7 +76,7 @@ Please execute `Set-ExecutionPolicy Bypass -Scope Process` in PS shell session t
Copy file name to clipboardExpand all lines: README.md
+91-14Lines changed: 91 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Advantages of this module include:
6
6
- High performance - higher throughput and considerably lower latencies comparing to bridging solutions.
7
7
- Your simulation entities are real ROS2 nodes / publishers / subscribers. They will behave correctly with e.g. command line tools such as `ros2 topic`. They will respect QoS settings and can use ROS2 native time.
8
8
- The module supplies abstractions and tools to use in your Unity project, including transformations, sensor interface, a clock, spinning loop wrapped in a MonoBehavior, handling initialization and shutdown.
9
-
- Supports all standard ROS2 messages
9
+
- Supports all standard ROS2 messages.
10
10
- Custom messages are generated automatically with build, using standard ROS2 way. It is straightforward to generate and use them without having to define `.cs` equivalents by hand.
11
11
- The module is wrapped as a Unity asset.
12
12
@@ -16,18 +16,22 @@ Supported OSes:
16
16
- Ubuntu 20.04 (bash)
17
17
- Windows 10 (powershell)
18
18
19
+
> **Notice:** Currently, ros2 humble is only supported on Ubuntu 20.04. You have to build it from sources since it is not available in `apt`.
20
+
19
21
Supported ROS2 distributions:
20
22
- Foxy
21
23
- Galactic
24
+
- Humble
22
25
23
26
Supported Unity3d:
24
27
- 2020+
25
28
26
29
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
30
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.
31
+
This asset can be prepared in two flavours:
29
32
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.
33
+
- standalone mode, where 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.
34
+
- overlay mode, where the ROS2 installation is required on target machine. Only asset libraries and generated messages are installed therefore ROS2 instance must be sourced.
31
35
32
36
## Releases
33
37
@@ -37,25 +41,98 @@ You can download pre-built [releases](https://github.com/RobotecAI/ros2-for-unit
37
41
38
42
## Building
39
43
40
-
Note: The project will pull `ros2cs` into the workspace, which also functions independently as it is a more general project aimed at any `C# / .Net` environment.
44
+
> **Note:** The project will pull `ros2cs` into the workspace, which also functions independently as it is a more general project aimed at any `C# / .Net` environment.
41
45
It has its own README and scripting, but for building the Unity Asset, please use instructions and scripting in this document instead, unless you also wish to run tests or examples for `ros2cs`.
42
46
43
47
Please see OS-specific instructions:
44
48
-[Instructions for Ubuntu 20.04](README-UBUNTU.md)
45
49
-[Instructions for Windows 10](README-WINDOWS.md)
46
50
47
-
## Usage
51
+
## Custom messages
52
+
53
+
Custom messages can be included in the build by either:
54
+
* list them in `ros2_for_unity_custom_messages.repos` file, or
55
+
* manually inserting them in `src/ros2cs` directory. If the folder doesn't exist, you must pull repositories first (see building steps for each OS).
48
56
49
-
1. Perform building steps described in the OS-specific readme or download pre-built Unity package. Do not source ros2-for-unity nor ros2cs.
50
-
2. Open or create Unity project.
51
-
3. Go to Assets in the menu bar (at the top of the Unity Window).
52
-
4. Select `Import Package` → `Custom Package`. Make sure that the asset name is Ros2ForUnity and it is directly in the Assets folder.
53
-
5. In the file browser, select the .unitypackage file built by `create_unity_package` script (by default located in `install/unity_package`) and follow the instructions on the screen.
54
-
6. Create a top-level object containing `ROS2UnityComponent.cs`. This is the central Monobehavior for `ROS2 For Unity` that manages all the nodes. Refer to class documentation for details.
55
-
7. Add example script to any object in the hierarchy tab, e.g. by dragging `ROS2TalkerExample.cs` to the object in the inspector tab.
56
-
8. Select another object in the hierarchy tab and add repeat the previous step using `ROS2ListenerExample.cs`.
57
-
9. Once you start the project in Unity, you should be able to see two nodes talking with each other in Unity Editor's console or use `ros2 node list` and `ros2 topic echo /chatter` to verify ros2 communication.
57
+
## Installation
58
+
59
+
1. Perform building steps described in the OS-specific readme or download pre-built Unity package. Do not source `ros2-for-unity` nor `ros2cs` project into ROS2 workspace.
60
+
1. Open or create Unity project.
61
+
1. Import asset into project:
62
+
1. copy `install/asset/Ros2ForUnity` into your project `Assets` folder, or
63
+
1. if you have deployed an `.unitypackage` - import it in Unity Editor by selecting `Import Package` → `Custom Package`
64
+
65
+
## Usage
58
66
67
+
**Prerequisites**
68
+
69
+
* If your build was prepared with `--standalone` flag then you are fine, and all you have to do is run the editor
70
+
71
+
otherwise
72
+
73
+
* source ROS2 which matches the `Ros2ForUnity` version, then run the editor from within the very same terminal/console.
74
+
75
+
**Initializing Ros2ForUnity**
76
+
77
+
1. Initialize `Ros2ForUnity` by creating a "hook" object which will be your wrapper around ROS2. You have two options:
78
+
1.`ROS2UnityComponent` based on `MonoBehaviour` which must be attached to a `GameObject` somewhere in the scene, then:
79
+
```c#
80
+
usingROS2;
81
+
...
82
+
// Example method of getting component, if ROS2UnityComponent lives in different GameObject, just use different get component methods.
> **Note:**Eachexamplescriptlooksfor `ROS2UnityComponent` in its own game object. However, this is not a requirement, just example implementation.
135
+
1. Once you start the project in Unity, you should be able to see two nodes talking with each other in Unity Editor's console or use `ros2 node list` and `ros2 topic echo /chatter` to verify ros2 communication.
59
136
## Acknowledgements
60
137
61
138
Open-source release of ROS2 For Unity was made possible through cooperation with [Tier IV](https://tier4.jp). Thanks to encouragement, support and requirements driven by Tier IV the project was significantly improved in terms of portability, stability, core structure and user-friendliness.
0 commit comments