Skip to content

Commit bbeb8bc

Browse files
authored
Merge pull request #1251 from tier4/cherry-pick-ensure-stopping-tlr-2
feat(behavior_velocity_traffic_light): ensure stopping if a signal is not received
2 parents 202a178 + 1456eec commit bbeb8bc

File tree

7 files changed

+28
-2
lines changed

7 files changed

+28
-2
lines changed

launch/tier4_planning_launch/launch/planning.launch.xml

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<arg name="velocity_smoother_type_param_path"/>
4848
<!-- planning validator -->
4949
<arg name="planning_validator_param_path"/>
50+
<arg name="is_simulation"/>
5051

5152
<group>
5253
<push-ros-namespace namespace="planning"/>
@@ -68,6 +69,7 @@
6869
<arg name="use_surround_obstacle_check" value="$(var use_surround_obstacle_check)"/>
6970
<arg name="cruise_planner_type" value="$(var cruise_planner_type)"/>
7071
<arg name="use_experimental_lane_change_function" value="$(var use_experimental_lane_change_function)"/>
72+
<arg name="is_simulation" value="$(var is_simulation)"/>
7173
</include>
7274
</group>
7375

launch/tier4_planning_launch/launch/scenario_planning/lane_driving.launch.xml

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<launch>
2+
<arg name="is_simulation"/>
3+
24
<!-- lane_driving scenario -->
35
<group>
46
<push-ros-namespace namespace="lane_driving"/>
@@ -12,6 +14,7 @@
1214
<arg name="use_pointcloud_container" value="$(var use_pointcloud_container)"/>
1315
<arg name="container_name" value="$(var pointcloud_container_name)"/>
1416
<arg name="use_experimental_lane_change_function" value="$(var use_experimental_lane_change_function)"/>
17+
<arg name="is_simulation" value="$(var is_simulation)"/>
1518
</include>
1619
</group>
1720
<group>

launch/tier4_planning_launch/launch/scenario_planning/lane_driving/behavior_planning/behavior_planning.launch.py

+4
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def launch_setup(context, *args, **kwargs):
205205
common_param,
206206
motion_velocity_smoother_param,
207207
behavior_velocity_smoother_type_param,
208+
{"is_simulation": LaunchConfiguration("is_simulation")},
208209
],
209210
extra_arguments=[{"use_intra_process_comms": LaunchConfiguration("use_intra_process")}],
210211
)
@@ -301,6 +302,9 @@ def add_launch_arg(name: str, default_value=None, description=None):
301302
add_launch_arg("use_pointcloud_container", "true")
302303
add_launch_arg("container_name", "pointcloud_container")
303304

305+
# whether this is a simulation or not
306+
add_launch_arg("is_simulation", "false", "whether this is a simulation or not")
307+
304308
set_container_executable = SetLaunchConfiguration(
305309
"container_executable",
306310
"component_container",

launch/tier4_planning_launch/launch/scenario_planning/scenario_planning.launch.xml

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<launch>
2+
<arg name="is_simulation"/>
23
<!-- scenario selector -->
34
<group>
45
<include file="$(find-pkg-share scenario_selector)/launch/scenario_selector.launch.xml">
@@ -58,6 +59,7 @@
5859
<arg name="use_surround_obstacle_check" value="$(var use_surround_obstacle_check)"/>
5960
<arg name="cruise_planner_type" value="$(var cruise_planner_type)"/>
6061
<arg name="use_experimental_lane_change_function" value="$(var use_experimental_lane_change_function)"/>
62+
<arg name="is_simulation" value="$(var is_simulation)"/>
6163
</include>
6264
</group>
6365
<!-- parking -->

planning/behavior_velocity_planner/src/node.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ BehaviorVelocityPlannerNode::BehaviorVelocityPlannerNode(const rclcpp::NodeOptio
141141
planner_data_.ego_nearest_yaw_threshold =
142142
this->declare_parameter<double>("ego_nearest_yaw_threshold");
143143

144+
// is simulation or not
145+
planner_data_.is_simulation = declare_parameter<bool>("is_simulation");
146+
144147
// Initialize PlannerManager
145148
for (const auto & name : declare_parameter<std::vector<std::string>>("launch_modules")) {
146149
planner_manager_.launchScenePlugin(*this, name);

planning/behavior_velocity_planner_common/include/behavior_velocity_planner_common/planner_data.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ struct PlannerData
8989
boost::optional<tier4_planning_msgs::msg::VelocityLimit> external_velocity_limit;
9090
tier4_v2x_msgs::msg::VirtualTrafficLightStateArray::ConstSharedPtr virtual_traffic_light_states;
9191

92+
// This variable is used when the Autoware's behavior has to depend on whether it's simulation or
93+
// not.
94+
bool is_simulation = false;
95+
9296
// velocity smoother
9397
std::shared_ptr<motion_velocity_smoother::SmootherBase> velocity_smoother_;
9498
// route handler

planning/behavior_velocity_traffic_light_module/src/scene.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,19 @@ bool TrafficLightModule::isStopSignal()
302302
{
303303
updateTrafficSignal();
304304

305-
// If it never receives traffic signal, it will PASS.
305+
// If there is no upcoming traffic signal information,
306+
// SIMULATION: it will PASS to prevent stopping on the planning simulator
307+
// or scenario simulator.
308+
// REAL ENVIRONMENT: it will STOP for safety in cases such that traffic light
309+
// recognition is not working properly or the map is incorrect.
306310
if (!traffic_signal_stamp_) {
307-
return false;
311+
if (planner_data_->is_simulation) {
312+
return false;
313+
}
314+
return true;
308315
}
309316

317+
// Stop if the traffic signal information has timed out
310318
if (isTrafficSignalTimedOut()) {
311319
return true;
312320
}

0 commit comments

Comments
 (0)