Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
lci_state_transition_table.hpp
Go to the documentation of this file.
1#pragma once
2/*
3 * Copyright (C) 2023 LEIDOS.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17#include "lci_states.hpp"
18#include <functional>
19
21{
26{
27public:
28 using TransitionCallback = std::function<void(TransitState prev_state, TransitState new_state, TransitEvent signal)>;
29
34
39 TransitState getState() const;
40
47
56
57private:
60
62
63 // Helper functions for processing each provided signal based on the current state
68
74
81 void setAndLogState(TransitState new_state, TransitEvent source_signal);
82};
83} // namespace lci_strategic_plugin
Class defining the state transition table behavior for the LCIStrategic Strategic Plugin.
void setTransitionCallback(TransitionCallback cb)
Callback setting function. The provided callback will be triggered any time the current state changes...
void logDebugSignal(TransitEvent signal) const
Helper function for logging the provide signal.
TransitState getState() const
Returns the current state.
LCIStrategicStateTransitionTable()=default
Default Constructor.
void setAndLogState(TransitState new_state, TransitEvent source_signal)
Function to change the current state and log the details of the transition.
void signal(TransitEvent signal)
Trigger signal for the transition table.
std::function< void(TransitState prev_state, TransitState new_state, TransitEvent signal)> TransitionCallback
TransitState state_
Current state. This state should only ever be set using the setAndLogState() function.
TransitEvent
Enum describing the possible signals to change the current TransitState.
Definition: lci_states.hpp:39
TransitState
Enum describing the possible states of the LCIStrategic Strategic Plugin.
Definition: lci_states.hpp:25