ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
distanceStateMachine.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2020 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Reza Dariani- initial API and implementation
13  ********************************************************************************/
14 #pragma once
15 #include <boost/statechart/event.hpp>
16 #include <boost/statechart/state_machine.hpp>
17 #include <boost/statechart/simple_state.hpp>
18 #include <boost/statechart/custom_reaction.hpp>
19 #include <boost/statechart/transition.hpp>
20 #include <boost/mpl/list.hpp>
21 #include <iostream>
22 namespace sc = boost::statechart;
23 namespace mpl = boost::mpl;
24 namespace adore
25 {
26  namespace fun
27  {
28  namespace logic
29  {
30  //GD : Gap Distance
31  //ND : Normal Distance
32  //PD : Platooning Distance
33  struct GAP_DISTANCE;
34  struct NORMAL_DISTANCE;
35  struct PLATOONING_DISTANCE;
36  struct GD2ND : sc::event <GD2ND> {}; // "GAP_DISTANCE" to "NORMAL_DISTANCE"
37  struct ND2PD : sc::event <ND2PD> {}; // "NORMAL_DISTANCE" to "PLATOONING_DISTANCE"
38  struct ND2GD : sc::event <ND2GD> {}; // "NORMAL_DISTANCE" to "GAP_DISTANCE"
39  struct PD2ND : sc::event <PD2ND> {}; // "PLATOONING_DISTANCE" to "NORMAL_DISTANCE"
40  struct PD2GD : sc::event <PD2GD> {}; // "PLATOONING_DISTANCE" to "GAP_DISTANCE"
41 
42  struct DistanceStateMachine: sc::state_machine <DistanceStateMachine, NORMAL_DISTANCE> {};
43  struct NORMAL_DISTANCE : sc::simple_state<NORMAL_DISTANCE, DistanceStateMachine>
44  {
45  NORMAL_DISTANCE () { std::cout<< "NORMAL_DISTANCE"<<std::endl;}
46  typedef mpl::list<
47  sc:: transition<ND2PD, PLATOONING_DISTANCE> ,
48  sc:: transition<ND2GD, GAP_DISTANCE>> reactions;
49  };
50  struct GAP_DISTANCE : sc::simple_state<GAP_DISTANCE, DistanceStateMachine>
51  {
52  GAP_DISTANCE () { std::cout<< "GAP_DISTANCE"<<std::endl;}
53  // typedef mpl::list<
54  typedef sc:: transition<GD2ND, NORMAL_DISTANCE> reactions;
55  };
56  struct PLATOONING_DISTANCE : sc::simple_state<PLATOONING_DISTANCE, DistanceStateMachine>
57  {
58  PLATOONING_DISTANCE () { std::cout<< "PLATOONING_DISTANCE"<<std::endl;}
59  typedef mpl::list<
60  sc:: transition<PD2GD, GAP_DISTANCE> ,
61  sc:: transition<PD2ND, NORMAL_DISTANCE>> reactions;
62  };
63  }
64 
65  }
66 
67 }
Definition: areaofeffectconverter.h:20
Definition: distanceStateMachine.h:42
Definition: distanceStateMachine.h:51
GAP_DISTANCE()
Definition: distanceStateMachine.h:52
sc::transition< GD2ND, NORMAL_DISTANCE > reactions
Definition: distanceStateMachine.h:54
Definition: distanceStateMachine.h:36
Definition: distanceStateMachine.h:38
Definition: distanceStateMachine.h:37
NORMAL_DISTANCE is defined as an entry state of the state machine
Definition: distanceStateMachine.h:44
NORMAL_DISTANCE()
Definition: distanceStateMachine.h:45
mpl::list< sc::transition< ND2PD, PLATOONING_DISTANCE >, sc::transition< ND2GD, GAP_DISTANCE > > reactions
Definition: distanceStateMachine.h:48
Definition: distanceStateMachine.h:40
Definition: distanceStateMachine.h:39
Definition: distanceStateMachine.h:57
PLATOONING_DISTANCE()
Definition: distanceStateMachine.h:58
mpl::list< sc::transition< PD2GD, GAP_DISTANCE >, sc::transition< PD2ND, NORMAL_DISTANCE > > reactions
Definition: distanceStateMachine.h:61