Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/interpreter…
Browse files Browse the repository at this point in the history
…/routing-algorithm
  • Loading branch information
yamacir-kit committed Oct 2, 2023
2 parents 34034b1 + 126d8f9 commit 1e62998
Show file tree
Hide file tree
Showing 113 changed files with 1,839 additions and 17,237 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/BuildAndRun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rosdistro: [galactic, humble]
rosdistro: [humble]
steps:
- name: suppress warnings
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
timeout-minutes: 180
strategy:
matrix:
rosdistro: [galactic, humble]
rosdistro: [humble]
steps:
- uses: actions/checkout@v3

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/custom_spell.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"ignorePaths": [
"*.drawio",
"*/**/CHANGELOG.rst",
"external/lanelet2_matching/**",
"openscenario/openscenario_utility/openscenario_utility/resources/*.xsd"
],
"words": [
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

# external packages
external/*
!external/lanelet2_matching
!external/concealer

# auto-generated files
Expand Down
121 changes: 121 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# How to hack scenario_simulator_v2

## Note

This document is written for those who want to participate in the development
of `scenario_simulator_v2` or make their own modifications to
`scenario_simulator_v2`. Development requires general knowledge of ROS 2
software and robotic systems and a certain level of C++ skills, as well as
reading the ASAM OpenSCENARIO standard documentation appropriately.

## Prerequisite Knowledge

The `scenario_simulator_v2` consists of the following four main components.

### `scenario_test_runner`

The `scenario_test_runner` is responsible for managing the progress of the
entire process. It takes a single scenario file or a workflow file of multiple
scenarios as arguments, and passes each scenario to `openscenario_interpreter`
to evaluate each scenario. Another task of the `scenario_test_runner` is to
preprocess each scenario file before running the scenario.

TIER IV uses scenarios in YAML format with some extensions to ASAM OpenSCENARIO
1.2. The extended syntax mainly focuses on parameterization features that were
not standardized as of OpenSCENARIO 1.0. Processing of the extended syntax by
TIER IV is handled by `scenario_test_runner` and the preprocessed scenarios are
XML files that conform to the ASAM OpenSCENARIO 1.2 schema. Note that the
scenario passed to `openscenario_interpreter` is therefore in ASAM standard
format (`.xosc`), not the extended format by TIER IV (`.yaml`).

Both scenario files written in the TIER IV extended format (`.yaml`) and
standard ASAM OpenSCENARIO 1.2 scenario files (`.xosc`) can be given to
`scenario_test_runner`.

### `openscenario_interpreter`

The `openscenario_interpreter` is an interpreter for OpenSCENARIO 1.2 scenario
definition files in `.xosc` format, corresponding to the OpenSCENARIO Director
in The ASAM OpenSCENARIO architecture. It is a naive syntax tree interpreter
that parses a scenario definition file by recursive descent parsing, constructs
an abstract syntax tree, and evaluates the syntax tree directly. The
`openscenario_interpreter` is primarily responsible for interpreting ASAM
OpenSCENARIO, since the fundamental part of the simulation, such as coordinates
and time management, is managed by the `traffic_simulator`.

### `traffic_simulator`

This is a core library for traffic flow simulation, corresponding to the
Simulator Core in The ASAM OpenSCENARIO architecture. It is responsible for
computing the coordinates and behavior of each entity that appears in the
simulation, whereas `openscenario_interpreter` is responsible for parsing
scenario files and managing the progress of the scenario. It is clearly
differentiated from `openscenario_interpreter`, but `traffic_simulator` itself
is a library and is built into `openscenario_interpreter`, so it does not
appear as independent software while running the scenario.

A lot of processing, except for entity decision making during simulation are
pluggable and designed to allow switching the level of simulation detail and
computational complexity by connecting simulators with compatible APIs.
Currently only `simple_sensor_simulator` is compatible with the
`traffic_simulator` API, but work is underway to enable the connection of
AWSIM, a high-performance simulator being developed by TIER IV.

### `simple_sensor_simulator`

Reference implementation of a simulator conforming to the `traffic_simulator`
API. It provides a very simple environmental simulation with emphasis on
lightweight execution of simulations.

Based on the true values of the entities computed by `traffic_simulator`, it
computes the recognition information in addition to the LiDAR sensor values and
sends it to Autoware.

Historically, this module was created for sensor simulation, but now a lot of
processing beyond sensor simulation have been transferred from
`traffic_simulator`.

## Other Resources

### [ASAM OpenSCENARIO: User Guide](https://www.asam.net/index.php?eID=dumpFile&t=f&f=4908&token=ae9d9b44ab9257e817072a653b5d5e98ee0babf8)

This document describes the basic concepts of ASAM OpenSCENARIO 1.2. Note that
it provides a relatively detailed description of the coordinate system, but
lacks information on the details of the language's behavior.

### [XSD description](https://www.asam.net/static_downloads/ASAM_OpenSCENARIO_V1.2.0_Model_Documentation/modelDocumentation/)

Documentation of the structure of each syntax element of ASAM OpenSCENARIO 1.2.
Refer to it appropriately when developing `openscenario_interpreter`. However,
there are many ambiguous descriptions and many details are left to the
simulator implementors. Thus, please refer to the code comments of the
implementation as well.

## Development Guide

Please follow the steps below to set up the environment and check the sample
scenario behavior.

1.[Build scenario_simulator_v2 with Autoware](https://autowarefoundation.github.io/autoware-documentation/main/tutorials/scenario-simulation/planning-simulation/installation/)
2.[Run the sample scenario of `scenario_simulator_v2`](https://autowarefoundation.github.io/autoware-documentation/main/tutorials/scenario-simulation/planning-simulation/scenario-test-simulation/)

The sample scenario
([sample.yaml](test_runner/scenario_test_runner/scenario/sample.yaml)) is a
very simple one in which an Autoware-controlled vehicle is asked to drive a
certain distance along a straight road. Although the content of the scenario is
simple, it contains the minimum necessary elements to verify that
`scenario_simulator_v2` is able to properly activate Autoware and operate under
the scenario. Therefore, if this sample scenario works without any problems,
you can be sure that there are no problems in setting up your environment.

The most efficient way to understand the `scenario_simulator_v2` implementation
is to trace the process of running the sample scenario from top to bottom. In
other words, it's a good idea to start with scenario_test_runner.launch.py and
then read the code through `scenario_test_runner`, `openscenario_interpreter`,
`traffic_simulator`, and finally `simple_sensor_simulator`. In general, you
should be able to grasp the entire process flow of `scenario_simulator_v2` and
add or modify features in a day or two.

If you are unsure about any part of the code, please refer to the detailed
documentation of the relevant section accordingly, or contact the developers
via an issue in the `scenario_simulator_v2` GitHub repository.
5 changes: 0 additions & 5 deletions common/math/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ ament_auto_find_build_dependencies()

ament_auto_add_library(geometry SHARED DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src)

# Workaround to allow deprecated header to build on both galactic and humble
if(${tf2_geometry_msgs_VERSION} VERSION_LESS 0.18.0)
target_compile_definitions(geometry PUBLIC USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER)
endif()

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
Expand Down
6 changes: 1 addition & 5 deletions common/math/geometry/src/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@

#include <quaternion_operation/quaternion_operation.h>
#include <tf2/LinearMath/Quaternion.h>
#ifdef USE_TF2_GEOMETRY_MSGS_DEPRECATED_HEADER
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#else
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#endif

#include <geometry/transform.hpp>
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>

namespace math
{
Expand Down
21 changes: 0 additions & 21 deletions dependency_galactic.repos

This file was deleted.

6 changes: 3 additions & 3 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

Major Changes :race_car: :red_car: :blue_car:

| Feature | Brief summary | Category | Pull request | Contributor |
|---------|---------------|----------|--------------|-------------|
| | | | | |
| Feature | Brief summary | Category | Pull request | Contributor |
|----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|-------------------------------------------------------------------|-----------------------------------------|
| Traffic Light Simulation | Start supporting to traffic light messages in `autoware_perception_msgs`. | `openscenario_interpreter`, `traffic_simulator`, `simple_sensor_simulator` | [#1027](https://github.com/tier4/scenario_simulator_v2/pull/1027) | [HansRobo](https://github.com/HansRobo) |

Bug Fixes:bug:

Expand Down
14 changes: 7 additions & 7 deletions docs/user_guide/BuildInstructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build Instructions

This setup instruction is based on ROS 2 galactic.
This setup instruction is based on ROS 2 humble.

## Setup ROS 2 environment

Expand All @@ -18,12 +18,12 @@ sudo apt install curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
sudo apt update
sudo apt install ros-galactic-desktop
source /opt/ros/galactic/setup.bash
sudo apt install ros-humble-desktop
source /opt/ros/humble/setup.bash
sudo apt install -y python3-pip python3-rosdep2 python3-vcstool python3-colcon-common-extensions
rosdep update
```
reference : <https://docs.ros.org/en/galactic/Installation.html>
reference : <https://docs.ros.org/en/humble/Installation.html>
## Setup workspace

```bash
Expand All @@ -33,15 +33,15 @@ git clone https://github.com/tier4/scenario_simulator_v2.git
# These lines are necessary right now, but it will be removed in the near future
cd scenario_simulator_v2
# This script clones the part of the source codes in Autoware and add it to the workspace
vcs import external < dependency_galactic.repos
vcs import external < dependency_humble.repos
```

## Install dependencies via rosdep

```bash
cd ~/scenario_simulator_ws
source /opt/ros/galactic/setup.bash
rosdep install -iry --from-paths src/scenario_simulator_v2 --rosdistro galactic
source /opt/ros/humble/setup.bash
rosdep install -iry --from-paths src/scenario_simulator_v2 --rosdistro humble
```

## Build scenario_simulator_v2
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This document contains step-by-step instruction on how to build and run [AWF Aut

## Prerequisites

1. Ubuntu 20.04 machine
3. ROS 2 Galactic Geochelone desktop version [installed](https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html)
1. Ubuntu 22.04 machine
3. ROS 2 Humble Hawksbill desktop version [installed](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)

## How to build

Expand Down Expand Up @@ -41,7 +41,7 @@ This document contains step-by-step instruction on how to build and run [AWF Aut

5. Install dependent ROS packages.
```bash
source /opt/ros/galactic/setup.bash
source /opt/ros/humble/setup.bash
rosdep install -iry --from-paths src --rosdistro $ROS_DISTRO
```
6. Build the workspace.
Expand Down
22 changes: 11 additions & 11 deletions docs/user_guide/RunWithDocker.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ After install rocker, please check rocker works correctly.<br/>
If your machine has GPU(s), please execute the commands below.

```bash
rocker --nvidia --x11 osrf/ros:galactic-desktop rviz2
rocker --nvidia --x11 osrf/ros:humble-desktop rviz2
```

You can see rviz working on docker.
Expand All @@ -137,7 +137,7 @@ You can see rviz working on docker.
If your machine has no GPU, please execute the commands below.

```bash
rocker --x11 osrf/ros:galactic-desktop rviz2
rocker --x11 osrf/ros:humble-desktop rviz2
```

You can see the same result with NVIDIA GPU.
Expand All @@ -154,23 +154,23 @@ You can run the sample scenarios easily by using our pre-built docker image.
If you want to build a docker image in your local machine, please execute the commands below in your terminal.
```bash
cd path/to/scenario_simulator_v2
docker build -t scenario_simulator_v2 . --build-arg ROS_DISTRO=galactic
docker build -t scenario_simulator_v2 . --build-arg ROS_DISTRO=humble
```
Please replace the docker image name (e.g. "ghcr.io/tier4/scenario_simulator_v2:galactic" ) with "scenario_simulator_v2" <br/>
Please replace the docker image name (e.g. "ghcr.io/tier4/scenario_simulator_v2:humble" ) with "scenario_simulator_v2" <br/>
to use your built docker image in the launching commands.

</details>

If your local machine has NVIDIA GPU(s), you can launch scenario_simulator_v2 with test scenarios
```bash
docker pull ghcr.io/tier4/scenario_simulator_v2:galactic
rocker --nvidia --x11 ghcr.io/tier4/scenario_simulator_v2:galactic ros2 launch cpp_mock_scenarios mock_test.launch.py scenario:=crashing_npc scenario:=traffic_simulation_demo launch_rviz:=true timeout:=60.0
docker pull ghcr.io/tier4/scenario_simulator_v2:humble
rocker --nvidia --x11 ghcr.io/tier4/scenario_simulator_v2:humble ros2 launch cpp_mock_scenarios mock_test.launch.py scenario:=crashing_npc scenario:=traffic_simulation_demo launch_rviz:=true timeout:=60.0
```

If your local machine does NOT have NVIDIA GPU(s), you can launch scenario_simulator_v2 with test scenarios
```bash
docker pull ghcr.io/tier4/scenario_simulator_v2:galactic
rocker --x11 ghcr.io/tier4/scenario_simulator_v2:galactic ros2 launch cpp_mock_scenarios mock_test.launch.py scenario:=crashing_npc scenario:=traffic_simulation_demo launch_rviz:=true timeout:=60.0
docker pull ghcr.io/tier4/scenario_simulator_v2:humble
rocker --x11 ghcr.io/tier4/scenario_simulator_v2:humble ros2 launch cpp_mock_scenarios mock_test.launch.py scenario:=crashing_npc scenario:=traffic_simulation_demo launch_rviz:=true timeout:=60.0
```

<video
Expand Down Expand Up @@ -204,7 +204,7 @@ and execute the command below

```
rocker --x11 --oyr-mount $PWD/path/to/your/scenario.yaml \
-- ghcr.io/tier4/scenario_simulator_v2:galactic \
-- ghcr.io/tier4/scenario_simulator_v2:humble \
ros2 launch scenario_test_runner scenario_test_runner.launch.py \
scenario:=$PWD/path/to/your/scenario.yaml launch_rviz:=True
```
Expand All @@ -215,8 +215,8 @@ wget https://gist.github.com/hakuturu583/5e6a651df9abdf25dca7071ff5ea8ac3/archiv
unzip 1448057aeebc34cbfc04598b965440fcf7ecb636.zip
mv 5e6a651df9abdf25dca7071ff5ea8ac3-1448057aeebc34cbfc04598b965440fcf7ecb636 scenarios
sudo pip3 install git+https://github.com/sloretz/off-your-rocker.git
docker pull ghcr.io/tier4/scenario_simulator_v2:galactic
rocker --x11 --oyr-mount $PWD/scenarios/UC-001-0001-Kashiwa.yaml -- ghcr.io/tier4/scenario_simulator_v2:galactic ros2 launch scenario_test_runner scenario_test_runner.launch.py scenario:=$PWD/scenarios/UC-001-0001-Kashiwa.yaml launch_rviz:=True
docker pull ghcr.io/tier4/scenario_simulator_v2:humble
rocker --x11 --oyr-mount $PWD/scenarios/UC-001-0001-Kashiwa.yaml -- ghcr.io/tier4/scenario_simulator_v2:humble ros2 launch scenario_test_runner scenario_test_runner.launch.py scenario:=$PWD/scenarios/UC-001-0001-Kashiwa.yaml launch_rviz:=True
```
Our sample should run like the video below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ This document contains step-by-step instruction on how to build and run [Autowar

1. Ubuntu 20.04 machine
2. Hardware with CUDA 11.1 capable graphics card
3. ROS 2 Galactic Geochelone desktop version [installed](https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html) and sourced:
3. ROS 2 Galactic Geochelone desktop version [installed](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html) and sourced:
```bash
source /opt/ros/galactic/setup.bash
source /opt/ros/humble/setup.bash
```

## How to build
Expand Down
Loading

0 comments on commit 1e62998

Please sign in to comment.