diff --git a/MantleAPI/include/MantleAPI/Traffic/control_strategy.h b/MantleAPI/include/MantleAPI/Traffic/control_strategy.h index 42a736d431c1d2162dfbe9ec245671094a938d0e..b4a77830f3fc75c82a0b73020b737c6670d5bcba 100644 --- a/MantleAPI/include/MantleAPI/Traffic/control_strategy.h +++ b/MantleAPI/include/MantleAPI/Traffic/control_strategy.h @@ -17,6 +17,7 @@ #include <MantleAPI/Common/spline.h> #include <MantleAPI/Common/vector.h> +#include <MantleAPI/Traffic/traffic_light_properties.h> #include <vector> @@ -28,7 +29,8 @@ enum class MovementDomain kUndefined = 0, kLateral, kLongitudinal, - kBoth + kBoth, + kNone }; enum class ControlStrategyType @@ -40,7 +42,8 @@ enum class ControlStrategyType kFollowLateralOffsetSpline, kFollowVelocitySpline, kFollowRoute, - kAcquireLaneOffset + kAcquireLaneOffset, + kUpdateTrafficLightStates }; struct ControlStrategy @@ -181,6 +184,18 @@ struct AcquireLaneOffsetControlStrategy : public ControlStrategy TransitionDynamics transition_dynamics; }; +struct TrafficLightStateControlStrategy : public ControlStrategy +{ + TrafficLightStateControlStrategy() + { + type = ControlStrategyType::kUpdateTrafficLightStates; + movement_domain = MovementDomain::kNone; + } + + std::vector<TrafficLightPhase> traffic_light_phases{}; + bool repeat_states{false}; +}; + } // namespace mantle_api #endif // MANTLEAPI_TRAFFIC_CONTROLSTRATEGY_H diff --git a/MantleAPI/include/MantleAPI/Traffic/traffic_light_properties.h b/MantleAPI/include/MantleAPI/Traffic/traffic_light_properties.h new file mode 100644 index 0000000000000000000000000000000000000000..2e7f92aeb5fbb3f0f20e1a24226fceca999b28f3 --- /dev/null +++ b/MantleAPI/include/MantleAPI/Traffic/traffic_light_properties.h @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2021, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ + +//----------------------------------------------------------------------------- +/** @file traffic_light_properties.h */ +//----------------------------------------------------------------------------- + +#ifndef MANTLEAPI_TRAFFIC_TRAFFICLIGHTPROPERTIES_H +#define MANTLEAPI_TRAFFIC_TRAFFICLIGHTPROPERTIES_H + +#include <vector> + +namespace mantle_api +{ +enum class TrafficLightBulbColor +{ + kUnknown = 0, + kOther = 1, + kRed = 2, + kYellow = 3, + kGreen = 4, + kBlue = 5, + kWhite = 6 +}; + +enum class TrafficLightBulbMode +{ + kUnknown = 0, + kOther = 1, + kOff = 2, + kConstant = 3, + kFlashing = 4, + kCounting = 5 +}; + +struct TrafficLightBulbState +{ + TrafficLightBulbColor color; + TrafficLightBulbMode mode; +}; + +struct TrafficLightPhase +{ + std::vector<TrafficLightBulbState> bulb_states; + mantle_api::Time start_time{0}; + mantle_api::Time end_time{0}; +}; + +} // namespace mantle_api + +#endif // MANTLEAPI_TRAFFIC_TRAFFICLIGHTPROPERTIES_H