|
| 1 | +# Reaction Analyzer |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +The main purpose of the reaction analyzer package is measuring reaction times of the nodes by listening the |
| 6 | +pre-determined topics. It can be used for measuring the reaction time of the perception pipeline, planning pipeline, and |
| 7 | +control pipeline. To be able to measure both control outputs and perception outputs, it was necessary to divide the node |
| 8 | +into two running_mode: `planning_control` and `perception_planning`. |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +### Planning Control Mode |
| 13 | + |
| 14 | +In this mode, the reaction analyzer creates a dummy publisher for the PredictedObjects and PointCloud2 topics. In the |
| 15 | +beginning of the test, it publishes the initial position of the ego vehicle and the goal position to set the test |
| 16 | +environment. Then, it spawns a sudden obstacle in front of the ego vehicle. After the obstacle is spawned, it starts to |
| 17 | +search reacted messages of the planning and control nodes in the pre-determined topics. When all the topics are reacted, |
| 18 | +it calculates the reaction time of the nodes and statistics by comparing `reacted_times` of each of the nodes |
| 19 | +with `spawn_cmd_time`, and it creates a csv file to store the results. |
| 20 | + |
| 21 | +### Perception Planning Mode |
| 22 | + |
| 23 | +In this mode, the reaction analyzer reads the rosbag files which are recorded from AWSIM, and it creates a topic |
| 24 | +publisher for each topic inside the rosbag to replay the rosbag. It reads two rosbag files: `path_bag_without_object` |
| 25 | +and `path_bag_with_object`. Firstly, it replays the `path_bag_without_object` to set the initial position of the ego |
| 26 | +vehicle and the goal position. After `spawn_time_after_init` seconds , it replays the `path_bag_with_object` to spawn a |
| 27 | +sudden obstacle in front of the ego vehicle. After the obstacle is spawned, it starts to search the reacted messages of |
| 28 | +the perception and planning nodes in the pre-determined topics. When all the topics are reacted, it calculates the |
| 29 | +reaction time of the nodes and statistics by comparing `reacted_times` of each of the nodes with `spawn_cmd_time`, and |
| 30 | +it creates a csv file to store the results. |
| 31 | + |
| 32 | +#### Point Cloud Publisher Type |
| 33 | + |
| 34 | +To get better analyze for Perception & Sensing pipeline, the reaction analyzer can publish the point cloud messages in 3 |
| 35 | +different ways: `async_header_sync_publish`, `sync_header_sync_publish` or `async_publish`. (`T` is the period of the |
| 36 | +lidar's output) |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +- `async_header_sync_publish`: It publishes the point cloud messages synchronously with asynchronous header times. It |
| 41 | + means that each of the lidar's output will be published at the same time, but the headers of the point cloud messages |
| 42 | + includes different timestamps because of the phase difference. |
| 43 | +- `sync_header_sync_publish`: It publishes the point cloud messages synchronously with synchronous header times. It |
| 44 | + means that each of the lidar's output will be published at the same time, and the headers of the point cloud messages |
| 45 | + includes the same timestamps. |
| 46 | +- `async_publish`: It publishes the point cloud messages asynchronously. It means that each of the lidar's output will |
| 47 | + be published at different times. |
| 48 | + |
| 49 | +## Usage |
| 50 | + |
| 51 | +The common parameters you need to define for both running modes are `output_file_path`, `test_iteration`, |
| 52 | +and `reaction_chain` list. `output_file_path` is the output file path is the path where the results and statistics |
| 53 | +will be stored. `test_iteration` defines how many tests will be performed. The `reaction_chain` list is the list of the |
| 54 | +pre-defined topics you want to measure their reaction times. |
| 55 | + |
| 56 | +### Prepared Test Environment |
| 57 | + |
| 58 | +Firstly, you need to download the demonstration test map from the |
| 59 | +link [here](https://github.com/tier4/AWSIM/releases/download/v1.1.0/nishishinjuku_autoware_map.zip). After downloading, |
| 60 | +extract the zip file and use its path as `[MAP_PATH]` in the following commands. |
| 61 | + |
| 62 | +#### Planning Control Mode |
| 63 | + |
| 64 | +Firstly, you need to define only Planning and Control nodes in the `reaction_chain` list. With the default parameters, |
| 65 | +you can start to test with the following command: |
| 66 | + |
| 67 | +```bash |
| 68 | +ros2 launch reaction_analyzer reaction_analyzer.launch.xml running_mode:=planning_control vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit map_path:=[MAP_PATH] |
| 69 | +``` |
| 70 | + |
| 71 | +After the command, the simple_planning_simulator and the reaction_analyzer will be launched. It will automatically start |
| 72 | +to test. After the test is completed, the results will be stored in the `output_file_path` you defined. |
| 73 | + |
| 74 | +#### Perception Planning Mode |
| 75 | + |
| 76 | +Firstly, you need to download the rosbag files from the |
| 77 | +link [here](https://drive.google.com/file/d/1_P-3oy_M6eJ7fk8h5CP8V6s6da6pPrBu/view?usp=sharing). After downloading, |
| 78 | +extract the zip file and set the path of the `.db3` files to parameters `path_bag_without_object` |
| 79 | +and `path_bag_with_object`. Because custom sensor setup, you need to checkout the following branches before launch the |
| 80 | +reaction analyzer: For the `autoware_individual_params` repository, checkout the |
| 81 | +branch [here](https://github.com/brkay54/autoware_individual_params/tree/bk/reaction-analyzer-config). For |
| 82 | +the `awsim_sensor_kit_launch` repository, checkout the |
| 83 | +branch [here](https://github.com/brkay54/awsim_sensor_kit_launch/tree/bk/reaction-analyzer-config). |
| 84 | +After you checkouted the branches, you can start to test with the following command: |
| 85 | + |
| 86 | +```bash |
| 87 | +ros2 launch reaction_analyzer reaction_analyzer.launch.xml running_mode:=perception_planning vehicle_model:=sample_vehicle sensor_model:=awsim_sensor_kit map_path:=[MAP_PATH] |
| 88 | +``` |
| 89 | + |
| 90 | +After the command, the e2e_simulator and the reaction_analyzer will be launched. It will automatically start |
| 91 | +to test. After the test is completed, the results will be stored in the `output_file_path` you defined. |
| 92 | + |
| 93 | +### Custom Test Environment |
| 94 | + |
| 95 | +If you want to run the reaction analyzer with your custom test environment, you need to redefine some of the parameters. |
| 96 | +The parameters you need to redefine are `initialization_pose`, `entity_params`, `goal_pose`, and `topic_publisher` |
| 97 | +parameters. |
| 98 | +For `initialization_pose`, `entity_params`, `goal_pose`, you can upload your `.osm` map file into |
| 99 | +the [scenario editor](https://scenario.ci.tier4.jp/scenario_editor/) to define the position of the position parameters. |
| 100 | +You can define the positions with respect to you desired root. Firstly, add EGO vehicle from edit/add entity/Ego to map. |
| 101 | +Set destination to EGO vehicle and add another dummy object in same way. The dummy object represents the object spawn |
| 102 | +suddenly in the reaction analyzer test. After you set up the positions in the map, we should get the positions of these |
| 103 | +entities in the map frame. To achieve this, you should convert the positions to map frame by changing Map/Coordinate to |
| 104 | +World and Map/Orientation to Euler. After these steps, you can see the positions in map frame and euler angles. You can |
| 105 | +change the `initialization_pose`, `entity_params`, `goal_pose` parameters with the values you get from the website. |
| 106 | + |
| 107 | +For the `topic_publisher` parameters, you need to record the rosbags from the AWSIM. After opened your AWSIM |
| 108 | +environment, you should record two different rosbags. However, the environment should be static and the position of the |
| 109 | +vehicle should be same. Firstly, record a rosbag in empty environment. After that, record another rosbag in the same |
| 110 | +environment except add an object in front of the vehicle. After you record the rosbags, you can set |
| 111 | +the `path_bag_without_object` and `path_bag_with_object` parameters with the paths of the recorded rosbags. |
| 112 | + |
| 113 | +## Parameters |
| 114 | + |
| 115 | +| Name | Type | Description | |
| 116 | +| ------------------------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- | |
| 117 | +| `timer_period` | double | [s] Period for the main processing timer. | |
| 118 | +| `published_time_expire_duration` | double | [s] Time horizon of the PublishedTime message vector. | |
| 119 | +| `test_iteration` | int | Number of iterations for the test. | |
| 120 | +| `output_file_path` | string | Directory path where test results and statictics will be stored. | |
| 121 | +| `object_search_radius_offset` | double | [m] Additional radius added to the search area when looking for objects. | |
| 122 | +| `spawn_time_after_init` | double | [s] Time delay after initialization before spawning objects. Only valid `perception_planning` mode. | |
| 123 | +| `spawn_distance_threshold` | double | [m] Distance threshold for spawning objects. Only valid `planning_control` mode. | |
| 124 | +| `spawned_pointcloud_sampling_distance` | double | [m] Sampling distance for point clouds of spawned objects. Only valid `planning_control` mode. | |
| 125 | +| `dummy_perception_publisher_period` | double | [s] Publishing period for the dummy perception data. Only valid `planning_control` mode. | |
| 126 | +| `first_brake_params.debug_control_commands` | bool | Debug publish flag. | |
| 127 | +| `first_brake_params.control_cmd_buffer_time_interval` | double | [s] Time interval for buffering control commands. | |
| 128 | +| `first_brake_params.min_number_descending_order_control_cmd` | int | Minimum number of control commands in descending order for triggering brake. | |
| 129 | +| `first_brake_params.min_jerk_for_brake_cmd` | double | [m/s³] Minimum jerk value for issuing a brake command. | |
| 130 | +| `initialization_pose` | struct | Initial pose of the vehicle, containing `x`, `y`, `z`, `roll`, `pitch`, and `yaw` fields. Only valid `planning_control` mode. | |
| 131 | +| `entity_params` | struct | Parameters for entities (e.g., obstacles), containing `x`, `y`, `z`, `roll`, `pitch`, `yaw`, `x_dimension`, `y_dimension`, and `z_dimension`. | |
| 132 | +| `goal_pose` | struct | Goal pose of the vehicle, containing `x`, `y`, `z`, `roll`, `pitch`, and `yaw` fields. | |
| 133 | +| `topic_publisher.path_bag_without_object` | string | Path to the ROS bag file without objects. Only valid `perception_planning` mode. | |
| 134 | +| `topic_publisher.path_bag_with_object` | string | Path to the ROS bag file with objects. Only valid `perception_planning` mode. | |
| 135 | +| `topic_publisher.pointcloud_publisher.pointcloud_publisher_type` | string | Defines how the PointCloud2 messages are going to be published. Modes explained above. | |
| 136 | +| `topic_publisher.pointcloud_publisher.pointcloud_publisher_period` | double | [s] Publishing period of the PointCloud2 messages. | |
| 137 | +| `reaction_chain` | struct | List of the nodes with their topics and topic's message types. | |
0 commit comments