Skip to content
Snippets Groups Projects
Commit 714ea4d5 authored by Elnagdy Elnagdy's avatar Elnagdy Elnagdy
Browse files

Add vehicle light state control strategy

parent 8b831216
No related branches found
No related tags found
1 merge request!162Add vehicle light state control strategy
/*******************************************************************************
* Copyright (c) 2021-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (c) 2021-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (c) 2022 Ansys, Inc.
*
* This program and the accompanying materials are made
......@@ -22,6 +22,7 @@
#include <MantleAPI/Common/vector.h>
#include <MantleAPI/Map/lane_definition.h>
#include <MantleAPI/Traffic/traffic_light_properties.h>
#include <MantleAPI/Traffic/vehicle_light_properties.h>
#include <vector>
......@@ -50,7 +51,8 @@ enum class ControlStrategyType
kAcquireLaneOffset,
kFollowTrajectory,
kUpdateTrafficLightStates,
kPerformLaneChange
kPerformLaneChange,
kUpdateVehicleLightStates,
};
/// Defintion of all control strategies for a single entity.
......@@ -217,6 +219,19 @@ struct AcquireLaneOffsetControlStrategy : public ControlStrategy
TransitionDynamics transition_dynamics;
};
/// Controls the transition of a vehicle light state to the target light state
struct VehicleLightStatesControlStrategy : public ControlStrategy
{
VehicleLightStatesControlStrategy()
{
type = ControlStrategyType::kUpdateVehicleLightStates;
movement_domain = MovementDomain::kNone;
}
LightType light_type; ///< Light type
LightState light_state; ///< Light state
};
/// Controls the transition of a current light state to the target light state
struct TrafficLightStateControlStrategy : public ControlStrategy
{
......
/*******************************************************************************
* Copyright (c) 2024, 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 vehicle_light_properties.h
//-----------------------------------------------------------------------------
#ifndef MANTLEAPI_TRAFFIC_VEHICLE_LIGHT_PROPERTIES_H
#define MANTLEAPI_TRAFFIC_VEHICLE_LIGHT_PROPERTIES_H
#include <string>
#include <variant>
namespace mantle_api
{
/// Defines the vehicle light type
enum class VehicleLightType
{
kUndefined = 0,
kBrakeLights,
kDaytimeRunningLights,
kFogLights,
kFogLightsFront,
kFogLightsRear,
kHighBeam,
kIndicatorLeft,
kIndicatorRight,
kLicensePlateIllumination,
kLowBeam,
kReversingLights,
kSpecialPurposeLights,
kWarningLights
};
/// Light type variant of vehicle light type or user defined light
using LightType = std::variant<VehicleLightType, std::string>;
/// Defines the light mode
enum class LightMode
{
kUndefined = 0,
kFlashing,
kOff,
kOn
};
/// Specifies the light state
struct LightState
{
LightMode light_mode; ///< Light mode
};
/// Equality comparison for LightState.
///
/// @param[in] lhs The left-hand side value for the comparison
/// @param[in] rhs The right-hand side value for the comparison
/// @returns true if the values of lhs exactly equal to the values of rhs.
constexpr bool operator==(const LightState& lhs,
const LightState& rhs) noexcept
{
return lhs.light_mode == rhs.light_mode;
}
/// Inequality comparison for LightState.
///
/// @param[in] lhs The left-hand side value for the comparison
/// @param[in] rhs The right-hand side value for the comparison
/// @returns true if the value of lhs is not equal to the value of rhs.
constexpr bool operator!=(const LightState& lhs,
const LightState& rhs) noexcept
{
return !(lhs == rhs);
}
} // namespace mantle_api
#endif // MANTLEAPI_TRAFFIC_VEHICLE_LIGHT_PROPERTIES_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment