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

lci_strategic_plugin hangs when trying to find entry on green signal #2228

Merged
merged 14 commits into from
Dec 22, 2023

Conversation

MishkaMN
Copy link
Contributor

@MishkaMN MishkaMN commented Dec 17, 2023

PR Details

Description

Currently the lci_strategic_plugin is not accounting for an edge case where if there is a green signal in the received signal states, but that signal is behind the vehicle's earliest entry time (EET) possible due to the vehicle's kinematics.
It is only handling the case if there is no green signal at all. Therefore it may erroneously continue to look for the green signal forever.

Applied fix is to return the start of TBD state which is the end of the available states with RED signal. Since function can return a timestamp and state that is not GREEN, renamed the function.

Supporting PR to be merged first: usdot-fhwa-stol/autoware.ai#261

Related GitHub Issue

#2227

Related Jira Key

CDAR-619
https://usdot-carma.atlassian.net/browse/CDAR-619

Motivation and Context

How Has This Been Tested?

Simulation PC 1

Types of changes

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

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@MishkaMN MishkaMN self-assigned this Dec 18, 2023
@MishkaMN MishkaMN changed the title <wip> lci_strategic_plugin hangs when trying to find entry on green signal lci_strategic_plugin hangs when trying to find entry on green signal Dec 18, 2023
@MishkaMN MishkaMN requested a review from adamlm December 18, 2023 17:42
adamlm
adamlm previously approved these changes Dec 19, 2023
@MishkaMN MishkaMN requested a review from adamlm December 20, 2023 12:40
* NOTE: TSMO UC2: Algorithm 2. Entering time estimation algorithm for EVs in cooperation Class A when the SPaT plan is fixed-time (defined for C-ADS-equipped vehicles)
*/

rclcpp::Time get_nearest_green_entry_time(const rclcpp::Time& current_time, const rclcpp::Time& earliest_entry_time, lanelet::CarmaTrafficSignalPtr signal, double minimum_required_green_time = 0.0) const;
std::tuple<rclcpp::Time, bool> get_nearest_valid_entry_time(const rclcpp::Time& current_time, const rclcpp::Time& earliest_entry_time, lanelet::CarmaTrafficSignalPtr signal, double minimum_required_green_time = 0.0) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider changing this to std::optional<rclcpp::Time> to indicate that a nearest valid entry time does not exist under the given function arguments.

@@ -49,7 +49,21 @@ double LCIStrategicPlugin::get_distance_to_accel_or_decel_once (double current_s
}
}

rclcpp::Time LCIStrategicPlugin::get_nearest_green_entry_time(const rclcpp::Time& current_time, const rclcpp::Time& earliest_entry_time, lanelet::CarmaTrafficSignalPtr signal, double minimum_required_green_time) const
rclcpp::Time get_eet_or_tbd(const rclcpp::Time& earliest_entry_time, const lanelet::CarmaTrafficSignalPtr& signal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment about std::optional.

nearest_green_entry_time = get_nearest_green_entry_time(current_state.stamp, earliest_entry_time, traffic_light)
+ rclcpp::Duration(EPSILON * 1e9); //0.01sec more buffer since green_light algorithm's timestamp picks the previous signal - Vehicle Estimation
is_entry_time_within_green_or_tbd = true;
std::tie(nearest_green_entry_time, in_tbd) = get_nearest_valid_entry_time(current_state.stamp, earliest_entry_time, traffic_light);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment about std::optional.

@MishkaMN MishkaMN requested a review from adamlm December 21, 2023 10:26
@MishkaMN
Copy link
Contributor Author

This was tested locally to be able to build. The autoware.ai's carma-develop branch is pushing to wrong hub.docker.com image tag (carma-develop instead of develop) which is why the CI is failing. Therefore force merging this and force pushing to usdotfhwastoldev/autoware.ai:develop with the updated image until the automated process is fixed

@MishkaMN MishkaMN merged commit f3d46a7 into develop Dec 22, 2023
0 of 3 checks passed
@MishkaMN MishkaMN deleted the fix/green-signal-issue branch December 22, 2023 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants