Skip to content

Commit

Permalink
Merge pull request #1467 from tier4/refactor/distance-condition
Browse files Browse the repository at this point in the history
Refactor/distance condition
  • Loading branch information
yamacir-kit authored Dec 4, 2024
2 parents 3dd43ab + 01ef483 commit 7eda26e
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,37 +112,39 @@ struct DistanceCondition : private Scope, private SimulatorCore::ConditionEvalua

auto description() const -> std::string;

auto distance(const EntityRef &) const -> double;

template <
CoordinateSystem::value_type, RelativeDistanceType::value_type, RoutingAlgorithm::value_type,
Boolean::value_type>
auto distance(const EntityRef &) const -> double
static auto distance(const EntityRef &, const Position &) -> double
{
throw SyntaxError(__FILE__, ":", __LINE__);
}

static auto evaluate(
const Entities *, const Entity &, const Position &, CoordinateSystem, RelativeDistanceType,
RoutingAlgorithm, Boolean) -> double;

auto evaluate() -> Object;
};

// Ignore spell miss due to OpenSCENARIO standard.
// cspell: ignore euclidian

// clang-format off
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::euclidianDistance, RoutingAlgorithm::undefined, false>(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::euclidianDistance, RoutingAlgorithm::undefined, true >(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, false>(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, true >(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, false>(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, true >(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, false>(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, true >(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, false>(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, true >(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::shortest, false>(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::shortest, true >(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::shortest, false>(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::shortest, true >(const EntityRef &) const -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::euclidianDistance, RoutingAlgorithm::undefined, false>(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::euclidianDistance, RoutingAlgorithm::undefined, true >(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, false>(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, true >(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, false>(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::entity, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, true >(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, false>(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::undefined, true >(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, false>(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::undefined, true >(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::shortest, false>(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::lateral, RoutingAlgorithm::shortest, true >(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::shortest, false>(const EntityRef &, const Position &) -> double;
template <> auto DistanceCondition::distance<CoordinateSystem::lane, RelativeDistanceType::longitudinal, RoutingAlgorithm::shortest, true >(const EntityRef &, const Position &) -> double;
// clang-format on
} // namespace syntax
} // namespace openscenario_interpreter
Expand Down
Loading

0 comments on commit 7eda26e

Please sign in to comment.