Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into pj/docs_ros2_configur…
Browse files Browse the repository at this point in the history
…ation_policies

Signed-off-by: Piotr Jaroszek <[email protected]>
  • Loading branch information
pijaro committed Nov 30, 2023
2 parents 20c2f08 + 7a06f8c commit 6f9d9a2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
10 changes: 8 additions & 2 deletions Assets/RGLUnityPlugin/Scripts/LowLevelWrappers/RGLNativeAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,14 @@ public static extern int rgl_node_points_udp_publish(
static RGLNativeAPI()
{
string ros2SourcedCodename = Environment.GetEnvironmentVariable("ROS_DISTRO");
string ros2BuildType = string.IsNullOrEmpty(ros2SourcedCodename) ? "standalone" : "sourced";
Debug.Log($"RGL uses {ros2BuildType} ROS version.");
bool isRos2Sourced = !string.IsNullOrEmpty(ros2SourcedCodename);
if (isRos2Sourced)
{
Debug.LogError(
"You should not source ROS2 in 'RobotecGPULidar' standalone build. " +
"RGLUnityPlugin might not work correctly."
);
}

try
{
Expand Down
5 changes: 4 additions & 1 deletion docs/Components/ROS2/ROS2ForUnity/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ All required dependencies are installed and can be used e.g. as a complete set o
Only asset libraries and generated messages are installed therefore *ROS2* instance must be sourced.

By default, asset `R2FU` in *AWSIM* is prepared in *standalone mode*.
Thanks to this, *ROS2* instance doesn't need to be sourced - all you have to do is run the *Unity* editor.

!!! warning

To avoid internal conflicts between the standalone libraries, and sourced ones, *ROS2* instance shouldn't be sourced before running AWSIM or the *Unity* Editor.

!!! question "Can't see topics"
There are no errors but I can't see topics published by `R2FU`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ The following section describes Unity Editor components settings.
| Ego Vehicle | Transform of ego vehicle |
| Vehicle Layer Mask | LayerMask that masks only vehicle(NPC and ego) colliders |
| Ground Layer Mask | LayerMask that masks only ground colliders of the map |
| Culling Distance | Distance at which NPCs are culled relative to EgoVehicle |
| Culling Hz | Culling operation cycle |
| **NPC Vehicle Settings** | |
| Max Vehicle Count | Maximum number of NPC vehicles to be spawned in simulation|
| NPC Prefabs | Prefabs representing controlled vehicles.<br/> They must have `NPCVehicle` component attached. |
Expand Down
38 changes: 28 additions & 10 deletions docs/GettingStarted/SetupUnityProject/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ This page is a tutorial for setting up a AWSIM Unity project.
2. Prepare a desktop PC with Windows 10 or 11 (64 bit) installed.
3. Install [git](https://git-scm.com/).

### ROS 2

AWSIM comes with a *standalone* flavor of [`Ros2ForUnity`](../../Components/ROS2/ROS2ForUnity/index.md). This means that, to avoid internal conflicts between different ROS 2 versions, you shouldn't run the Editor or AWSIM binary with ROS 2 sourced.

!!! warning

Do not run the AWSIM, Unity Hub, or the Editor with ROS 2 sourced.

=== "Ubuntu 22"
- Make sure that the terminal which you are using to run Unity Hub, Editor, or AWSIM doesn't have ROS 2 sourced.
- It is common to have ROS 2 sourced automatically with `~/.bashrc` or `~/.profile`. Make sure it is not obscuring your working environment:
- Running Unity Hub from the Ubuntu GUI menu takes the environment configuration from `~/.profile`.
- Running Unity Hub from the terminal uses the current terminal configuration from `~/.profile` and `~/.bashrc`.
- Running Unity Editor from the UnityHub inherits the environment setup from the Unity Hub.

=== "Windows"
- Make sure your Windows environment variables are ROS 2 free.

### Unity installation

!!! info
Expand Down Expand Up @@ -78,7 +96,7 @@ Follow the steps below to install Unity on your machine:
To open the Unity AWSIM project in Unity Editor:

=== "Using Unity Hub"
1. Make sure you have the AWSIM repository cloned
1. Make sure you have the AWSIM repository cloned and ROS 2 is not sourced.
```
git clone [email protected]:tier4/AWSIM.git
```
Expand All @@ -93,21 +111,21 @@ To open the Unity AWSIM project in Unity Editor:
If you are launching the Unity Hub from the Ubuntu applications menu (without the terminal), make sure that system optimizations are set. To be sure, run the terminal at least once before running the Unity Hub. This will apply the OS settings.

3. Open the project in UnityHub
- Click the `Open` button
![](image_6.png)
- Click the `Open` button
![](image_6.png)

- Navigate the directory where the AWSIM repository was cloned to
![](image_7.png)
- Navigate the directory where the AWSIM repository was cloned to
![](image_7.png)

- The project should be added to `Projects` tab in Unity Hub. To launch the project in Unity Editor simply click the `AWSIM` item
![](image_8.png)
- The project should be added to `Projects` tab in Unity Hub. To launch the project in Unity Editor simply click the `AWSIM` item
![](image_8.png)

- The project is now ready to use
![](image_9.png)
- The project is now ready to use
![](image_9.png)

=== "Using Terminal"

1. Enter the AWSIM directory
1. Enter the AWSIM directory (make sure ROS 2 is not sourced).
```
cd AWSIM
```
Expand Down

0 comments on commit 6f9d9a2

Please sign in to comment.