Repository: ucla-mobility/OpenCDA (language: python)

Issue:
Doc/0.1.2



Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index b421f0d8..a3b38674 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,18 @@ The key features of OpenCDA are:
 
 Users could refer to [OpenCDA documentation](https://opencda-documentation.readthedocs.io/en/latest/) for more details.
 
+## What's New
+### March 2022
+* HD Map manager is online! It currently supports generating rasterization map that includes road topology, traffic light info, and dynamic objects around each cav in real-time. This can be
+used for RL planning, HD Map learning, scene understanding, etc.
+
+### Feb 2022
+* Our paper [*OPV2V: An Open Benchmark Dataset and Fusion Pipeline for Perception with Vehicle-to-Vehicle Communication*](https://arxiv.org/abs/2109.07644)
+  has been accepted by ICRA 2022! It utilizes  the offline Cooperative Perception(data dumping) function in OpenCDA. Check the benchmark codebase [OpenCOOD](https://github.com/DerrickXuNu/OpenCOOD) of OPV2V if interested.
+### Oct 2021
+ * CARLA 0.9.12 now supported; Different weather conditions are supported.
+ * Better traffic management supported: users now can set a customized range to background cars.
+
 
 ## Major Components
 ![teaser](docs/md_files/images/OpenCDA_new_diagrams.png)
@@ -60,15 +72,6 @@ We welcome your contributions.
  Please use [this template](.github/PR_TEMPLATE.md) for your pull requests.
 
 
-## What's New
-### Feb 2022
-* Our paper [*OPV2V: An Open Benchmark Dataset and Fusion Pipeline for Perception with Vehicle-to-Vehicle Communication*](https://arxiv.org/abs/2109.07644)
-  has been accepted by ICRA 2022! It utilizes  the offline Cooperative Perception(data dumping) function in OpenCDA. Check the [github page](https://github.com/DerrickXuNu/OpenCOOD) of OPV2V if interested.
-### Oct 2021
- * CARLA 0.9.12 now supported; Different weather conditions are supported.
- * Better traffic management supported: users now can set a customized range to background cars.
-
-
 
 ## Citation
  If you are using our OpenCDA framework or codes for your development, please cite the following paper:
diff --git a/docs/md_files/codebase_structure.md b/docs/md_files/codebase_structure.md
index 113dbb9e..d076fcfb 100644
--- a/docs/md_files/codebase_structure.md
+++ b/docs/md_files/codebase_structure.md
@@ -12,6 +12,7 @@ OpenCDA
 │   │   └── actutation # implementation of control algorithms
 │   │   ├── application # implementation of cooperative driving applications
 │   │   ├── common # base class and communication class for cavs
+│   │   ├── map # HDMap manager
 │   │   ├── plan # planning algorithms
 │   │   └── sensing # perception adn localization algorithms.
 │   ├── customize # where the users put their customized algorithm to replace the default modules
diff --git a/docs/md_files/release_history.md b/docs/md_files/release_history.md
index 21389a31..3c3da4f4 100644
--- a/docs/md_files/release_history.md
+++ b/docs/md_files/release_history.md
@@ -1,6 +1,21 @@
 ## Release History of OpenCDA
 This page demonstrates all the changes since the origin release v0.1.0 with more detailed imags.
 
+--- 
+### v0.1.2
+##### Map manager
+OpenCDA now adds a new component `map_manager` for each cav. It will dynamically load road topology, traffic light information, and dynamic
+objects information around the ego vehicle and save them into rasterized map, which can be useful for RL planning, HDMap learning, scene understanding, etc.
+Key elements in the rasterization map:
+- Drivable space colored by black
+- Lanes
+  - Red lane: the lanes that are controlled by red traffic light
+  - Green lane: the lanes that are controlled by green traffic light
+  - Yellow lane: the lanes that are not effected by any traffic light
+- Objects that are colored by white and represented as rectangle
+
+![](images/map_manager.gif )
+
 ---
 ### v0.1.1
 #### Cooperative Perception
diff --git a/docs/md_files/yaml_define.md b/docs/md_files/yaml_define.md
index 3599973c..6cc442d6 100644
--- a/docs/md_files/yaml_define.md
+++ b/docs/md_files/yaml_define.md
@@ -26,6 +26,7 @@ vehicle_base: &vehicle_base # define cav default parameters
   sensing: &base_sensing # define sensing parameters
     perception: &base_perception # define perception related settings
     localization: &base_localize # define localization related settings
+  map_manager: &base_map_manager # define HDMap manager
   behavior: &base_behavior # define planning related parameters
   controller: &base_controller # define controller
     type: pid_controller # define the type of controller
@@ -104,45 +105,51 @@ the [CARLA Sync documentation](https://carla.readthedocs.io/en/latest/adv_synchr
         the CAV will load the ego position from server directly.
         * `gnss` : related to the parameters of the gnss sensor.
         * `debug_helper` : parameters related to localization debugging and real-time trajectory plotting.
-* `behavior` : Define behavior planning parameters
-    * `max_speed` : int type, the maximum speed (km/h) that the CAV is allowed to reach.
-    * `tailgate_speed` : int type, the target speed (km/h) for CAV when it tries to catch up with a platoon, it is usually larger
-    than `max_speed`
-    * `speed_lim_dist` : int type, during normal driving mode, `target_speed` = `max_speed` - `speed_lim_dist`
-    * `speed_decrease` : int type, when the CAV is in car following mode and it gets too close to the
-    front vehicle, `target_speed` = `front_vehicle_speed` - `speed_decrease`
-    * `safety_time` : float type, ttc thresholding to identify whether the ego vehicle is too close to 
-    the front vehicle.
-    * `emergency_param` : float type, `emergency_stop_distance` = `current_speed` * `emergency_param`
-    * `ignore_traffic_light` : bool type, if set to true, the CAV will ignore the traffic light.
-    * `overtake_allowed` :  bool type, if set to false, overtaking is not allowed during driving.
-    * `collision_time_ahead` : float type, collision detection range
-    * `sample_resolution` : float type, the unit distance (m) between two adjacent waypoints
-    * `local_planner` : Define trajectory planning parameters.
-        * `buffer_size` : dequeue type, waypoint buffer size.
-        * `trajectory_update_freq` : int type, the update frequency for trajectory, when the length of trajectory buffer 
-        is below the frequency number, the ego vehicle will re-generate the trajectory.
-        * `waypoint_update_freq` : int type, the update frequency for waypoint buffer, when the length of the 
-        waypoint buffer is below the frequency, the waypoint buffer will load waypoints from `waypoint_queue`.
-        * `min_dist` : float type, used to pop out the waypoints that are too close to the current location
-        * `trajectory_dt` : float type, trajectory points sampling resolution.
-        * `debug` : bool type, if true, waypoint will be visualized.
-        * `debug_trajectory` : bool type, if true, trajectory will be visualized.
-* `controller` : Define controller parameters.
-    * `type` : string type, the type of controller the ego vehicle uses.
-    * `args` : the arguments related to the selected controller.
-
-* `v2x` : Defome vehicle communication parameters.
-    * `enabled` : bool type, indicate whether v2x is enabled.
-    * `communication_range` : float type, the searching range of the CAV
-    * `loc_noise` : float type, the deviation of the noise added to the received ego position 
-    during communication.
-    * `yaw_noise` : float type, the deviation of the noise added to the received yaw angle
-    during communication.
-    * `speed_noise` : float type, the deviation of the noise added to the received ego speed 
-    during communication.
-    * `lag` : int type, the lagging during the communication. E.g., 2 means the CAV
-     receives the packages of other CAVs at most 2 time steps ago. 
+ * `map_manager` : Define HDMap manager parameters
+   * `pixels_per_meter` : The rasterization map precision.
+   * `raster_size` : The rasterization map's H and W in pixels.
+   * `lane_sample_resolution` : Waypoint sampling resolution for lane drawing.
+   * `visualize` : Whether to show the rasterization map during running in real-time.
+   * `activate` : Whether activate the map_manager module.
+ * `behavior` : Define behavior planning parameters
+     * `max_speed` : int type, the maximum speed (km/h) that the CAV is allowed to reach.
+     * `tailgate_speed` : int type, the target speed (km/h) for CAV when it tries to catch up with a platoon, it is usually larger
+     than `max_speed`
+     * `speed_lim_dist` : int type, during normal driving mode, `target_speed` = `max_speed` - `speed_lim_dist`
+     * `speed_decrease` : int type, when the CAV is in car following mode and it gets too close to the
+     front vehicle, `target_speed` = `front_vehicle_speed` - `speed_decrease`
+     * `safety_time` : float type, ttc thresholding to identify whether the ego vehicle is too close to 
+     the front vehicle.
+     * `emergency_param` : float type, `emergency_stop_distance` = `current_speed` * `emergency_param`
+     * `ignore_traffic_light` : bool type, if set to true, the CAV will ignore the traffic light.
+     * `overtake_allowed` :  bool type, if set to false, overtaking is not allowed during driving.
+     * `collision_time_ahead` : float type, collision detection range
+     * `sample_resolution` : float type, the unit distance (m) between two adjacent waypoints
+     * `local_planner` : Define trajectory planning parameters.
+         * `buffer_size` : dequeue type, waypoint buffer size.
+         * `trajectory_update_freq` : int type, the update frequency for trajectory, when the length of trajectory buffer 
+         is below the frequency number, the ego vehicle will re-generate the trajectory.
+         * `waypoint_update_freq` : int type, the update frequency for waypoint buffer, when the length of the 
+         waypoint buffer is below the frequency, the waypoint buffer will load waypoints from `waypoint_queue`.
+         * `min_dist` : float type, used to pop out the waypoints that are too close to the current location
+         * `trajectory_dt` : float type, trajectory points sampling resolution.
+         * `debug` : bool type, if true, waypoint will be visualized.
+         * `debug_trajectory` : bool type, if true, trajectory will be visualized.
+ * `controller` : Define controller parameters.
+     * `type` : string type, the type of controller the ego vehicle uses.
+     * `args` : the arguments related to the selected controller.
+
+ * `v2x` : Defome vehicle communication parameters.
+     * `enabled` : bool type, indicate whether v2x is enabled.
+     * `communication_range` : float type, the searching range of the CAV
+     * `loc_noise` : float type, the deviation of the noise added to the received ego position 
+     during communication.
+     * `yaw_noise` : float type, the deviation of the noise added to the received yaw angle
+     during communication.
+     * `speed_noise` : float type, the deviation of the noise added to the received ego speed 
+     during communication.
+     * `lag` : int type, the lagging during the communication. E.g., 2 means the CAV
+      receives the packages of other CAVs at most 2 time steps ago. 
 
 #### platoon_base
 `platoon_base` define the default platooning parameters.
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 83a14d06..4954fcf1 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -3,7 +3,7 @@ carla
 matplotlib==3.4.2
 networkx==2.5.1
 numpy
-pillow==8.2.0
+pillow
 pyparsing==2.4.7
 six==1.16.0
 open3d
diff --git a/environment.yml b/environment.yml
index d77e48f7..c86015b9 100644
--- a/environment.yml
+++ b/environment.yml
@@ -8,7 +8,7 @@ dependencies:
     - matplotlib==3.4.2
     - networkx==2.5.1
     - numpy
-    - pillow==8.2.0
+    - pillow
     - pyparsing==2.4.7
     - six==1.16.0
     - open3d
@@ -19,3 +19,4 @@ dependencies:
     - scipy==1.6.3
     - seaborn
     - lxml
+    - shapely
diff --git a/opencda/version.py b/opencda/version.py
index dfb3a953..51720796 100644
--- a/opencda/version.py
+++ b/opencda/version.py
@@ -1,3 +1,3 @@
 """Specifies the current version number of OpenCDA."""
 
-__version__ = "0.1.1"
+__version__ = "0.1.2"
diff --git a/requirements.txt b/requirements.txt
index 180acecc..35028b75 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
 matplotlib==3.4.2
 networkx==2.5.1
 numpy
-pillow==8.2.0
+pillow
 pyparsing==2.4.7
 six==1.16.0
 open3d
@@ -11,4 +11,5 @@ pygame
 scikit-learn==0.24.2
 scipy==1.6.3
 seaborn
-lxml
\ No newline at end of file
+lxml
+shapely
\ No newline at end of file
diff --git a/requirements_ci.txt b/requirements_ci.txt
index 57b1d5dd..b7f9201d 100644
--- a/requirements_ci.txt
+++ b/requirements_ci.txt
@@ -1,7 +1,7 @@
 matplotlib==3.4.2
 networkx==2.5.1
 numpy
-pillow==8.2.0
+pillow
 pyparsing==2.4.7
 six==1.16.0
 open3d


Test patch:
diff --git a/opencda/scenario_testing/config_yaml/single_2lanefree_carla.yaml b/opencda/scenario_testing/config_yaml/single_2lanefree_carla.yaml
index 46a42bb7..057cbae5 100644
--- a/opencda/scenario_testing/config_yaml/single_2lanefree_carla.yaml
+++ b/opencda/scenario_testing/config_yaml/single_2lanefree_carla.yaml
@@ -60,6 +60,7 @@ vehicle_base: &vehicle_base
     raster_size: [224, 224]
     lane_sample_resolution: 0.1
     visualize: true
+    activate: true
 
   behavior: &base_behavior
     max_speed: 111 # maximum speed, km/h