Update docs

This commit is contained in:
Yu Asabe 2022-10-30 20:55:36 +09:00
parent a292fed2e0
commit f0485aa61e
11 changed files with 165 additions and 21 deletions

View File

@ -9,9 +9,10 @@ In order to run the simulations explained in the [Tutorials](/tutorials) section
For the newest documentation for the Docker installation of Autoware, see their [official documentation](https://autowarefoundation.github.io/autoware-documentation/main/installation/autoware/docker-installation/). For the newest documentation for the Docker installation of Autoware, see their [official documentation](https://autowarefoundation.github.io/autoware-documentation/main/installation/autoware/docker-installation/).
In a nutshell, the following commands should work: ### Setup
```bash ```bash
mkdir -p ~/workspace && cd ~/workspace
git clone https://github.com/autowarefoundation/autoware.git autoware_docker git clone https://github.com/autowarefoundation/autoware.git autoware_docker
cd autoware_docker cd autoware_docker
@ -19,29 +20,34 @@ cd autoware_docker
./setup-dev-env.sh docker ./setup-dev-env.sh docker
# Make directory to store maps # Make directory to store maps
mkdir ~/autoware_map mkdir -p ~/data/maps
```
### Launch container
```
# Launch Autoware container (with NVIDIA GPU) # Launch Autoware container (with NVIDIA GPU)
rocker --nvidia --x11 --user --volume $HOME/autoware_docker --volume $HOME/autoware_map -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda rocker --nvidia --x11 --user --privileged --volume $HOME/workspace/autoware_docker --volume $HOME/data -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda
# Launch Autoware container (without NVIDIA GPU) # Launch Autoware container (without NVIDIA GPU)
rocker -e LIBGL_ALWAYS_SOFTWARE=1 --x11 --user --volume $HOME/autoware_docker --volume $HOME/autoware_map -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda rocker -e LIBGL_ALWAYS_SOFTWARE=1 --x11 --user --privileged --volume $HOME/workspace/autoware_docker --volume $HOME/data -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda
``` ```
## Adding AutowareV2X ## Adding AutowareV2X
From here, run commands inside the container. !!! Note
From here, run commands inside the container.
1. Move into `autoware_docker` directory. 1. Move into `autoware_docker` directory.
```bash ```bash
cd autoware_docker cd ~/workspace/autoware_docker
``` ```
2. Edit the `autoware.repos` file and add the following two repositories to the end. 2. Edit the `autoware.repos` file and add the following two repositories to the end.
``` ```
v2x/autoware_v2x: v2x/autowarev2x:
type: git type: git
url: git@github.com:tlab-wide/autoware_v2x.git url: git@github.com:tlab-wide/AutowareV2X.git
version: main version: main
v2x/vanetza: v2x/vanetza:
type: git type: git
@ -61,7 +67,7 @@ vcs pull src
```bash ```bash
sudo apt update sudo apt update
rosdep update rosdep update
rosdep install --from-paths . --ignore-src --rosdistro $ROS_DISTRO rosdep install --from-paths . --ignore-src --rosdistro $ROS_DISTRO -r
``` ```
5. Build the workspace 5. Build the workspace

View File

@ -0,0 +1,4 @@
nav:
- index.md
- rosbag-and-analysis.md
- network-emulation.md

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

View File

@ -1,16 +1,17 @@
# Running AutowareV2X in the Planning Simulator # Running AutowareV2X in the Planning Simulator
Simulations can be an easy way of verifying the functionality of AutowareV2X before an actual field test. Simulations can be an easy way of verifying the functionality of AutowareV2X before an actual field test.
We will use [Autoware's Planning Simulator](https://autowarefoundation.github.io/autoware-documentation/main/tutorials/ad-hoc-simulation/planning-simulation/) here and add connectivity to it with AutowareV2X.
AutowareV2X can be run in a simulation environment using [Autoware's Planning Simulator](https://autowarefoundation.github.io/autoware-documentation/main/tutorials/ad-hoc-simulation/planning-simulation/). An ITS-S is composed of Autoware as the autonomous driving stack and AutowareV2X as its V2X communication stack. Each ITS-S is executed inside a Docker container, and the wireless communication medium between ITS-Ss are modeled with Docker networks. A dynamic ITS-S is defined as a CAV, while a static ITS-S is considered a RSU. Perceived Objects are sent out on the network as CPMs.
!!! Note !!! Note
Make sure you have completed [Autoware's Planning Simulator Tutorial](https://autowarefoundation.github.io/autoware-documentation/main/tutorials/ad-hoc-simulation/planning-simulation/) before continuing. Make sure you have completed [Autoware's Planning Simulator Tutorial](https://autowarefoundation.github.io/autoware-documentation/main/tutorials/ad-hoc-simulation/planning-simulation/) before continuing.
Here, since we want to test both the sending and receiving of information through AutowareV2X, we will need at least two AutowareV2X instances. For this, we will use a Docker-based environment. In order to test both the sender and receiver functionalities, we will need at least two ITS-S instances.
## The Docker environment to create ## The Docker environment to create
We will be creating the Docker environment as depicted in the figure below. There will be two Docker containers, each of which includes Autoware.universe and AutowareV2X. They will both be a part of the Docker network called `v2x_net` with the subnet `10.0.0.0/24`. We will be creating the Docker environment as depicted in the figure below. There will be two Docker containers to represent the two ITS-Ss, each of which includes Autoware.universe and AutowareV2X. They will both be a part of the Docker network called `v2x_net` with the subnet `10.0.0.0/24`. "Autoware Container #1" and "Autoware Container #2" will be described as `autoware_1` and `autoware_2` respectively.
![Docker Environment](./docker-env.png) ![Docker Environment](./docker-env.png)
@ -21,31 +22,121 @@ docker network create --driver=bridge --subnet=10.0.0.0/24 v2x_net -o com.docker
``` ```
### Launch two Autoware containers ### Launch two ITS-S containers
In one terminal, use rocker to launch container `autoware_1`:
```bash ```bash
# In one terminal, use rocker to launch container "autoware_1" rocker --nvidia --x11 --user --privileged --volume $HOME/workspace/autoware_docker --volume $HOME/data --network=v2x_net --name autoware_1 --oyr-run-arg "--ip 10.0.0.2 --hostname autoware_1" -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda
rocker --nvidia --x11 --user --volume $HOME/autoware_docker --volume $HOME/autoware_map --network=v2x_net --ip 10.0.0.2 --name autoware_1 --hostname autoware_1 -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda ```
# In another terminal, use rocker to launch container "autoware_2" In another terminal, use rocker to launch container `autoware_2`:
rocker --nvidia --x11 --user --volume $HOME/autoware_docker --volume $HOME/autoware_map --network=v2x_net --ip 10.0.0.3 --name autoware_2 --hostname autoware_2 -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda ```
rocker --nvidia --x11 --user --privileged --volume $HOME/workspace/autoware_docker --volume $HOME/data --network=v2x_net --name autoware_2 --oyr-run-arg "--ip 10.0.0.3 --hostname autoware_2" -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda
``` ```
## Run Planning Simulator ## Run Planning Simulator
Run the Planning Simulator in both `autoware_1` and `autoware_2`. Run the Planning Simulator in both `autoware_1` and `autoware_2`.
In `autoware_1`:
``` ```
cd ~/workspace/autoware_docker
source ~/autoware_docker/install/setup.bash source ~/autoware_docker/install/setup.bash
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/autoware_map/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit export AWID=1 # autoware_1
source ~/workspace/autoware_docker/src/v2x/autowarev2x/setup.sh
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/data/maps/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
```
Also, in `autoware_1`, set the ego-vehicle position by clicking `2D Pose Estimate`.
Try adding some dummy cars by clicking `2D Dummy Car`.
Note that you can make the dummy cars to be static by changing its `Velocity` to `0` in the `Tool Properties` pane.
![](./tools-properties.png)
In `autoware_2`:
```
cd ~/workspace/autoware_docker
source ~/autoware_docker/install/setup.bash
export AWID=2 # autoware_2
source ~/workspace/autoware_docker/src/v2x/autowarev2x/setup.sh
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/data/maps/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
``` ```
## Run AutowareV2X ## Run AutowareV2X
In another terminal, connect to the `autoware_1` and `autoware_2` containers, and start AutowareV2X in both of them. In another terminal, connect to the `autoware_1` and `autoware_2` containers, and start AutowareV2X in both of them. We will set `autoware_1` to be the CPM sender, and `autoware_2` to be the CPM receiver.
In `autoware_1`:
``` ```
source ~/autoware_docker/install/setup.bash docker exec -it autoware_1 bash
ros2 launch autoware_v2x v2x.launch.xml network_interface:=eth1 sudo su
cd ~/workspace/autoware_docker
source ~/workspace/autoware_docker/install/setup.bash
export AWID=1
source ./src/v2x/autowarev2x/setup.sh
ros2 launch autoware_v2x v2x.launch.xml network_interface:=eth0
```
You should see the command output like below.
It shows that you are "Sending CPM with n objects", and the `[objectsList]` line describes the following information: `cpm_num, objectID, object.uuid, object.to_send, object.to_send_trigger`.
![](./autowarev2x_sender.png)
In `autoware_2`:
```
docker exec -it autoware_2 bash
sudo su
cd ~/workspace/autoware_docker
source ~/workspace/autoware_docker/install/setup.bash
export AWID=2
source ./src/v2x/autowarev2x/setup.sh
ros2 launch autoware_v2x v2x.launch.xml network_interface:=eth0 is_sender:=false
```
When both the sender and receiver is launched, you should see that the receiver (`autoware_2`) will start receiving CPMs like below.
![](./autowarev2x_receiver.png)
## Show CPM-shared objects in RViz
1. Press "Add" from the Displays Panel
![](./add-v2x-rviz-1.png)
2. Choose "By topic", then select PredictedObjects from /v2x/cpm/objects
![](./add-v2x-rviz-2.png)
3. The CPM-shared objects are shown in Rviz!
![](./add-v2x-rviz-3.png)
## Run scenarios
In order to run scenarios, the [scenario_simulator_v2](https://github.com/tier4/scenario_simulator_v2.git) must be installed:
1. Launch new Autoware container
```
rocker --nvidia --x11 --user --volume $HOME/workspace/autoware_docker --volume $HOME/data -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda
```
2. Add `simulator.repos`
```
cd workspace/autoware_docker
vcs import src < simulator.repos
```
3. Install dependent ROS packages
```
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -r
```
4. Rebuild workspace
```
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
```
5. Download scenario.
```bash
gdown -O ~/data/scenarios/ 'https://drive.google.com/uc?id=1FXwSSWeFDTMz7qsG-J7pyJA6RgjksqCy'
```
6. Launch `scenario_test_runner` and specify scenario.
```
ros2 launch scenario_test_runner scenario_test_runner.launch.py map_path:=$HOME/data/maps/sample-map-planning sensor_model:=sample_sensor_kit vehicle_model:=sample_vehicle scenario:=$HOME/data/scenarios/busy_kashiwa_scenario.yaml launch_autoware:=true
``` ```

View File

@ -0,0 +1,20 @@
# Network Emulation
The `tc` command can be used within the Docker container to emulate various network parameters.
In `autoware_1` for example, use `tc` to add a delay of 100ms.
```
sudo tc qdisc add dev eth0 root netem delay 100ms
```
To remove delay, simply:
```
sudo tc qdisc delete dev eth0 root netem delay 100ms
```
To show all qdisc:
```
sudo tc qdisc show
```
Documentation about [tc-netem](https://man7.org/linux/man-pages/man8/tc-netem.8.html).

View File

@ -0,0 +1,23 @@
# Recording Rosbag and Tcpdump for Analysis
## Record both rosbag and tcpdump
In `autoware_1`:
```
cd ~/workspace/autoware_docker
ros2 bag record -o test_sender_rosbag /perception/object_recognition/objects /tf
tcpdump -i eth0 -w test_sender_tcpdump
```
In `autoware_2`:
```
cd ~/workspace/autoware_docker
ros2 bag record -o test_receiver_rosbag /v2x/cpm/objects /tf
tcpdump -i eth0 -w test_receiver_tcpdump
```
## Analyze in JupyteLab
### Plot the x,y coordinates of objects in test_sender_rosbag
1. Export the necessary topics of the Rosbag to a CSV file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB