Skip to content

Commit

Permalink
Configure Green Duration (#329)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
This PR adjusts several configs to have the vru scenario run
successfully:
- Changing from default 50 sec at signalgroup 2,6 and 5 sec at 4,8 to
20sec green on each groups (this was there for testing, and for actual
data collection, we need realistic durations)
- increased scenario-runner time out values so that it doesn't
prematurely exit now that the engage delay is long
- Make carma-streets to use projected SPAT [(due to issue with evc
discovered recently)](https://usdot-carma.atlassian.net/browse/CDAR-861)
- Expose engage delay duration for platform and example times that would
have the vehicle go through green since engaging (because left turn and
through scenarios need different engage times to go through green
without stopping)
- remove unnecessary environment variables
- added new lci_strategic_plugin parameters that is suited for
simulation (original config are suited for passenger vehicles in real
life) for its stopping behavior.
- And also Entry Time calculation in [LCI is picking up the low starting
speed](https://usdot-carma.atlassian.net/browse/CDAR-862) and
erroneously predicting ET way in the future. This results in vehicle
slowly crawling until speeding up through green. This case was not
tested before in TSMO I believe. Therefore, lci_strategic_plugin's
activation distance is reduced so that it has terminal speed before
doing trajectory smoothing.

<!--- Describe your changes in detail -->

## Related Issue
N/A
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context
vru verification testing prep
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
sim pc 1
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Defect fix (non-breaking change that fixes an issue)
- [X] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [X] I have added any new packages to the sonar-scanner.properties file
- [X] My change requires a change to the documentation.
- [X] I have updated the documentation accordingly.
- [X] I have read the **CONTRIBUTING** document.
[CARMA Contributing
Guide](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md)
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.
  • Loading branch information
MishkaMN committed Mar 22, 2024
1 parent 98f3cf9 commit 5b05551
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 26 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#docker-compose env variables
.env

2 changes: 1 addition & 1 deletion ail_vru_uc1_scenario/VehicleConfigParams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ enable_object_avoidance: true
# Acceleration limit
# Value type: Desired
# Units: m/s^2
vehicle_acceleration_limit: 3.0
vehicle_acceleration_limit: 8.0

# Deceleration limit
# Value type: Desired
Expand Down
4 changes: 3 additions & 1 deletion ail_vru_uc1_scenario/cdasim_config/.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ SIMULATION_SCENARIO="VulnerableRoadUserCollision_ThreeTrucks"
# you would like to run and comment all other scenarios

# SCENARIO: West to North left turn (A)
VEHICLE_ENGAGE_DELAY='55'
VEHICLE_SPAWN_POINT="215.12,-169,0,0,0,0"

# SCENARIO: South to North through (B)
# VEHICLE_SPAWN_POINT="258.12,-125,0,0,0,90"
#VEHICLE_SPAWN_POINT="258.12,-125,0,0,0,90"
#VEHICLE_ENGAGE_DELAY='75'
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Double: multiplier to apply to the maximum allowable vehicle deceleration limit so we plan under our capabilities
vehicle_decel_limit_multiplier : 1.0

# Double: multiplier to apply to the maximum allowable vehicle acceleration limit so we plan under our capabilities
vehicle_accel_limit_multiplier : 1.0

# Double: The minimum distance in meters that the vehicle can be at before requiring a transition to the APPROACH state
min_approach_distance : 20.0

# Double: Downtrack distance until nearest intersection where the Trajectory Smoothing algorithm should activate
trajectory_smoothing_activation_distance: 20.0

# Double: A buffer infront of the stopping location which will still be considered a valid stop. Units in meters
stopping_location_buffer : 1.0

# Double: A buffer in seconds around the green phase which will reduce the phase length such that vehicle still considers it non-green
green_light_time_buffer : 0.5

# Double: Minimum allowable speed in trajectory smoothing algorithm m/s
algo_minimum_speed : 2.235

# Double: Safety multiplier (must be less than 1.0) of planned allowable vehicle deceleration to use when stopping. This new deceleration makes vehicle decelerate earlier distance.
# NOTE: Stacks on vehicle_decel_limit_multiplier and stopping uses max_decel; this distance is only used for calculating earlier downtrack
deceleration_fraction : 0.7

# Double: Desired distance to stop buffer in meters
desired_distance_to_stop_buffer : 1.0

# Double: The minimum period in seconds which a maneuver plan must cover if the plugin wishes to control the whole plan
min_maneuver_planning_period : 15.1

# Bool: If enable_carma_streets_connection is true when we want to allow carma streets functionality (UC3) and if its false that means we don't want to allow carma streets behaviour and will only use UC2 behaviour.
enable_carma_streets_connection : false

# Double: Mobility operation rate
mobility_rate : 10.0

# String: The name to use for this plugin during comminications with the arbitrator
strategic_plugin_name : lci_strategic_plugin

# String: The name of the tactical plugin to use for Lane Following trajectory planning
# This plugin is used to apply trajectory smoothing algorithm BEFORE entering the intersection if within activation distance
lane_following_plugin_name : light_controlled_intersection_tactical_plugin

# String: The name of the plugin to use for stop and wait trajectory planning
stop_and_wait_plugin_name : stop_and_wait_plugin

# String: The name of the plugin to use for intersection transit trajectory planning
# This plugin is used to travel INSIDE the intersection where there is no trajectory smoothing algorithm active
intersection_transit_plugin_name : intersection_transit_maneuvering
2 changes: 1 addition & 1 deletion ail_vru_uc1_scenario/cdasim_config/cdasim/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<appender-ref ref="STDOUT"/>
<appender-ref ref="MosaicLog"/>
</logger>
<logger name="org.eclipse.mosaic.rti.time" additivity="false" level="INFO">
<logger name="org.eclipse.mosaic.rti.time" additivity="false" level="DEBUG">
<appender-ref ref="MosaicLog"/>
</logger>
<logger name="org.eclipse.mosaic.lib" additivity="false" level="INFO">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"controllers": [
{
"controllerId": 1,
"controllerCfgPath": "resources/test_4.cfg",
"controllerCfgPath": "resources/20g_3y_fixed_sig_grp_2_4_6_8.cfg",
"start_time": null,
"https_port": 0,
"web_port": 0,
Expand All @@ -18,4 +18,3 @@
}
]
}

Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
Configurations
"""

WALKING_PERSON_SPEED_IN_MS = 2.0
WALKING_PERSON_TRIGGER_WALKING_DISTANCE_IN_METERS = 15.0
WALKING_PERSON_SPEED_IN_MS = 0.91
WALKING_PERSON_TRIGGER_WALKING_DISTANCE_IN_METERS = 27.5

class VulnerableRoadUserCollision(BasicScenario):
def __init__(
Expand All @@ -52,7 +52,7 @@ def __init__(
randomize: bool = False,
debug_mode: bool = False,
criteria_enable: bool = True,
timeout=60,
timeout=300, #5min
) -> None:
"""
:param world: CARLA world in which the scenario is running
Expand Down Expand Up @@ -157,7 +157,7 @@ def _create_behavior(self):
)

walk_across_street = KeepVelocity(
crossing_person, WALKING_PERSON_SPEED_IN_MS, 100.0, name="walk_across_street"
crossing_person, WALKING_PERSON_SPEED_IN_MS, 200.0, name="walk_across_street"
)

dao = GlobalRoutePlannerDAO(CarlaDataProvider.get_map(), 2)
Expand All @@ -167,7 +167,7 @@ def _create_behavior(self):
actor_behaviors = py_trees.composites.Parallel(name="actor_behaviors")
actor_behaviors.add_child(walk_across_street)

end_condition = DriveDistance(self.carma_vehicle, 100)
end_condition = DriveDistance(self.carma_vehicle, 200)

root = py_trees.composites.Sequence(name="root_sequence")
root.add_child(start_condition)
Expand Down
24 changes: 12 additions & 12 deletions ail_vru_uc1_scenario/cdasim_config/tsc_client_service/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@
"loglevel": "debug",
"configurations": [
{

"name": "target_ip",
"value": "172.4.0.4",
"description": "Target device IP address",
"type": "STRING"
},
},
{
"name": "target_port",
"value": 5050,
"description": "Target device NTCIP port",
"type": "INTEGER"
"type": "INTEGER"
},
{
"name": "community",
"value": "administrator",
"description": "Target community for establishing snmp communication",
"type": "STRING"
"type": "STRING"
},
{
"name": "snmp_version",
"value": 0,
"description": "snmp version being used. net-snmp version definition: SNMP_VERSION_1:0 SNMP_VERSION_2c:1 SNMP_VERSION_2u:2 SNMP_VERSION_3:3",
"type": "INTEGER"
"type": "INTEGER"
},
{
"name": "snmp_timeout",
"value": 1500000000,
"description": "Time in microseconds after which the the snmp request times out",
"type": "INTEGER"
"type": "INTEGER"
},
{

"name": "udp_socket_ip",
"value": "172.4.0.3",
"description": "IP for UDP socket listener to listen on. Should be localhost IP of container or VM running TSC Service.",
"type": "STRING"
},
{

"name": "udp_socket_port",
"value": 6053,
"description": "Port for UDP Socket Listener to list on. TSC configuration sets which port/host NTCIP SPaT data will be broadcast to.",
"type": "INTEGER"
},
{

"name": "socket_timeout",
"value": 100,
"description": "Timeout in seconds for UDP Socket Listener. If UDP Socket Listener does not receive messages for this amount of time it will shutdown and thrown an exception. ",
Expand Down Expand Up @@ -86,7 +86,7 @@
},
{
"name": "spat_projection_mode",
"value": 0,
"value": 2,
"description": "Enumeration configuring SPat projection. 1 == DPP projection. 2 == Fixed Timing projection. Any other value will result in no projection of future",
"type": "INTEGER"
},
Expand All @@ -107,7 +107,7 @@
"value": true,
"description": "Bool flag to enable snmp commands logging.",
"type": "BOOL"
},
},
{
"name": "snmp_cmd_log_path",
"value": "../logs/",
Expand All @@ -132,6 +132,6 @@
"description": "If true will enable monitor_desired_phase_plan to update incoming spat with calculated future movement events, using desired phase plan information from signal optimization service. If false will use TSC Configuration to predict future phases and append those to the spat based on default phase sequence.",
"type": "BOOL"
}

]
}
5 changes: 2 additions & 3 deletions ail_vru_uc1_scenario/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ services:
- /opt/carma/yolo:/opt/carma/yolo
- ./carma-platform/inlanecruising_plugin/parameters.yaml:/opt/carma/install_ros2/inlanecruising_plugin/share/inlanecruising_plugin/config/parameters.yaml
- ./carma-platform/yield_plugin/parameters.yaml:/opt/carma/install_ros2/yield_plugin/share/yield_plugin/config/parameters.yaml
- ./carma-platform/lci_strategic_plugin/parameters.yaml:/opt/carma/install_ros2/lci_strategic_plugin/share/lci_strategic_plugin/config/parameters.yaml
command: >
bash -c 'export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
&& source /opt/carma/install_ros2/setup.bash
Expand Down Expand Up @@ -126,8 +127,6 @@ services:
ROS_IP: 172.3.0.6
ROS_MASTER_URI: http://172.3.0.2:11311/
PYTHONUNBUFFERED: 1
VEHICLE_SELECTED_ROUTE: ${VEHICLE_SELECTED_ROUTE}
VEHICLE_SPAWN_POINT: ${VEHICLE_SPAWN_POINT}

# sleep is for carla simulator to become available
# start_delay_in_seconds is carla game time seconds to adjust when to engage for the scenario
Expand All @@ -142,7 +141,7 @@ services:
role_name:='carma_1'
host:='172.2.0.2'
selected_route:=${VEHICLE_SELECTED_ROUTE}
start_delay_in_seconds:='35'
start_delay_in_seconds:=${VEHICLE_ENGAGE_DELAY}
spawn_point:=${VEHICLE_SPAWN_POINT}"
ns3_adapter_1:
Expand Down

0 comments on commit 5b05551

Please sign in to comment.