diff --git a/README.md b/README.md index c1ac3e92..7fe408c0 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,7 @@ year={2021} ``` The arxiv link to the paper: https://arxiv.org/abs/2107.06260 -Also, under this LICENSE, OpenCDA is for non-commercial research only. Researchers to be able to modify the source code for their own research only. Contracted work that generates corporate revenues and other general commecial use are prohibited under this lICENSE. See the LICENSE file for details and possible opportunities for commercial use. - +Also, under this LICENSE, OpenCDA is for non-commercial research only. Researchers can modify the source code for their own research only. Contracted work that generates corporate revenues and other general commercial use are prohibited under this LICENSE. See the LICENSE file for details and possible opportunities for commercial use. ## Get Started ![teaser](docs/md_files/images/platoon_joining_2lanefree_complete.gif) diff --git a/docs/index.rst b/docs/index.rst index ad47718a..e1ebec3b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,14 +5,12 @@ Welcome to OpenCDA's documentation! =================================== -OpenCDA is a generalized framework for fast developing and testing -cooperative driving automation applications(e.g., cooperative -perception, platooning) as well as autonomous vehicle components(e.g., -perception, localization, planning, control) under Co-simulation(CARLA-SUMO). +OpenCDA is a generalized framework for prototyping cooperative driving automation (CDA; see SAE J3216) applications (e.g., cooperative perception, platooning) as well as automated driving components (e.g., perception, localization, planning, control) integrated with automated driving simulation (CARLA), traffic simulation (SUMO), and Co-simulation (CARLA + SUMO). OpenCDA builds upon standard automated driving system (ADS) platforms and focuses on various classes of data exchanges and cooperation between vehicles, infrastructure, and other road users (e.g., pedestrians). -OpenCDA is a work in progress, and many features are still in the future -roadmap. We welcome your contribution and please visit our Github repo -for latest release. +The goal of the OpenCDA project is to enable researchers and engineers to prototype any cooperative driving applications using our full-stack CDA platform and test them from both automated driving and traffic operations perspectives. OpenCDA bridges the gaps between the communities of automated driving and transporation engineering. Eventually, OpenCDA can be used to develop and test cooperative driving functions and applications for improving safety, sustainability, and efficiency of future transportation systems. + +OpenCDA is a work in progress. Many features on the roadmap are being continuously developed. We welcome your contribution and please visit our Github repo +for the latest release. `OpenCDA source code on Github `_ @@ -49,8 +47,7 @@ for latest release. **Citing OpenCDA**\ : -If you use OpenCDA in a scientific publication, we would appreciate -citations to the following paper:: +If you are using our OpenCDA framework or codes for your development, please cite the following paper: @inproceedings{xu2021opencda, author = {Runsheng Xu, Yi Guo, Xu Han, Xin Xia, Hao Xiang, Jiaqi Ma}, @@ -62,6 +59,8 @@ citations to the following paper:: Our paper can be accessed by arxiv: https://arxiv.org/abs/2107.06260 +Also, under this LICENSE, OpenCDA is for non-commercial research only. Researchers can modify the source code for their own research only. Contracted work that generates corporate revenues and other general commercial use are prohibited under this LICENSE. See the LICENSE file for details and possible opportunities for commercial use. + Indices and tables ================== diff --git a/docs/md_files/contributor.md b/docs/md_files/contributor.md index aabf0ad0..7d5c8708 100644 --- a/docs/md_files/contributor.md +++ b/docs/md_files/contributor.md @@ -1,32 +1,33 @@ -## About us -OpenCDA is funded and mainly support by [UCLA Mobility Lab](https://mobility-lab.seas.ucla.edu/). +## About Us +OpenCDA is brought to you by [UCLA Mobility Lab](https://mobility-lab.seas.ucla.edu/). + +### Supervisor +Dr. Jiaqi Ma (Associate Professor @ UCLA) +- Lab Principal Investigator +- [Linkedin](https://www.linkedin.com/in/jiaqi-ma-17037838/) +- [Google Scholar](https://scholar.google.com/citations?user=S3cQz1AAAAAJ&hl=en) + ### Core Developer Runsheng Xu (Ph.D. Student @ UCLA): -- OpenCDA System Architect +- Project Lead and OpenCDA System Architect - [Homepage](https://derrickxunu.github.io/) - [Linkedin](https://www.linkedin.com/in/runsheng-xu/) Xu Han (Ph.D. Student @ UCLA): -- Map customization +- Maps - [Linkedin](https://www.linkedin.com/in/xu-han-12851a64/) Hao Xiang (Ph.D. Student @ UCLA): -- Trajectory prediction module, functionality enhancement +- Trajectory Prediction, Functionality Enhancement - [Homepage](https://xhwind.github.io/) - [Linkedin](https://www.linkedin.com/in/hao-xiang-42bb5a1b2/) -### Theoretical Support Dr. Xin Xia (Postdoc @ UCLA): -- Theoretical guidance on cooperative localization +- Cooperative Localization - [Linkedin](https://www.linkedin.com/in/xin-xia-3b6589189/) Dr. Yi Guo (Postdoc @ UC): -- Help on Sumo part +- Platooning algorithm, SUMO Only Mode (under dev) - [Linkedin](https://www.linkedin.com/in/yi-guo-4008baaa/) -### Supervisor -Dr. Jiaqi Ma (Associate Professor @ UCLA) -- Project and lab supervisor -- [Linkedin](https://www.linkedin.com/in/jiaqi-ma-17037838/) -- [Google Scholar](https://scholar.google.com/citations?user=S3cQz1AAAAAJ&hl=en) diff --git a/docs/md_files/customization.md b/docs/md_files/customization.md index f43f47c4..da4644d8 100644 --- a/docs/md_files/customization.md +++ b/docs/md_files/customization.md @@ -28,7 +28,7 @@ class LocalizationManager(object): ... corrected_cords = self.kf(x, y, z, speed, yaw, imu_yaw_rate) ``` -If a user wants to remain the whole structure of localization and just replace the filter(e.g. Extended Kalman Filter), +If a user wants to remain the whole structure of localization and just replace the filter (e.g. Extended Kalman Filter), then he/she just needs to create a `localization_manager.py` under `opencda/customize/core/sensing/localization` folder and initializes the `CustomizedLocalizationManager` with Extended Kalman Filter: @@ -142,7 +142,7 @@ through `update_info()`, and then takes the `target_speed` and `target_loc` gene behavior agent to produce the final control command through `run_step()`. Different from other modules, `ControlManager` is more like a abstract class, which provides an -interface to call the corresponding controller(default pid controller). +interface to call the corresponding controller (default pid controller). ```python import importlib diff --git a/docs/md_files/developer_tutorial.md b/docs/md_files/developer_tutorial.md index 85ccae04..5d27b4e0 100644 --- a/docs/md_files/developer_tutorial.md +++ b/docs/md_files/developer_tutorial.md @@ -1,14 +1,9 @@ ## Class Design -In this section, we will take a deeper look at the implementation details of several important classes in our OpenCDA framework. For beginners, we encourage you to go through our [OpenCDA Logic Flow](tutorial.md) - first to understand the general simulation process. - - This tutorial will emphasize the detailed design logic behind each class and try to give clear descriptions of the core algorithms in each module. - We will go through a test example `platoon_joining_2lanefree_carla.py` and for easy understanding, we have removed some non-core codes to simplify the code flow. To read the complete source code, - please refer to our [repo](https://github.com/ucla-mobility/OpenCDA). - For details about our cooperative architecture, please refer to our [paper](https://arxiv.org/abs/2107.06260). - +In this section, we will take a deeper look at the implementation details of several important classes in our OpenCDA framework. For beginners, we encourage you to go through our [OpenCDA Logic Flow](tutorial.md) first to understand the general simulation process. This tutorial will emphasize the detailed design logic behind each class and try to give clear descriptions of the core algorithms in each module. We will go through a test example `platoon_joining_2lanefree_carla.py` and for easy understanding, we have removed some non-core codes to simplify the code flow. To read the complete source code, please refer to our [repo](https://github.com/ucla-mobility/OpenCDA). For details about our cooperative architecture, please refer to our [paper](https://arxiv.org/abs/2107.06260). + Note: this tutorial assume you are using CARLA only instead of Co-simulation. + ### Workflow The workflow of opencda can be summarized as follows. @@ -18,13 +13,10 @@ The workflow of opencda can be summarized as follows. * Create `CavWorld` object to store information of registered CAVs and more importantly, to store the shared large models like neural networks. * `ScenarioManager` will use those configurations to set `carla.TrafficManager` and load customized map if needed. * After the creation of `ScenarioManager`, users can use its `create_vehicle_manager` method to spawn Connected Automated Vehicles (CAVs). Internally, each vehicle is managed by a `VehicleManager`, which will wrap the original `carla.Vehicle` with other modules such as perception, localization, control, and behavior agent. -* Besides single CAVs, there may also be platoons in the traffic. To spawn the platoons, users should use `create_platoon_manager` method. -Similar to the previous single CAV, each member in the platoon will be managed by `VehicleManager`. In addition, `PlatooningManager` is used to maintain the information of all the vehicles in the same platoon. And after the creation of vehicles and platoons, it will return a list of `PlatooningManager`. +* Besides single CAVs, there may also be platoons in the traffic. To spawn the platoons, users should use `create_platoon_manager` method. Similar to the previous single CAV, each member in the platoon will be managed by `VehicleManager`. In addition, `PlatooningManager` is used to maintain the information of all the vehicles in the same platoon. And after the creation of vehicles and platoons, it will return a list of `PlatooningManager`. * Similar to the process of spawning a single CAV, `create_traffic_carla` method will spawn background traffic with `autopilot=True`. * Now all the CAVs and traffic flow are generated, thus we will enter the simulation loop. At the beginning of each simulation -step, ` scenario_manager.tick()` will be called to tick the server. Then all the CAVs will update the surrounding -information and execute a single step. The single CAVs may join the platoon in the middle of the travel, so we need -to check whether any single CAV has joined a platoon and remove it from the `single_cav_list` if so. +step, ` scenario_manager.tick()` will be called to tick the server. Then all the CAVs will update the surrounding information and execute a single step. The single CAVs may join the platoon in the middle of the travel, so we need to check whether any single CAV has joined a platoon and remove it from the `single_cav_list` if so. ```python @@ -66,8 +58,7 @@ def run_scenario(opt, config_yaml): ### CavWorld -`CavWorld` stores CAVs and platoon information. Besides, it will also store - the shared machine learning models, so we don't need to store a separate model for each CAV. if you plan to use a neural network, this is a good place to load your model and call it in the customized algorithm class to utilize the model. +`CavWorld` stores CAVs and platoon information. Besides, it will also store the shared machine learning models, so we don't need to store a separate model for each CAV. if you plan to use a neural network, this is a good place to load your model and call it in the customized algorithm class to utilize the model. ```python class CavWorld(object): @@ -86,9 +77,7 @@ class CavWorld(object): ### ScenarioManager -`ScenarioManager` controls simulation construction, -generates background traffic generation, and spawns CAVs. During the initialization stage, it will create the `client` and load the world with the HD map - into the variable `self.world`. +`ScenarioManager` controls simulation construction, generates background traffic generation, and spawns CAVs. During the initialization stage, it will create the `client` and load the world with the HD map into the variable `self.world`. ```python class ScenarioManager: @@ -120,46 +109,44 @@ Now we will introduce each of them: * `create_vehicle_manager()` -The CAVs information is stored as a list in the yaml file. Each entry in the list corresponds to a CAV's -configuration.This method will pass spawn positions specified in the yaml file to the server and spawn -the `carla.Vehicle` object. For each spawned vehicle, we will wrap it with the class `VehicleManager`, - which essentially supports the localization, perception, platooning behavior, etc. - Details about this class can be found in the `VehicleManager` section. + The CAVs information is stored as a list in the yaml file. Each entry in the list corresponds to a CAV's configuration.This method will pass spawn positions specified in the yaml file to the server and spawn the `carla.Vehicle` object. For each spawned vehicle, we will wrap it with the class `VehicleManager`, which essentially supports the localization, perception, platooning behavior, etc. Details about this class can be found in the `VehicleManager` section. -```python -def create_vehicle_manager(self, application, - map_helper=None, - data_dump=False): - # By default, we use lincoln as our cav model. - cav_vehicle_bp = self.world.get_blueprint_library().find('vehicle.lincoln.mkz2017') - single_cav_list = [] - # Each entry in the list corresponds to a CAV - for i, cav_config in enumerate(self.scenario_params['scenario']['single_cav_list']): - spawn_transform = function_to_load_spawn_position(cav_config) - cav_vehicle_bp.set_attribute('color', '0, 0, 255') - vehicle = self.world.spawn_actor(cav_vehicle_bp, spawn_transform) - # create vehicle manager for each cav - vehicle_manager = VehicleManager(vehicle, cav_config, application,...) - self.world.tick() - vehicle_manager.v2x_manager.set_platoon(None) - # Set the destination of the vehicle according to the configuration - destination = carla.Location(x=cav_config['destination'][0], - y=cav_config['destination'][1], - z=cav_config['destination'][2]) - # The `update_info` method will call the internal localization module and perception module - # to update position and detected objects. - # Those information is then again passed to the v2x_manager/controller/BehaviorAgent module. - vehicle_manager.update_info() - vehicle_manager.set_destination(vehicle_manager.vehicle.get_location(),destination,clean=True) - - single_cav_list.append(vehicle_manager) - - return single_cav_list -``` + ```python + def create_vehicle_manager(self, application, + map_helper=None, + data_dump=False): + # By default, we use lincoln as our cav model. + cav_vehicle_bp = self.world.get_blueprint_library().find('vehicle.lincoln.mkz2017') + single_cav_list = [] + # Each entry in the list corresponds to a CAV + for i, cav_config in enumerate(self.scenario_params['scenario']['single_cav_list']): + spawn_transform = function_to_load_spawn_position(cav_config) + cav_vehicle_bp.set_attribute('color', '0, 0, 255') + vehicle = self.world.spawn_actor(cav_vehicle_bp, spawn_transform) + # create vehicle manager for each cav + vehicle_manager = VehicleManager(vehicle, cav_config, application,...) + self.world.tick() + vehicle_manager.v2x_manager.set_platoon(None) + # Set the destination of the vehicle according to the configuration + destination = carla.Location(x=cav_config['destination'][0], + y=cav_config['destination'][1], + z=cav_config['destination'][2]) + # The `update_info` method will call the internal localization module and perception module + # to update position and detected objects. + # Those information is then again passed to the v2x_manager/controller/BehaviorAgent module. + vehicle_manager.update_info() + vehicle_manager.set_destination(vehicle_manager.vehicle.get_location(),destination,clean=True) + + single_cav_list.append(vehicle_manager) + + return single_cav_list + ``` + + * `create_platoon_manager()` -This method will first loop over the predefined platoon list. For each platoon, we will create a `PlatooningManager` object to group all the vehicles within the platoon. In the current version, we assume the first vehicle in the platoon is the lead vehicle. After creating all of the vehicles of each platoon, it will return a list of `PlatooningManager`. As a result, we can control the behavior of each platoon via a single line of code without worrying about details of how each vehicle will react. + This method will first loop over the predefined platoon list. For each platoon, we will create a `PlatooningManager` object to group all the vehicles within the platoon. In the current version, we assume the first vehicle in the platoon is the lead vehicle. After creating all of the vehicles of each platoon, it will return a list of `PlatooningManager`. As a result, we can control the behavior of each platoon via a single line of code without worrying about details of how each vehicle will react. ```python def create_platoon_manager(self, map_helper=None, data_dump=False): @@ -171,34 +158,36 @@ This method will first loop over the predefined platoon list. For each platoon, self.world.get_blueprint_library().find('vehicle.lincoln.mkz2017') # create platoons for i, platoon in enumerate(self.scenario_params['scenario']['platoon_list']): - platoon_manager = PlatooningManager(platoon, self.cav_world) - for j, cav in enumerate(platoon['members']): - # Similar as spawning single CAV, we need to create its start location (spawn_transform) - # and set its color etc. - ... - vehicle = self.world.spawn_actor(cav_vehicle_bp,spawn_transform) - # create vehicle manager for each cav - vehicle_manager = VehicleManager(vehicle, cav, ['platooning'], - self.carla_map, self.cav_world, - current_time=self.scenario_params['current_time'], - data_dumping=data_dump) - # add the vehicle manager to platoon - if j == 0: - platoon_manager.set_lead(vehicle_manager) - else: - platoon_manager.add_member(vehicle_manager, leader=False) - self.world.tick() - destination = carla.Location(x=platoon['destination'][0], - y=platoon['destination'][1], - z=platoon['destination'][2]) - platoon_manager.set_destination(destination) - platoon_manager.update_member_order() - platoon_list.append(platoon_manager) - return platoon_list + platoon_manager = PlatooningManager(platoon, self.cav_world) + for j, cav in enumerate(platoon['members']): + # Similar as spawning single CAV, we need to create its start location (spawn_transform) + # and set its color etc. + ... + vehicle = self.world.spawn_actor(cav_vehicle_bp,spawn_transform) + # create vehicle manager for each cav + vehicle_manager = VehicleManager(vehicle, cav, ['platooning'], + self.carla_map, self.cav_world, + current_time=self.scenario_params['current_time'], + data_dumping=data_dump) + # add the vehicle manager to platoon + if j == 0: + platoon_manager.set_lead(vehicle_manager) + else: + platoon_manager.add_member(vehicle_manager, leader=False) + self.world.tick() + destination = carla.Location(x=platoon['destination'][0], + y=platoon['destination'][1], + z=platoon['destination'][2]) + platoon_manager.set_destination(destination) + platoon_manager.update_member_order() + platoon_list.append(platoon_manager) + return platoon_list ``` + + * `create_traffic_carla()` -This method will create the `carla.TrafficManager` and set associated parameters. Afterward, it will spawn the background vehicles. For spawning the vehicles, there are two options -- `spawn_vehicle_by_range` and `spawn_vehicles_by_list`. Depending on the way you configure them, the code will choose the associated one to do the task. Here for illustration, we use the `spawn_vehicles_by_list`. + This method will create the `carla.TrafficManager` and set associated parameters. Afterward, it will spawn the background vehicles. For spawning the vehicles, there are two options -- `spawn_vehicle_by_range` and `spawn_vehicles_by_list`. Depending on the way you configure them, the code will choose the associated one to do the task. Here for illustration, we use the `spawn_vehicles_by_list`. ```python def create_traffic_carla(self): @@ -206,11 +195,11 @@ This method will create the `carla.TrafficManager` and set associated parameters # get carla.TrafficManager tm = self.client.get_trafficmanager() tm.set_global_distance_to_leading_vehicle( - traffic_config['global_distance']) + traffic_config['global_distance']) tm.set_synchronous_mode(traffic_config['sync_mode']) tm.set_osm_mode(traffic_config['set_osm_mode']) tm.global_percentage_speed_difference(traffic_config['global_speed_perc']) - + bg_list = spawn_vehicles_by_list(tm, traffic_config, bg_list) return tm, bg_list @@ -342,11 +331,7 @@ For the current version, the main function we provide is detection. And there ar ### LocalizationManager -The `LocalizationManager` will spawn location-related sensors including GNSS and IMU. -And it will use the Kalman Filter to keep track of cars' location and speed. - Though we read the speed and yaw angle directly from the server, - to simulate the real world's uncertainty, noise is also added to the data retrieved from the server. - And user can control the noise level by changing the parameters like `speed_stddev` in `yaml` file. +The `LocalizationManager` will spawn location-related sensors including GNSS and IMU. And it will use the Kalman Filter to keep track of cars' location and speed. Though we read the speed and yaw angle directly from the server, to simulate the real world's uncertainty, noise is also added to the data retrieved from the server. And user can control the noise level by changing the parameters like `speed_stddev` in `yaml` file. ```python class LocalizationManager(object): @@ -422,36 +407,36 @@ class BehaviorAgent(object): ``` * `update_information` - -The `VehicleManager` will call `agent.update_information` to update the position and speed as well as the detected objects. Afterward, the agent will update the local planner with the new speed/location information. For the detected objects, it may contain the vehicles that are about to join the platooning and those vehicles should be managed by the platooning manager. Thus we should remove those vehicles from the `objects` like shown below. Besides, we will also update the traffic light state here. + The `VehicleManager` will call `agent.update_information` to update the position and speed as well as the detected objects. Afterward, the agent will update the local planner with the new speed/location information. For the detected objects, it may contain the vehicles that are about to join the platooning and those vehicles should be managed by the platooning manager. Thus we should remove those vehicles from the `objects` like shown below. Besides, we will also update the traffic light state here. + ```python def update_information(self, ego_pos, ego_speed, objects): - # update localization information - self._ego_speed = ego_speed - self._ego_pos = ego_pos - self.break_distance = self._ego_speed / 3.6 * self.emergency_param - - # update the localization info to trajectory planner - self.get_local_planner().update_information(ego_pos, ego_speed) - # The white list contains all position of target platoon member for joining. - # Those vehicles should be managed by platooning manager. Thus we should remove them. - # Right now the white_list_match function will associate the vehicles - # based on their lane_id and location. - obstacle_vehicles = objects['vehicles'] - self.obstacle_vehicles = self.white_list_match(obstacle_vehicles) - - # update the debug helper - self.debug_helper.update(ego_speed, self.ttc) - if self.ignore_traffic_light: - self.light_state = "Green" - else: - # This method also includes stop signs and intersections. - self.light_state = str(self.vehicle.get_traffic_light_state()) + # update localization information + self._ego_speed = ego_speed + self._ego_pos = ego_pos + self.break_distance = self._ego_speed / 3.6 * self.emergency_param + + # update the localization info to trajectory planner + self.get_local_planner().update_information(ego_pos, ego_speed) + # The white list contains all position of target platoon member for joining. + # Those vehicles should be managed by platooning manager. Thus we should remove them. + # Right now the white_list_match function will associate the vehicles + # based on their lane_id and location. + obstacle_vehicles = objects['vehicles'] + self.obstacle_vehicles = self.white_list_match(obstacle_vehicles) + + # update the debug helper + self.debug_helper.update(ego_speed, self.ttc) + if self.ignore_traffic_light: + self.light_state = "Green" + else: + # This method also includes stop signs and intersections. + self.light_state = str(self.vehicle.get_traffic_light_state()) ``` - + * `set_destination` -Given the start location and end location, it will find the closest waypoints in the map to each of them. And we will use those 2 waypoints as the starting and end node. We will use the following code to make sure the starting node is always in front of the vehicle. + Given the start location and end location, it will find the closest waypoints in the map to each of them. And we will use those 2 waypoints as the starting and end node. We will use the following code to make sure the starting node is always in front of the vehicle. ```python _, angle = cal_distance_angle(self.start_waypoint.transform.location, cur_loc, cur_yaw) @@ -460,6 +445,7 @@ Given the start location and end location, it will find the closest waypoints in _, angle = cal_distance_angle( self.start_waypoint.transform.location, cur_loc, cur_yaw) ``` + And we will call `self._trace_route` to find the list of waypoints from the starting node to the end node. Then, we will store the route into the buffer `self.waypoints_queue`. @@ -468,7 +454,7 @@ Given the start location and end location, it will find the closest waypoints in This method will find the path from the `start_waypoint` to the `end_waypoint`. If the global plan has not been set before, it will load the `GlobalRoutePlanner` first. The algorithm for searching can be summarized as follows. * Given the `start_waypoint`, find the edge in the original graph containing this waypoint's location (achieved through `GlobalRoutePlanner._localize`). And use the start node of the edge as the actual search origin. Through the same process, we can find the actual destination based on the provided `end_point`. - * Use A$^*$ algorithm to find the path from origin to destination. The path will contain a list of waypoints. The waypoint is either the start or end of a lane segment. Add the destination at the end of the path. + * Use A* algorithm to find the path from origin to destination. The path will contain a list of waypoints. The waypoint is either the start or end of a lane segment. Add the destination at the end of the path. * For each of the traversed edges in the path, we can find the corresponding turn decision (it is called RoadOption, e.g. lanefollow, left, right turn, etc.). See `RoadOption` class for complete definition. Then, loop over the edges, * If the turn decision of the edge is lanefollow or void, then also add the `edge['path']` with associated RoadOption to the path. * Else, only add current_waypoint and a point in the target lane with a certain distance away. (see `GlobalRoutePlanner.trace_route` for details.) @@ -478,36 +464,34 @@ Given the start location and end location, it will find the closest waypoints in * `run_step` -This method contains the function of behavior regulation and trajectory generation. To obey the traffic rules and consider the dynamic road elements, we have designed the following cases. Each case will have distinct driving behavior. + This method contains the function of behavior regulation and trajectory generation. To obey the traffic rules and consider the dynamic road elements, we have designed the following cases. Each case will have distinct driving behavior. + + * Destination arrived -* Destination arrived + If the current location is near a radius of the destination ($10$ meters by default), the vehicle has arrived at the destination and we will exit the agent. - If the current location is near a radius of the destination ($10$ meters by default), the vehicle has arrived at the destination and we will exit the agent. + * Red traffic light -* Red traffic light + If the vehicle is in the junction and the traffic light is red, then return a target speed of 0. Here we also consider the case when the car has moved to the center of the junction and the traffic light turns green at the current timestamp. In this case, it is very dangerous for the car to stop at the center of the junction. Thus we will use `light_id_to_ignore` to ignore this red light so that the car will continue moving. See [code](https://github.com/ucla-mobility/OpenCDA/blob/555aeab2bac7471d9400c51aea9c76741954b54b/opencda/core/plan/behavior_agent.py#L352) for details - If the vehicle is in the junction and the traffic light is red, then return a target speed of 0. Here we also consider the case when the car has moved to the center of the junction and the traffic light turns green at the current timestamp. In this case, it is very dangerous for the car to stop at the center of the junction. Thus we will use `light_id_to_ignore` to ignore this red light so that the car will continue moving. See [code](https://github.com/ucla-mobility/OpenCDA/blob/555aeab2bac7471d9400c51aea9c76741954b54b/opencda/core/plan/behavior_agent.py#L352) for details + * Lane change behaviors -* Lane change behaviors - * If the car is near the intersection, for safety concerns, the overtake and lane change are not allowed. - * If the curvature of the road is high, the lane change is disabled. - * If a lane change is allowed and the global plan indeed outputs a lane change path, then do a collision check to see if the target lane is free. + * If the car is near the intersection, for safety concerns, the overtake and lane change are not allowed. + * If the curvature of the road is high, the lane change is disabled. + * If a lane change is allowed and the global plan indeed outputs a lane change path, then do a collision check to see if the target lane is free. -* Car following + * Car following - If the car following mode is on, follow the leading car. + If the car following mode is on, follow the leading car. -* Normal Mode + * Normal Mode - For the normal mode, we will sample points along the path and return the target speed and target location. + For the normal mode, we will sample points along the path and return the target speed and target location. ### V2XManager -`V2XManager` is used to receive information from other CAVs and deliver ego information to them. -The class attributes `ego_pos` and `ego_spped` are both deque type. Such data type is used to -simulate the signal lagging during communication, e.g. `ego_pos[-3]` represents there is a lag -of 2 time steps(`ego_pos[-1]` represents the most recent one). +`V2XManager` is used to receive information from other CAVs and deliver ego information to them. The class attributes `ego_pos` and `ego_spped` are both deque type. Such data type is used to simulate the signal lagging during communication, e.g., `ego_pos[-3]` represents there is a lag of 2 time steps (`ego_pos[-1]` represents the most recent one). ```python class V2XManager(object): @@ -550,12 +534,11 @@ class V2XManager(object): self.lag = config_yaml['lag'] ``` -* `update_info`
- This method updates the ego vehicle's speed and position and passes the updated information to - different application plugins. Also, this method searches all of the neighboring vehicles within range. To search the vehicles, we need to retrieve a list of registered vehicles' information from `CavWorld`. For each vehicle in the list, we compute its distance to the ego vehicle. - If the distance is less than the threshold (`communication_range`), we consider it as a neighboring vehicle. - - ```python +* `update_info` + + This method updates the ego vehicle's speed and position and passes the updated information to different application plugins. Also, this method searches all of the neighboring vehicles within range. To search the vehicles, we need to retrieve a list of registered vehicles' information from `CavWorld`. For each vehicle in the list, we compute its distance to the ego vehicle. If the distance is less than the threshold (`communication_range`), we consider it as a neighboring vehicle. + + ```python def update_info(self, ego_pos, ego_spd): self.ego_pos.append(ego_pos) self.ego_spd.append(ego_spd) @@ -564,14 +547,14 @@ class V2XManager(object): # the ego pos in platooning_plugin is used for self-localization, # so we shouldn't add noise or lag. self.platooning_plugin.update_info(ego_pos, ego_spd) - ``` + ``` -* `get_ego_pos`
- This method adds noise and lags to the ego pose and then delivers to - other CAVs. +* `get_ego_pos` - ```python + This method adds noise and lags to the ego pose and then delivers to other CAVs. + + ```python def get_ego_pos(self): # add lag ego_pos = self.ego_pos[0] if len(self.ego_pos) < self.lag else \ @@ -588,6 +571,6 @@ class V2XManager(object): processed_ego_pos = carla.Transform(noise_location, noise_rotation) return processed_ego_pos + + ``` - ``` - \ No newline at end of file diff --git a/docs/md_files/getstarted.md b/docs/md_files/getstarted.md index d4618c1e..a164bdf0 100644 --- a/docs/md_files/getstarted.md +++ b/docs/md_files/getstarted.md @@ -1,6 +1,6 @@ ## Quick Start -OpenCDA provides benchmark scenarios that researchers can use directly without any modification. Running these +OpenCDA provides benchmark scenarios that researchers can use directly without any modification. We will also be adding new testing scenarios in future releases. Running these scenario testings only need one line of command: ```she cd ~/OpenCDA @@ -14,7 +14,7 @@ Parameters explanation: set, Pytorch will be imported. * `--record` (Optional): A flag to indicate whether to record this simulation. [Check here for more details](https://carla.readthedocs.io/en/latest/adv_recorder/). -Below we will demonstrate some examples of running the benchmark testings in OpenCDA +Below we will demonstrate some examples of running the benchmark testings in OpenCDA. --- ### Single Vehicle Test @@ -22,7 +22,7 @@ Below we will demonstrate some examples of running the benchmark testings in Ope ```sh python opencda.py -t single_2lanefree_carla ``` -In this scenario , a single Connected Automated Vehicle will be spawn at a 2-lane highway customized map. This +In this scenario , a single Connected Automated Vehicle will be spawned at a 2-lane highway customized map. This CAV will try to reach the assigned destination with a desired speed of 100km/h and manage to safely interact with the surrounding traffic flow. The CAV's localization, planning, and control modules will be activated, and the perception module will be deactivated by default, thus pytorch is NOT required in this testing .
@@ -63,7 +63,7 @@ In this scenario, a platoon with 4 members will be placed at the 2-lane highway and decreases its speed to test whether the members can still keep the desired time gap. In this way, the platoon stability is verified. -#### 2. Cooperative merge and join a platoon +#### 2. Cooperative merge and joining a platoon ```sh python opencda.py -t platoon_joining_2lanefree_carla ``` @@ -72,7 +72,7 @@ merging lane, communicate with the platoon to cooperatively merge into the mainl ![](images/platoon_joining_2lanefree.gif) -#### 3. Cooperative merge and join a platoon under co-simulation (Sumo required) +#### 3. Cooperative merge and joining a platoon under co-simulation (SUMO required) ```sh python opencda.py -t platoon_joining_2lanefree_cosim ``` @@ -82,6 +82,6 @@ python opencda.py -t platoon_joining_2lanefree_cosim ```sh python opencda.py -t platoon_joining_town06_carla --apply_ml ``` -A single CAV will try to overtake several human-drive vehicles to join the platoon from the back side. +A single CAV will try to overtake several human-driven vehicles to join the platoon from the back. Pytorch is required for this test since we use yolov5 detetion. ![](images/platoon_joining_town06.gif) \ No newline at end of file diff --git a/docs/md_files/installation.md b/docs/md_files/installation.md index 37aedd05..8a31e436 100644 --- a/docs/md_files/installation.md +++ b/docs/md_files/installation.md @@ -2,7 +2,7 @@ * [__System/Hardware Requirements__](#requirements) * [__Local Installation__](#local-installation) - * [__1,CARLA installation__](#1-carla-installation0911-required) + * [__1. CARLA installation__](#1-carla-installation0911-required) * [1.1 Package installation](#11-package-installation) * [1.2 Build from source](#12-build-from-source) @@ -20,13 +20,13 @@ To get started, the following requirements should be fulfilled. * __Adequate GPU.__ CARLA is a realistic simulation platform based on Unity, which requires at least a 3GB GPU for smooth scene rendering, though 8GB is recommended. * __Disk Space.__ Estimate 100GB of space is recommended to install CARLA and Unreal Engine. -* __Python__ Python3,7 or higher version is required for full functions. +* __Python__ Python3.7 or higher version is required for full functions. --- ## Local Installation To get OpenCDA v0.1 running with complete functionality, you will need four things: CARLA, OpenCDA, and -Pytorch (optional). Pytorch is required only when you want to activate the perception module, otherwise OpenCDA +Pytorch (optional). Pytorch is required only when you want to activate the perception module; otherwise OpenCDA will retrieve all perception information from the simulation server directly. ### 1. CARLA Installation (0.9.11 required) @@ -36,7 +36,7 @@ Note: If you want to use the customized highway map with full assets (.fbx, .xml you have to build from source. Visit CARLA's tutorial [ADD a new map](https://carla.readthedocs.io/en/latest/tuto_A_add_map_overview/) for more information. -#### 1.1 Package installation +#### 1.1 Package Installation

@@ -122,10 +122,10 @@ After pytorch installation, install the requirements for Yolov5.
pip install -qr https://raw.githubusercontent.com/ultralytics/yolov5/master/requirements.txt # install dependencies ``` -### 4. Install Sumo (Optional) -Sumo installation is only required for the users who require to conduct co-simulation testing. +### 4. Install SUMO (Optional) +SUMO installation is only required for the users who require to conduct co-simulation testing and use future release of SUMO-only mode. -You can install sumo directly by apt-get: +You can install SUMO directly by apt-get: ```sh sudo add-apt-repository ppa:sumo/stable sudo apt-get update diff --git a/docs/md_files/introduction.md b/docs/md_files/introduction.md index d4583861..89299e70 100644 --- a/docs/md_files/introduction.md +++ b/docs/md_files/introduction.md @@ -1,9 +1,9 @@ ## OpenCDA Overview Current autonomous driving simulation platforms that support scene rendering and traffic simulation mainly concentrate -on single-vehicle intelligence, therefore, developing and testing Cooperative Driving Automation applications(e.g., cooperative perception, -cooperative merge) under a realistic simulated environment becomes difficult. +on single-vehicle intelligence; therefore, developing and testing Cooperative Driving Automation applications (e.g., cooperative perception, +platooning, signalized intersection approach and departure) under a realistic simulated environment becomes difficult. -OpenCDA is created to fill such gap. +OpenCDA is created to fill such gaps.

@@ -19,7 +19,7 @@ OpenCDA is created to fill such gap. Built upon these basic modules, OpenCDA supports a range of common cooperative driving applications.
2. Co-Simulation Tools:
OpenCDA provides interfaces to integrate multiple open-source simulation tools with the cooperative driving system. Through the interfaces, OpenCDA is able to take advantage of the high-quality scene rendering - and realistic dynamic modelling from CARLA , and the realistic traffic simulation from SUMO. + and realistic dynamic modelling from CARLA , and the realistic traffic simulation from SUMO. Also, CARLA only and SUMO only mode of OpenCDA also offers researchers the flexibility to test vehicle-level and traffic-level performance, respectively. 3. Scenario Manager:
By defining the parameters in the Yaml file, OpenCDA is able to construct the simulation scenario, creating the traffic flows, and assigning various dynamic driving tasks to different connected automated vehicles. @@ -27,11 +27,11 @@ OpenCDA is created to fill such gap. OpenScenario will be supported to trigger special events. ### Key Features -The key features of OpenCDA can be summarized as CIFMB: -* Connectivity and Cooperation: OpenCDA supports various levels and categories of cooperation between CAVs in simulation. +The key features of OpenCDA are: +* Full-stack CDA System: OpenCDA provides a full-stack automated driving and cooperative driving software system that contains perception, localization, planning, control, and V2X communication modules. +* Connectivity and Cooperation: OpenCDA supports various levels and categories of cooperation between CAVs in simulation. This differentiates OpenCDA with other single vehicle automation tools. This differentiates OpenCDA with other single vehicle automation tools. -* Integration: OpenCDA integrates CARLA and SUMO together for realistic scene rendering, vehicle modeling and traffic simulation. -* Full-stack System: OpenCDA provides a full-stack software system that contains perception, localization, planning, control, and V2X communication modules. -* Modularity: OpenCDA is highly modularized, enabling users to conveniently replace any default algorithms or protocols with their own customzied design. -* Benchmark: OpenCDA offers benchmark testing scenarios, state-of-the-art benchmark algorithms for all modules, benchmark testing road maps, and benchmark evaluation metrics. +* Integration: OpenCDA utilizes CARLA and SUMO separately, as well as integrates them together for realistic scene rendering, vehicle modeling, and traffic simulation. It is also efficient and flexible enough to be applied for software-in-the-loop and hardware-in-the-loop testing. +* Modularity: OpenCDA is highly modularized, enabling users to conveniently replace any default algorithms or protocols with their own customzied design. +* Benchmark: OOpenCDA offers benchmark testing scenarios, benchmark baseline maps, state-of-the-art benchmark algorithms for ADS and Cooperative ADS functions, and benchmark evaluation metrics. diff --git a/docs/md_files/traffic_generation.md b/docs/md_files/traffic_generation.md index 285b0682..c7e9da3e 100644 --- a/docs/md_files/traffic_generation.md +++ b/docs/md_files/traffic_generation.md @@ -1,6 +1,6 @@ ## Traffic Generation -OpenCDA supports two different ways to generate the background traffic flow: CARLA traffic manager and Sumo traffic simulation. +OpenCDA supports two different ways to generate the background traffic flow: CARLA traffic manager and SUMO traffic simulation. The traffic and other scenario generation function are currently being enhanced and will be released in the future. --- ### CARLA Traffic Manager diff --git a/docs/md_files/yaml_define.md b/docs/md_files/yaml_define.md index 7455123b..e35eb9ff 100644 --- a/docs/md_files/yaml_define.md +++ b/docs/md_files/yaml_define.md @@ -148,7 +148,7 @@ Users do not need to define this parameter if co-simulation is conducted as Sumo There are two ways to define the positions of the background vehicles. * Set the parameter `vehicle_list` under `carla_traffic_manager` as a list. An example is demonstrated below. In this example, two vehicles are spawned as background vehicle. The first one is spawned at position `x=100, y=100, z=0.3`, -and the initial rotation angle is `roll=0, yaw=20(degree), pitch=0`. The second one is spawned at position +and the initial rotation angle is `roll=0, yaw=20 (degree), pitch=0`. The second one is spawned at position `x=122, y=666, z=0.3`, and the angle is `roll=0, yaw=0, pitch=0`. ```yaml carla_traffic_manager: diff --git a/opencda.py b/opencda.py index ecd73312..7d2c22ff 100644 --- a/opencda.py +++ b/opencda.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import argparse import importlib diff --git a/opencda/core/actuation/control_manager.py b/opencda/core/actuation/control_manager.py index 41411bfc..88d8f0a6 100644 --- a/opencda/core/actuation/control_manager.py +++ b/opencda/core/actuation/control_manager.py @@ -3,7 +3,7 @@ Controller interface """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import importlib diff --git a/opencda/core/actuation/pid_controller.py b/opencda/core/actuation/pid_controller.py index 1feafe7e..274df9ac 100644 --- a/opencda/core/actuation/pid_controller.py +++ b/opencda/core/actuation/pid_controller.py @@ -2,8 +2,13 @@ """ PID Control Class """ -# Author: Runsheng Xu -# License: MIT + +# Copyright (c) # Copyright (c) 2018-2020 CVC. +# +# This work is licensed under the terms of the MIT license. +# For a copy, see . + + from collections import deque import math diff --git a/opencda/core/application/platooning/fsm.py b/opencda/core/application/platooning/fsm.py index ceaefafc..f749f991 100644 --- a/opencda/core/application/platooning/fsm.py +++ b/opencda/core/application/platooning/fsm.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib from enum import Enum diff --git a/opencda/core/application/platooning/platoon_behavior_agent.py b/opencda/core/application/platooning/platoon_behavior_agent.py index 96e42266..1bd84bae 100644 --- a/opencda/core/application/platooning/platoon_behavior_agent.py +++ b/opencda/core/application/platooning/platoon_behavior_agent.py @@ -3,7 +3,7 @@ """Behavior manager for platooning specifically """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import weakref from collections import deque diff --git a/opencda/core/application/platooning/platoon_debug_helper.py b/opencda/core/application/platooning/platoon_debug_helper.py index 7269f1b8..88380602 100644 --- a/opencda/core/application/platooning/platoon_debug_helper.py +++ b/opencda/core/application/platooning/platoon_debug_helper.py @@ -3,7 +3,7 @@ Analysis + visualization functions for platooning """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib from opencda.core.plan.planer_debug_helper \ import PlanDebugHelper diff --git a/opencda/core/application/platooning/platooning_manager.py b/opencda/core/application/platooning/platooning_manager.py index d3a17899..ac09f908 100644 --- a/opencda/core/application/platooning/platooning_manager.py +++ b/opencda/core/application/platooning/platooning_manager.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import uuid import weakref diff --git a/opencda/core/application/platooning/platooning_plugin.py b/opencda/core/application/platooning/platooning_plugin.py index 4a1e27e2..14a15fde 100644 --- a/opencda/core/application/platooning/platooning_plugin.py +++ b/opencda/core/application/platooning/platooning_plugin.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import warnings diff --git a/opencda/core/common/cav_world.py b/opencda/core/common/cav_world.py index 3609b633..d470939f 100644 --- a/opencda/core/common/cav_world.py +++ b/opencda/core/common/cav_world.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import importlib diff --git a/opencda/core/common/data_dumper.py b/opencda/core/common/data_dumper.py index 1dd12a30..32647dca 100644 --- a/opencda/core/common/data_dumper.py +++ b/opencda/core/common/data_dumper.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import os diff --git a/opencda/core/common/v2x_manager.py b/opencda/core/common/v2x_manager.py index 9a8b24f7..99466c82 100644 --- a/opencda/core/common/v2x_manager.py +++ b/opencda/core/common/v2x_manager.py @@ -3,7 +3,7 @@ """Communication manager for cooperation """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib from collections import deque import weakref diff --git a/opencda/core/common/vehicle_manager.py b/opencda/core/common/vehicle_manager.py index 43a90354..e4bf402b 100644 --- a/opencda/core/common/vehicle_manager.py +++ b/opencda/core/common/vehicle_manager.py @@ -3,7 +3,7 @@ Basic class of CAV """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import uuid diff --git a/opencda/core/plan/behavior_agent.py b/opencda/core/plan/behavior_agent.py index e036b848..bb8c28b0 100644 --- a/opencda/core/plan/behavior_agent.py +++ b/opencda/core/plan/behavior_agent.py @@ -1,14 +1,12 @@ -# Copyright (c) # Copyright (c) 2018-2020 CVC. -# -# This work is licensed under the terms of the MIT license. -# For a copy, see . +# -*- coding: utf-8 -*- - -""" This module implements an agent that roams around a track following random -waypoints and avoiding other vehicles. The agent also responds to - traffic lights, traffic signs, and has different possible configurations. +"""Behavior planning module """ +# Author: Runsheng Xu +# License: TDG-Attribution-NonCommercial-NoDistrib + + import math import random import sys diff --git a/opencda/core/plan/collision_check.py b/opencda/core/plan/collision_check.py index bb8c71e7..94de3062 100644 --- a/opencda/core/plan/collision_check.py +++ b/opencda/core/plan/collision_check.py @@ -2,7 +2,7 @@ """ This module is used to check collision possibility """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import math from math import sin, cos from scipy import spatial diff --git a/opencda/core/plan/drive_profile_plotting.py b/opencda/core/plan/drive_profile_plotting.py index e209a0d9..f99323a4 100644 --- a/opencda/core/plan/drive_profile_plotting.py +++ b/opencda/core/plan/drive_profile_plotting.py @@ -3,7 +3,7 @@ """Tools to plot velocity, acceleration, and curvation. """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import matplotlib.pyplot as plt import numpy as np diff --git a/opencda/core/plan/local_planner_behavior.py b/opencda/core/plan/local_planner_behavior.py index 9aa84eee..e9da17ca 100644 --- a/opencda/core/plan/local_planner_behavior.py +++ b/opencda/core/plan/local_planner_behavior.py @@ -3,7 +3,7 @@ low-level waypoint following based on PID controllers. """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib from collections import deque from enum import Enum diff --git a/opencda/core/plan/planer_debug_helper.py b/opencda/core/plan/planer_debug_helper.py index cd7ca68a..1981fad4 100644 --- a/opencda/core/plan/planer_debug_helper.py +++ b/opencda/core/plan/planer_debug_helper.py @@ -3,7 +3,7 @@ Analysis + Visualization functions for planning """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import warnings import numpy as np diff --git a/opencda/core/sensing/localization/coordinate_transform.py b/opencda/core/sensing/localization/coordinate_transform.py index 1efda6a1..07bbb6fb 100644 --- a/opencda/core/sensing/localization/coordinate_transform.py +++ b/opencda/core/sensing/localization/coordinate_transform.py @@ -3,7 +3,7 @@ Functions to transfer coordinates under different coordinate system """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import numpy as np diff --git a/opencda/core/sensing/localization/kalman_filter.py b/opencda/core/sensing/localization/kalman_filter.py index 4956e2c8..e9b09c1f 100644 --- a/opencda/core/sensing/localization/kalman_filter.py +++ b/opencda/core/sensing/localization/kalman_filter.py @@ -4,7 +4,7 @@ Reference: https://www.bzarg.com/p/how-a-kalman-filter-works-in-pictures/ """ # Author: Runsheng Xu , Xin Xia -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import math import numpy as np diff --git a/opencda/core/sensing/localization/localization_debug_helper.py b/opencda/core/sensing/localization/localization_debug_helper.py index 42601fe5..5bb3093f 100644 --- a/opencda/core/sensing/localization/localization_debug_helper.py +++ b/opencda/core/sensing/localization/localization_debug_helper.py @@ -3,7 +3,7 @@ Visualization tools for localization """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import numpy as np import matplotlib diff --git a/opencda/core/sensing/localization/localization_manager.py b/opencda/core/sensing/localization/localization_manager.py index 4b064e0a..c8ded024 100644 --- a/opencda/core/sensing/localization/localization_manager.py +++ b/opencda/core/sensing/localization/localization_manager.py @@ -3,7 +3,7 @@ Localization module """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import weakref from collections import deque @@ -24,19 +24,23 @@ class GnssSensor(object): The default GNSS sensor module. Parameters - -vehicle : carla.Vehicle + vehicle : carla.Vehicle The carla.Vehicle. We need this class to spawn our gnss and imu sensor. - -config : dict + + config : dict The configuration dictionary of the localization module. Attributes - -world : carla.world + world : carla.world The caral world of the current vehicle. - -blueprint : carla.blueprint + + blueprint : carla.blueprint The current blueprint of the sensor actor. - -weak_self : opencda Object + + weak_self : opencda Object A weak reference point to avoid circular reference. - -sensor : CARLA actor + + sensor : CARLA actor The current sensor actors that will be attach to the vehicles. """ @@ -90,17 +94,20 @@ class ImuSensor(object): Default ImuSensor module. Parameters - -vehicle : carla.Vehicle + vehicle : carla.Vehicle The carla.Vehicle. We need this class to spawn our gnss and imu sensor. Attributes - -world : carla.world + world : carla.world The caral world of the current vehicle. - -blueprint : carla.blueprint + + blueprint : carla.blueprint The current blueprint of the sensor actor. - -weak_self : opencda Object + + weak_self : opencda Object A weak reference point to avoid circular reference. - -sensor : CARLA actor + + sensor : CARLA actor The current sensor actors that will be attach to the vehicles. """ @@ -144,24 +151,24 @@ class LocalizationManager(object): Default localization module. Parameters - -vehicle : carla.Vehicle + vehicle : carla.Vehicle The carla.Vehicle. We need this class to spawn our gnss and imu sensor. - -config_yaml : dict + config_yaml : dict The configuration dictionary of the localization module. - -carla_map : carla.Map + carla_map : carla.Map The carla HDMap. We need this to find the map origin to convert wg84 to enu coordinate system. Attributes - -gnss : opencda object + gnss : opencda object GNSS sensor manager for spawning gnss sensor and listen to the data transmission. - -ImuSensor : opencda object + ImuSensor : opencda object Imu sensor manager for spawning gnss sensor and listen to the data transmission. - -kf : opencda object + kf : opencda object The filter used to fuse different sensors. - -debug_helper : opencda object + debug_helper : opencda object The debug helper is used to visualize the accuracy of the localization and provide evaluation functions. """ @@ -266,11 +273,15 @@ def add_heading_direction_noise(self, heading_direction): """ Add synthetic noise to heading direction. - Args: - -heading_direction (float): groundtruth heading_direction - obtained from the server. - Returns: - -heading_direction (float): heading direction with noise. + Parameters + __________ + heading_direction : float + groundtruth heading_direction obtained from the server. + + Returns + ------- + heading_direction : float + heading direction with noise. """ return heading_direction + np.random.normal(0, self.heading_noise_std) @@ -278,11 +289,15 @@ def add_speed_noise(self, speed): """ Add gaussian white noise to the current speed. - Args: - -speed (float): m/s, current speed. + Parameters + __________ + speed : float + m/s, current speed. - Returns: - -speed (float): the speed with noise. + Returns + ------- + speed : float + the speed with noise. """ return speed + np.random.normal(0, self.speed_noise_std) diff --git a/opencda/core/sensing/perception/o3d_lidar_libs.py b/opencda/core/sensing/perception/o3d_lidar_libs.py index f664ce2b..67a9a650 100644 --- a/opencda/core/sensing/perception/o3d_lidar_libs.py +++ b/opencda/core/sensing/perception/o3d_lidar_libs.py @@ -5,7 +5,7 @@ """ # Author: CARLA Team, Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import time diff --git a/opencda/core/sensing/perception/obstacle_vehicle.py b/opencda/core/sensing/perception/obstacle_vehicle.py index 48c2fcc2..3ac342bc 100644 --- a/opencda/core/sensing/perception/obstacle_vehicle.py +++ b/opencda/core/sensing/perception/obstacle_vehicle.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import sys import carla diff --git a/opencda/core/sensing/perception/perception_manager.py b/opencda/core/sensing/perception/perception_manager.py index 79907591..58c9263c 100644 --- a/opencda/core/sensing/perception/perception_manager.py +++ b/opencda/core/sensing/perception/perception_manager.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import weakref import sys diff --git a/opencda/core/sensing/perception/sensor_transformation.py b/opencda/core/sensing/perception/sensor_transformation.py index da031b8e..76d46d60 100644 --- a/opencda/core/sensing/perception/sensor_transformation.py +++ b/opencda/core/sensing/perception/sensor_transformation.py @@ -3,7 +3,7 @@ This script contains the transformations between world and different sensors. """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import numpy as np from matplotlib import cm diff --git a/opencda/core/sensing/perception/static_obstacle.py b/opencda/core/sensing/perception/static_obstacle.py index fc60740c..01e64c93 100644 --- a/opencda/core/sensing/perception/static_obstacle.py +++ b/opencda/core/sensing/perception/static_obstacle.py @@ -4,12 +4,13 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import sys import numpy as np import carla + class BoundingBox(object): """ Bounding box class for obstacle vehicle. diff --git a/opencda/customize/core/sensing/localization/extented_kalman_filter.py b/opencda/customize/core/sensing/localization/extented_kalman_filter.py index 924b525f..84e7610d 100644 --- a/opencda/customize/core/sensing/localization/extented_kalman_filter.py +++ b/opencda/customize/core/sensing/localization/extented_kalman_filter.py @@ -3,7 +3,7 @@ Use Extended Kalman Filter on GPS + IMU for better localization. """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import math import numpy as np diff --git a/opencda/customize/core/sensing/localization/localization_manager.py b/opencda/customize/core/sensing/localization/localization_manager.py index 05ce86e7..cf7dc048 100644 --- a/opencda/customize/core/sensing/localization/localization_manager.py +++ b/opencda/customize/core/sensing/localization/localization_manager.py @@ -3,7 +3,7 @@ Customized Localization Module. """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib from opencda.core.sensing.localization.localization_manager \ import LocalizationManager diff --git a/opencda/customize/ml_libs/ml_manager.py b/opencda/customize/ml_libs/ml_manager.py index 5f05ee55..0046d997 100644 --- a/opencda/customize/ml_libs/ml_manager.py +++ b/opencda/customize/ml_libs/ml_manager.py @@ -7,7 +7,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import cv2 import torch diff --git a/opencda/opencda_carla.py b/opencda/opencda_carla.py index e0395074..cb02ff65 100644 --- a/opencda/opencda_carla.py +++ b/opencda/opencda_carla.py @@ -5,7 +5,7 @@ """ # Author: Credits to Pylot team # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib class Vector3D(object): diff --git a/opencda/scenario_testing/cooperception_datadump_town06_carla.py b/opencda/scenario_testing/cooperception_datadump_town06_carla.py index 35a14c47..3dbabf81 100644 --- a/opencda/scenario_testing/cooperception_datadump_town06_carla.py +++ b/opencda/scenario_testing/cooperception_datadump_town06_carla.py @@ -4,7 +4,7 @@ customized 2-lane freeway simplified map sorely with carla """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import carla diff --git a/opencda/scenario_testing/evaluations/evaluate_manager.py b/opencda/scenario_testing/evaluations/evaluate_manager.py index 2163833c..d4a32efe 100644 --- a/opencda/scenario_testing/evaluations/evaluate_manager.py +++ b/opencda/scenario_testing/evaluations/evaluate_manager.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import os from datetime import datetime diff --git a/opencda/scenario_testing/evaluations/utils.py b/opencda/scenario_testing/evaluations/utils.py index 5b06a667..3a3866b2 100644 --- a/opencda/scenario_testing/evaluations/utils.py +++ b/opencda/scenario_testing/evaluations/utils.py @@ -4,7 +4,7 @@ """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import sys diff --git a/opencda/scenario_testing/platoon_joining_2lanefree_carla.py b/opencda/scenario_testing/platoon_joining_2lanefree_carla.py index 9099ed8a..8cbca6a0 100644 --- a/opencda/scenario_testing/platoon_joining_2lanefree_carla.py +++ b/opencda/scenario_testing/platoon_joining_2lanefree_carla.py @@ -4,7 +4,7 @@ customized 2-lane freeway simplified map sorely with carla """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import os import carla diff --git a/opencda/scenario_testing/platoon_joining_2lanefree_cosim.py b/opencda/scenario_testing/platoon_joining_2lanefree_cosim.py index a9e84bff..cce55411 100644 --- a/opencda/scenario_testing/platoon_joining_2lanefree_cosim.py +++ b/opencda/scenario_testing/platoon_joining_2lanefree_cosim.py @@ -1,3 +1,11 @@ +# -*- coding: utf-8 -*- +""" +Scenario testing: merging vehicle joining a platoon in the +customized 2-lane freeway simplified map sorely with co-sim +""" +# Author: Runsheng Xu +# License: TDG-Attribution-NonCommercial-NoDistrib + import os import carla diff --git a/opencda/scenario_testing/platoon_joining_2lanefreecomplete_carla.py b/opencda/scenario_testing/platoon_joining_2lanefreecomplete_carla.py index f1019f4d..a183b0fb 100644 --- a/opencda/scenario_testing/platoon_joining_2lanefreecomplete_carla.py +++ b/opencda/scenario_testing/platoon_joining_2lanefreecomplete_carla.py @@ -4,7 +4,7 @@ customized 2-lane freeway simplified map sorely with carla """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import os diff --git a/opencda/scenario_testing/platoon_joining_town06_carla.py b/opencda/scenario_testing/platoon_joining_town06_carla.py index 401aa1ae..2beec572 100644 --- a/opencda/scenario_testing/platoon_joining_town06_carla.py +++ b/opencda/scenario_testing/platoon_joining_town06_carla.py @@ -5,7 +5,7 @@ map into your ue4 editor before running this """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import carla diff --git a/opencda/scenario_testing/platoon_stability_2lanefree_carla.py b/opencda/scenario_testing/platoon_stability_2lanefree_carla.py index 0b91312a..54ff59b4 100644 --- a/opencda/scenario_testing/platoon_stability_2lanefree_carla.py +++ b/opencda/scenario_testing/platoon_stability_2lanefree_carla.py @@ -4,7 +4,7 @@ freeway simplified map sorely with carla """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import sys import os diff --git a/opencda/scenario_testing/single_2lanefree_carla.py b/opencda/scenario_testing/single_2lanefree_carla.py index 7ea0af7f..916edbdc 100644 --- a/opencda/scenario_testing/single_2lanefree_carla.py +++ b/opencda/scenario_testing/single_2lanefree_carla.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- """ -Scenario testing: merging vehicle joining a platoon in the -customized 2-lane freeway simplified map sorely with carla +Scenario testing: Single vehicle dring in the customized 2 lane highway map. """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import os diff --git a/opencda/scenario_testing/single_2lanefree_cosim.py b/opencda/scenario_testing/single_2lanefree_cosim.py index b5f452ac..82e099b7 100644 --- a/opencda/scenario_testing/single_2lanefree_cosim.py +++ b/opencda/scenario_testing/single_2lanefree_cosim.py @@ -1,3 +1,12 @@ +# -*- coding: utf-8 -*- +""" +Scenario testing: Single vehicle dring in the customized 2 lane highway map +with cosimulation. +""" +# Author: Runsheng Xu +# License: TDG-Attribution-NonCommercial-NoDistrib + + import os import carla diff --git a/opencda/scenario_testing/single_intersection_town06_carla.py b/opencda/scenario_testing/single_intersection_town06_carla.py index 49760c7b..c6f5039f 100644 --- a/opencda/scenario_testing/single_intersection_town06_carla.py +++ b/opencda/scenario_testing/single_intersection_town06_carla.py @@ -4,7 +4,7 @@ customized 2-lane freeway simplified map sorely with carla """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import carla diff --git a/opencda/scenario_testing/single_town05_cosim.py b/opencda/scenario_testing/single_town05_cosim.py index 72956ad3..7f89459f 100644 --- a/opencda/scenario_testing/single_town05_cosim.py +++ b/opencda/scenario_testing/single_town05_cosim.py @@ -1,3 +1,7 @@ +# -*- coding: utf-8 -*- +# Author: Runsheng Xu +# License: TDG-Attribution-NonCommercial-NoDistrib + import os import carla diff --git a/opencda/scenario_testing/single_town06_carla.py b/opencda/scenario_testing/single_town06_carla.py index 0329f584..49a18012 100644 --- a/opencda/scenario_testing/single_town06_carla.py +++ b/opencda/scenario_testing/single_town06_carla.py @@ -1,10 +1,6 @@ # -*- coding: utf-8 -*- -""" -Scenario testing: merging vehicle joining a platoon in the -customized 2-lane freeway simplified map sorely with carla -""" # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import carla diff --git a/opencda/scenario_testing/single_town06_cosim.py b/opencda/scenario_testing/single_town06_cosim.py index 637bebb3..92eb4e74 100644 --- a/opencda/scenario_testing/single_town06_cosim.py +++ b/opencda/scenario_testing/single_town06_cosim.py @@ -1,3 +1,7 @@ +# -*- coding: utf-8 -*- +# Author: Runsheng Xu +# License: TDG-Attribution-NonCommercial-NoDistrib + import os import carla diff --git a/opencda/scenario_testing/utils/cosim_api.py b/opencda/scenario_testing/utils/cosim_api.py index bb2e6f55..396585b1 100644 --- a/opencda/scenario_testing/utils/cosim_api.py +++ b/opencda/scenario_testing/utils/cosim_api.py @@ -3,7 +3,7 @@ Co-simulation scenario manager. The code is modified from CARLA official cosimulation code. """ -# Author: Runsheng Xu +# Author: CARLA Team, Runsheng Xu # License: MIT import logging diff --git a/opencda/scenario_testing/utils/customized_map_api.py b/opencda/scenario_testing/utils/customized_map_api.py index 75a76a6c..69f21a30 100644 --- a/opencda/scenario_testing/utils/customized_map_api.py +++ b/opencda/scenario_testing/utils/customized_map_api.py @@ -2,8 +2,8 @@ """Loading world from customized map """ -# Author: Xu Han -# License: MIT +# Author: Xu Han , Runsheng Xu +# License: TDG-Attribution-NonCommercial-NoDistrib import os import sys diff --git a/opencda/scenario_testing/utils/sim_api.py b/opencda/scenario_testing/utils/sim_api.py index f7123514..9f67100d 100644 --- a/opencda/scenario_testing/utils/sim_api.py +++ b/opencda/scenario_testing/utils/sim_api.py @@ -5,7 +5,7 @@ please use cosim_api.py. """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import math import random @@ -291,7 +291,7 @@ def create_platoon_manager(self, map_helper=None, data_dump=False): platoon_manager.update_member_order() platoon_list.append(platoon_manager) - return platoon_list + return platoon_list def spawn_vehicles_by_list(self, tm, traffic_config, bg_list): """ diff --git a/opencda/scenario_testing/utils/yaml_utils.py b/opencda/scenario_testing/utils/yaml_utils.py index 57723c74..9a602fd0 100644 --- a/opencda/scenario_testing/utils/yaml_utils.py +++ b/opencda/scenario_testing/utils/yaml_utils.py @@ -3,7 +3,7 @@ Used to load and write yaml files """ # Author: Runsheng Xu -# License: MIT +# License: TDG-Attribution-NonCommercial-NoDistrib import re import yaml