autowarefoundation / autoware.universe

https://autowarefoundation.github.io/autoware.universe/
Apache License 2.0
964 stars 630 forks source link

fix(bpp, rtc_interface): fix state transition #7743

Closed satoshi-ota closed 2 months ago

satoshi-ota commented 3 months ago

Description

Exclude the cooperate statuses whose state is SUCCEEDED or FAILDED from isActivate() check.

  bool existApprovedRequest() const
  {
    return std::any_of(
      rtc_interface_ptr_map_.begin(), rtc_interface_ptr_map_.end(), [&](const auto & rtc) {
        if (!rtc.second->isRegistered(uuid_map_.at(rtc.first))) {
          return false;
        }

        if (rtc.second->isTerminated(uuid_map_.at(rtc.first))) {
          return true;
        }

        return rtc.second->isActivated(uuid_map_.at(rtc.first));
      });
  }

  bool existNotApprovedRequest() const
  {
    return std::any_of(
      rtc_interface_ptr_map_.begin(), rtc_interface_ptr_map_.end(), [&](const auto & rtc) {
        return rtc.second->isRegistered(uuid_map_.at(rtc.first)) &&
               !rtc.second->isActivated(uuid_map_.at(rtc.first)) &&
               !rtc.second->isTerminated(uuid_map_.at(rtc.first));
      });
  }

Related links

Parent Issue:

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

github-actions[bot] commented 3 months ago

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

kosuke55 commented 2 months ago

this PR also fix the issue the avoidace keep exsiting as candidate module that can not be approved and stuck https://star4.slack.com/archives/C03QW0GU6P7/p1719470528991979

image

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 6.66667% with 28 lines in your changes missing coverage. Please review.

Project coverage is 28.99%. Comparing base (624342e) to head (e36525e). Report is 17 commits behind head on main.

Files Patch % Lines
...nning/autoware_rtc_interface/src/rtc_interface.cpp 8.00% 23 Missing :warning:
...lanner_common/interface/scene_module_interface.hpp 0.00% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7743 +/- ## ========================================== - Coverage 29.01% 28.99% -0.02% ========================================== Files 1608 1612 +4 Lines 117837 117892 +55 Branches 50712 50723 +11 ========================================== + Hits 34186 34187 +1 - Misses 74419 74472 +53 - Partials 9232 9233 +1 ``` | [Flag](https://app.codecov.io/gh/autowarefoundation/autoware.universe/pull/7743/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autowarefoundation) | Coverage Δ | | *Carryforward flag | |---|---|---|---| | [differential](https://app.codecov.io/gh/autowarefoundation/autoware.universe/pull/7743/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autowarefoundation) | `19.86% <6.66%> (?)` | | | | [total](https://app.codecov.io/gh/autowarefoundation/autoware.universe/pull/7743/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autowarefoundation) | `29.01% <ø> (+<0.01%)` | :arrow_up: | Carriedforward from [624342e](https://app.codecov.io/gh/autowarefoundation/autoware.universe/commit/624342ecbb233a7db4fe1b888f91ca5f2cb14834?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autowarefoundation) | *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=autowarefoundation) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.