All notable changes to this project will be documented in this file. All text added must be human-readable. Copy and pasting the git commit messages is NOT enough.
1.1
- 加入 test, 对于环境的测试, 是否成功安装的测试
- 加入 channel model
It is indeed a delight to announce the upgraded iteration of TransSimHub (TSHub) to version 1.0. Noteworthy in this rendition is the integration of 3D rendering capabilities, a salient feature enhancing the essence of this edition.
In comparison to Carla:
- TSHub3D swiftly transmutes sumonet into 3D files.
- TSHub3D boasts a more streamlined nature, ensuring expeditious rendering.
- TShub3D excels in user-friendliness, facilitating the effortless addition of various sensor types onto diverse objects within the scene through simple parameter configurations.
- Highlight: Introduction of 3D Visualization
- Automating the transformation of sumonet into 3D, sumonet_to_tshub3d.py expedites the conversion of SUMO Network to glb format for 3D display.
- Rendering SUMO environments into 3D, tshub_env3d.py, in conjunction with TSHub, concurrently rendering the sumo simulation information into a 3D scene.
- For insights into various sensors, the Chinese version can be found here, and the English version here.
- Enhanced base_tls.py by integrating the entry road ID, angle, and position for each intersection.
- Addressed the issue where the multifunctional lanes were unable to acquire data. Previously, this anomaly stemmed from the presence of d multifunctional lanes alongside r, s, l connections, such as rs, which led to erroneous data retrieval.
- Integrated stop line extraction within tls to discern and calculate the coordinates for placing intersection cameras.
- The abandonment of leveraging render_pipline to enhance rendering effects, with a renewed focus on rendering efficiency.
Congratulations! The paper UniTSA: A Universal Reinforcement Learning Framework for V2X Traffic Signal Control
based on TransSimHub has been accepted by IEEE Transactions on Vehicular Technology
. This paper mainly discusses the generalization of RL-based TSC tasks.
- Paper link: https://ieeexplore.ieee.org/abstract/document/10535743/
- Code link: https://github.com/wmn7/Universal-Light
- Updated static data Map:
- For nodes, added coordinate information and node types (e.g., whether it's a traffic light)
- In addition to
polygon.py
(lane, edge, and node) in the map, there's alsogrid.py
, which contains statistical information within an area (e.g., SNR within a region)
- Added results analysis section:
- Parse
tripinfo.xml
file to get statistical measures of all indicators. - Parse
route.xml
file to get the change in vehicle numbers in each time period. - Parse
tls_program.xml
file to get the change in traffic phase duration.
- Parse
- OSM to SUMO Net:
- Can convert OSM to Net map.
- According to the filtered net map, output a new OSM map, retaining only the necessary elements.
- Added
__copy_files_with_reset_num
in base_sumo_env to ensure that all output files are copied before reset to prevent overwriting. This makes it easy to analyze sumo output files. - Modified the tripinfo.out.xml file in base_env to output the fuel consumption and carbon emissions of each vehicle.
- Fixed the issue in plot_reward_curves.py where mean value and std error could not align.
- Modified setup file to install static files, resolving the issue of aircraft visualization lacking textures.
The TSHub
project has been undergoing numerous updates recently, with new features being added and different use cases being organized. Detailed scenario descriptions will be provided in the upcoming 1.0 version.
- Vehicle Updates
- Added
lane_position
attribute to thevehicle
features, which allows for the determination of the current vehicle's distance from the starting point of the lane. This feature can be utilized to divide the lane into cells and calculate vehicle metrics within each cell. - In
vehicle
, if the type isego
, collision support is now available during control, such as collisions caused by speed (vehicle_speed_crash.py) or lane changes (vehicle_laneChange_crash.py). Collision settings are completed in base_vehicle_action.py.
- Added
- Traffic Light Updates
- Added a new action for traffic light control tasks,
Choose Next Phase (Synchronize)
. This action allows all agents in multi-agent control tasks to act together, preventing interval changes between different agents' actions and facilitating multi-agent training. See example in tls_choosenextphase_syn.py. - Introduced a new action,
Adjust Cycle Durations
, which modifies the duration of each phase of the traffic light in each cycle. This allows RL to control the traffic light less frequently, making the entire system more stable. See example in tls_adjustCycleDuration.py.
- Added a new action for traffic light control tasks,
- Map Updates
- Added attributes to
map
, now the map can include the edge to which the lane belongs and the length of the lane.
- Added attributes to
- Scenario Generation
generate_routes.py
now supports the generation of different types of vehicles, such as controlling acceleration parameters. See the generated example in generate_routes.py.
- Auxiliary Features
- Added current simulation time to each step of the simulation environment, allowing users to check if the program is running normally without opening the GUI. tshub_env.py
- Added route_analysis.py to sumotool to assist in result analysis (including result analysis and visualization). See detailed example in analysis_route.py.
- Added visualization analysis for tls program in sumotool. See detailed example in analysis_tls_program.py.
- Added tensorboard installation to
setup.py
file for real-time monitoring of training results. init_log.py
file can now set different levels for logs output to the terminal, further refining the previous log_level into file_log_level and terminal_log_level, which can be set independently.- Added
Fill Outliers
toplot_reward_curve.py
to handle outliers (usually caused by poor rewards during exploration), and also added support for saving reward curve images.
- Fixed the error of visualization after installing TSHub,
Init.py -> init.py
. - Fixed vehicle action design
- Fixed the problem of vehicle lane change direction error, where the direction of lane change is calculated based on the size of the lane index.
- Fixed the problem where the vehicle did not stay in the current lane when it could not change lanes base_vehicle_action.py.
Happy New Year 2024!
- Enhanced the
vehicle
environment with new attributes:accumulated_waiting_time
: Accumulated waiting time of the vehicle.distance
: Distance traveled by the vehicle.leader
: Information about the vehicle ahead, including (vehicle id, distance).width
,length
, andheading_angle
: Attributes for visualizing vehicles in the environment.
- Introduced a pedestrian module:
- Modified the connection judgment in tls_connections.py, excluding pedestrian crossings.
- Added a testing environment for pedestrians.
- Included pedestrian state representation.
- Added two new visualization modules in ENV Render. Below is a summary of the six rendering methods:
TransSimHub Rendering Modes
|
|-- Pixel-based State Output
| |
| |-- RGB Rendering Mode
| | |
| | |-- Global Rendering
| | |-- Local Intersection Rendering
| | |-- Follow Vehicle Rendering
| |
| |-- SUMO-GUI Rendering Mode
| |
| |-- Global Rendering
| |-- Local Intersection Rendering
| |-- Follow Vehicle Rendering
- Complemented the
vehicle
section:- In feature extraction, added CO2 emissions (mg/s), fuel consumption (mg/s), and speed without traci (returns the speed the vehicle would drive if no speed-influencing command such as
setSpeed
orslowDown
was given). - In control,
lane_change=-1
now uses SUMO's lane-changing strategy, andspeed=-1
uses SUMO's speed strategy. - Updated corresponding documentation.
- In feature extraction, added CO2 emissions (mg/s), fuel consumption (mg/s), and speed without traci (returns the speed the vehicle would drive if no speed-influencing command such as
- Updated
LaneWithContinuousSpeedAction
to maintain the original speed when the target speed is set to -1. - Modified the vehicle speed scenario:
- Prevented direct lane changes for all vehicles to mitigate queuing at bottlenecks by adjusting speeds.
- Regenerated road network and traffic flow files. Refer to Vehicle Speed Scenario.
- Updated veh_wrapper.py with
__get_actions
and__update_actions
methods to generate default actions for all vehicles (speed=-1, lane=0), meaning no lane changes or speed alterations. Subsequent parameters only affect thespeed
of theego
vehicle.
- Moved the
highlight
parameter fromcontrol_objects
invehicle_builder.py
toinit
, standardizing thecontrol_objects
method for differentobjects
. - Added a
highlight
parameter intshub.py
.
- Corrected installation steps in the documentation, changed
cd TransSimHub.git
tocd TransSimHub
.
- Added environment for vehicle control
- Introduced Vehicle Speed Scenario, which is accomplished by controlling vehicle speed.
- Added plot_reward_curves.py in utils, for plotting reward curve with standard deviation from log files.
- Added examples of multi-agents for traffic signal control.
- Introduced environment Multi-Traffic Signal Control, which includes
$3$ traffic signals. - Added multi-traffic signal control environment in
TsHub
, see Multi-Agent TSC Env. - Provided examples of
MAPPO
algorithm, controlling multiple traffic signals. Detailed algorithm can be found at MAPPO Traffic Signal Control.
- Introduced environment Multi-Traffic Signal Control, which includes
- Added introduction to traffic signal control based on reinforcement learning, RL for TSC.
- Unified the connection method of
from_edge
anddirection
tof"{from_edge}--{direction}"
. - Updated doc description about the new state of traffic light,
fromEdge_toEdge
. - Updated the rule-based method in single agent to adapt to the new connection method of
from_edge
anddirection
.
- Added support for
map
to retrieve properties of different polygons- Added
polygon.py
to define the properties of a polygon - Added
map_builder.py
to initialize static information in the scene, constructing types and shapes of all polygons based on*.poly.xml
and*.osm
files
- Added
- Added examples about
map
- Created
get_poly_info.py
to retrieve properties of polygons in the map - Developed
plot_poly_shape.py
to visualize information in the map
- Created
- Introduced a utility function
osm_build.py
to convert fromosm
tosumo net
- Documented the process of creating the environment from
osm
to the map used in experiments- Export the required area from openstreetmap
- Run
osm_build.py
to generate*.net.xml
and*.poly.xml
, as demonstrated in theosm_build.py
example in thesumo_tools
directory of theexample
folder - [Optionally] Add background images
- Run
generate_detectors.py
to create detectors - Run
generate_routes.py
to generate traffic flows
- Modified
tshub
to support the static informationmap builder
- Added an example
tshub_env_map.py
to demonstrate how to access environment information inenv
- Added an example
- Added
custom_update_cover_radius
toaircraft.py
to allow users to customize the update ofcover_radius
based onposition
andcommunication_range
- Updated the default
update_cover_radius
inaircraft.py
to support parameter input and returncover_radius
- Updated the creation of
aircraft
inaircraft_builder.py
- Added an example
aircraft_custom_update_cover_radius.py
in theexample
folder to illustrate how to customizecustom_update_cover_radius
- Updated the default
- Added
color
toaircraft.py
to allow users to customize the color of the coverage radius circle
- Modified the addition of polygons in
aircraft.py
to ensure they are displayed in white color without altering the original image colors.
- Add "status description," "action design," and "program examples" to the following three objects:
aircraft
,vehicle
,traffic lights
- Add Chinese documentation:
- TransSimHub scene creation, including signal light output, detector generation, and traffic flow generation
- TransSimHub Object, introducing the three basic components of
TransSimHub
: aircraft, vehicle, and traffic lights - Add examples of scene combinations, integrating the usage of all three components: signal light control scene, aircraft control scene
- Add an example of using RL to control traffic lights
traffic_light.py
:- Add additional attributes:
- Add
this_phase_index
in the traffic light data class (int) - Add
last_step_vehicle_id_list
in the traffic light data class (List(str)). Through the vehicle ID, we can calculate the waiting time at the intersection.
- Add
- Add additional attributes:
aircraft.py
:- Add the
aircraft type
attribute to handle different types of aircraft differently. - Set
setLineWidth
to width 3 to optimize the visualization effect of aircraft.
- Add the
traffic_light_builder.py
:- Modify
process_detector_data
to support processing list data types and merge them.
- Modify
- Resolve the issue where
vehicle
cannot retrievenext_tls
when usinglibsumo
vehicle.py. - In the
aircraft example
, fix the issue whereget_aircraft_state.py
does not passsumo
and cannot obtainaircraft info
.
- Added
generate_route.py
module insumo_tools
for quickly generating route files for scenarios.generate_trip.py
: Generates *.trip.xml files based on the number of entering vehicles (veh/min) for each time period. Allows control over the mixture ratio of ego vehicles and background vehicles. The default maximum speed is 17 m/s, equivalent to 61.2 km/h.generate_turn_def.py
: Generates *.turndefs.xml files based on the turning probabilities for each time period.interpolation
module: Provides interpolation for smooth changes in flows or turndefs.
- Added
generate_add.py
module insumo_tools
for quickly generating add files to monitor changes in traffic signal states.- See SUMO Simulation Output for possible additional files to add.
- Initialized documentation using Sphinx for writing the documentation.
doc
supportsreadthedocs
documentation: Transsimhub Documentation- Wrote the
introduction
section to introduce the TransSimHub repository. - Wrote the
installation
section to explain how to install TransSimHub.
- Added
normalization_dict.py
inutils
, which normalizes the keys in a dictionary to make their sum equal to 1. - Added
traffic_light_ids.py
insumo_tools/sumo_infos
to return the IDs of traffic lights in the network.
- Modified
setup.py
to includeextras_require
for additional support for thedoc
environment. - Updated
init_log.py
to include the function and corresponding line numbers in the log. - Added a
vehicle type
attribute invehicle.py
to differentiate between ego vehicles and background vehicles.
- Updated
dict_to_str
to handle the format of np.array, as it cannot be directly converted. Added type checking and conversion to resolve TypeError: Object of type ndarray is not JSON serializable. - Fixed the highlighting functionality in
vehicle_builder.py
to avoid highlighting duplicate vehicles.
- Added
tshub_env
modulebase_sumo_env.py
: Initializes the SUMO simulation environment.tshub_env.py
: Integrates "Veh" (vehicles), "Air" (aircraft), and "Traf" (traffic lights) for overall control and information retrieval.
- Added
sumo_env
inexample
single_junction
: Environment for a single junction.three_junctions
: Environment for three junctions, including ego vehicle and background vehicles.
aircraft_builder.py
: Separated SUMO initialization fromaircraft_inits
and now pass SUMO once during the builder process.- Updated a series of utility functions in
utils
check_folder.py
: Checks if a folder exists and creates it if it doesn't.format_dict.py
: Formats a dictionary for better display when printing.nested_dict_conversion.py
: Converts nested dictionaries.get_abs_path.py
: Converts relative paths to absolute paths.
- Modified the type of
new_position
inbase_aircraft_action.py
from tuple to list to resolve a TypeError: 'tuple' object does not support item assignment.
- Added four different aircraft action types:
stationary.py
: The aircraft remains stationary at its initial position.horizontal_movement.py
: The aircraft can only move horizontally, with eight possible heading angles.vertical_movement.py
: The aircraft can only move vertically, with three possible heading values: up, stationary, and down.combined_movement.py
: The aircraft can move both upward and downward simultaneously, combining azimuth and pitch angles. There are a total of 40 combinations.
- Added
base_builder.py
to standardize the interface between different builders:aircraft_builder.py
,vehicle_builder.py
,traffic_light_builder.py
- Provided examples for vehicle, aircraft, and traffic light under the new builder:
traffic_light_action
:tls_choosenextphase.py
andtls_nextornot.py
aircraft_actions
:aircraft_combined.py
,aircraft_horizontal.py
,aircraft_stationary.py
, andaircraft_vertical.py
vehicle_action
:vehicle_lane.py
andvehicle_lane_with_continuous_speed.py
- In
traffic_light.py
, setthis_phase
to False before each update in__update_this_phase()
. Previously, it would cause allthis_phase
values to be True.
- Added traffic light module
traffic_light_action_type.py
: Defines two types of traffic light control: "Choose Next Phase" and "Next or Not".traffic_light.py
: Defines the basic properties and methods of each traffic light.traffic_light_builder.py
: Initializes all traffic lights in a scene and defines interfaces for accessing information and control.choose_next_phase.py
: Defines the control method "Choose Next Phase".next_or_not.py
: Defines the control method "Next or Not".
- Modified the vehicle module to no longer create multiple classes for the same vehicle.
- Added
update_vehicle_feature
, which updates the current information of the vehicle at each step. - Added and improved different vehicle action types, including
lane
andlane with continuous speed
. - Added attributes to the vehicle, including
action type
andlane index
.
- Added
- Added
generate_detectors.py
file in thesumo_tools
modulebase_detectors.py
: Defines the information retrieval from intersections and thegenerate_detector
method.e1_detectors.py
: Generates e1 detectors placed at a default distance of 2m from the traffic lights.e2_detectors.py
: Generates e2 detectors with a default length of 100m.e3_detectors.py
: Generates e3 detectors that cover turns.
- Added
sumo_infos
in thesumo_tools
module to extract connections of traffic light signals.
- Modified
init_log.py
in theutils
section to store logs in a separate folder. - Modified
get_abs_path.py
in theutils
section to include the SIM identifier in the logs.
- Initialized the project.
- Vehicle module:
- Added
vehicle_builder.py
file: Provides methods to retrieve information and control all vehicles in the scene. - Added
vehicle.py
file: Defines theVehicleInfo
class that represents information about a vehicle.
- Added
- Aircraft module:
- Added
aircraft.py
file: Defines theAircraftInfo
class that represents information about an aircraft. - Added
aircraft_builder.py
file: Provides methods to create and control aircraft.
- Added