Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: traffic light module #695

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class TrafficLightModule : public SceneModuleInterface

bool isPassthrough(const double & signed_arc_length) const;

bool hasTrafficLightColor(
bool hasTrafficLightCircleColor(
const autoware_auto_perception_msgs::msg::TrafficSignal & tl_state,
const uint8_t & lamp_color) const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ bool TrafficLightModule::isPassthrough(const double & signed_arc_length) const
bool TrafficLightModule::isTrafficSignalStop(
const autoware_auto_perception_msgs::msg::TrafficSignal & tl_state) const
{
if (hasTrafficLightColor(tl_state, autoware_auto_perception_msgs::msg::TrafficLight::GREEN)) {
if (hasTrafficLightCircleColor(
tl_state, autoware_auto_perception_msgs::msg::TrafficLight::GREEN)) {
return false;
}

Expand Down Expand Up @@ -485,13 +486,16 @@ autoware_auto_planning_msgs::msg::PathWithLaneId TrafficLightModule::insertStopP
return modified_path;
}

bool TrafficLightModule::hasTrafficLightColor(
bool TrafficLightModule::hasTrafficLightCircleColor(
const autoware_auto_perception_msgs::msg::TrafficSignal & tl_state,
const uint8_t & lamp_color) const
{
const auto it_lamp = std::find_if(
tl_state.lights.begin(), tl_state.lights.end(),
[&lamp_color](const auto & x) { return x.color == lamp_color; });
using autoware_auto_perception_msgs::msg::TrafficLight;

const auto it_lamp =
std::find_if(tl_state.lights.begin(), tl_state.lights.end(), [&lamp_color](const auto & x) {
return x.shape == TrafficLight::CIRCLE && x.color == lamp_color;
});

return it_lamp != tl_state.lights.end();
}
Expand Down