Skip to content

Commit 31bd431

Browse files
committed
ignore occlusions only if the traffic light is red
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
1 parent b0fc116 commit 31bd431

File tree

6 files changed

+8
-24
lines changed

6 files changed

+8
-24
lines changed

planning/behavior_velocity_crosswalk_module/config/crosswalk.param.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
min_size: 0.5 # [m] minimum size of an occlusion (square side size)
8080
free_space_max: 43 # [-] maximum value of a free space cell in the occupancy grid
8181
occupied_min: 58 # [-] minimum value of an occupied cell in the occupancy grid
82-
ignore_with_traffic_light: true # [-] if true, occlusions at crosswalks with traffic lights are ignored
82+
ignore_with_red_traffic_light: true # [-] if true, occlusions at crosswalks with traffic lights are ignored
8383
ignore_behind_predicted_objects: true # [-] if true, occlusions behind predicted objects are ignored
8484
ignore_velocity_thresholds:
8585
default: 0.5 # [m/s] occlusions are only ignored behind objects with a higher or equal velocity

planning/behavior_velocity_crosswalk_module/src/manager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ CrosswalkModuleManager::CrosswalkModuleManager(rclcpp::Node & node)
137137
cp.occlusion_min_size = getOrDeclareParameter<double>(node, ns + ".occlusion.min_size");
138138
cp.occlusion_free_space_max = getOrDeclareParameter<int>(node, ns + ".occlusion.free_space_max");
139139
cp.occlusion_occupied_min = getOrDeclareParameter<int>(node, ns + ".occlusion.occupied_min");
140-
cp.occlusion_ignore_with_traffic_light =
141-
getOrDeclareParameter<bool>(node, ns + ".occlusion.ignore_with_traffic_light");
140+
cp.occlusion_ignore_with_red_traffic_light =
141+
getOrDeclareParameter<bool>(node, ns + ".occlusion.ignore_with_red_traffic_light");
142142
cp.occlusion_ignore_behind_predicted_objects =
143143
getOrDeclareParameter<bool>(node, ns + ".occlusion.ignore_behind_predicted_objects");
144144

planning/behavior_velocity_crosswalk_module/src/occluded_crosswalk.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ lanelet::BasicPoint2d interpolate_point(
5151
return segment.second + extra_distance * direction_vector;
5252
}
5353

54-
bool is_crosswalk_ignored(
55-
const lanelet::ConstLanelet & crosswalk_lanelet, const bool ignore_with_traffic_light)
56-
{
57-
const auto traffic_lights_reg_elems =
58-
crosswalk_lanelet.regulatoryElementsAs<const lanelet::TrafficLight>();
59-
const bool has_traffic_light = !traffic_lights_reg_elems.empty();
60-
const bool has_skip_attribute = crosswalk_lanelet.hasAttribute("skip_occluded_slowdown");
61-
return (ignore_with_traffic_light && has_traffic_light) || has_skip_attribute;
62-
}
63-
6454
std::vector<lanelet::BasicPolygon2d> calculate_detection_areas(
6555
const lanelet::ConstLanelet & crosswalk_lanelet, const lanelet::BasicPoint2d & crosswalk_origin,
6656
const double detection_range)

planning/behavior_velocity_crosswalk_module/src/occluded_crosswalk.hpp

-7
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ bool is_occluded(
4949
lanelet::BasicPoint2d interpolate_point(
5050
const lanelet::BasicSegment2d & segment, const double extra_distance);
5151

52-
/// @brief check if the crosswalk should be ignored
53-
/// @param crosswalk_lanelet lanelet of the crosswalk
54-
/// @param ignore_with_traffic_light if true, ignore the crosswalk if it has a traffic light
55-
/// @return true if the crosswalk should be ignored
56-
bool is_crosswalk_ignored(
57-
const lanelet::ConstLanelet & crosswalk_lanelet, const bool ignore_with_traffic_light);
58-
5952
/// @brief check if the crosswalk is occluded
6053
/// @param crosswalk_lanelet lanelet of the crosswalk
6154
/// @param occupancy_grid occupancy grid with the occlusion information

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,10 @@ bool CrosswalkModule::modifyPathVelocity(PathWithLaneId * path, StopReason * sto
240240
const auto cmp_with_time_buffer = [&](const auto & t, const auto cmp_fn) {
241241
return t && cmp_fn((now - *t).seconds(), planner_param_.occlusion_time_buffer);
242242
};
243-
if (
244-
planner_param_.occlusion_enable && !path_intersects.empty() &&
245-
!is_crosswalk_ignored(crosswalk_, planner_param_.occlusion_ignore_with_traffic_light)) {
243+
const auto is_crosswalk_ignored =
244+
(planner_param_.occlusion_ignore_with_red_traffic_light && isRedSignalForPedestrians()) ||
245+
crosswalk_.hasAttribute("skip_occluded_slowdown");
246+
if (planner_param_.occlusion_enable && !path_intersects.empty() && !is_crosswalk_ignored) {
246247
const auto dist_ego_to_crosswalk =
247248
calcSignedArcLength(path->points, ego_pos, path_intersects.front());
248249
const auto detection_range =

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class CrosswalkModule : public SceneModuleInterface
163163
double occlusion_min_size;
164164
int occlusion_free_space_max;
165165
int occlusion_occupied_min;
166-
bool occlusion_ignore_with_traffic_light;
166+
bool occlusion_ignore_with_red_traffic_light;
167167
bool occlusion_ignore_behind_predicted_objects;
168168
std::vector<double> occlusion_ignore_velocity_thresholds;
169169
double occlusion_extra_objects_size;

0 commit comments

Comments
 (0)