ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
indicator_dispatcher.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2021 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  * Daniel Heß - initial API and implementation
13  ********************************************************************************/
14 #pragma once
15 #include <adore/fun/afactory.h>
17 namespace adore
18 {
19 namespace fun
20 {
25  {
26  private:
30  public:
32  {
33  icw_ = FunFactoryInstance::get()->getIndicatorCommandWriter();
35  }
37  {
38  delete icw_;
39  }
40  void setIndicators(const PlanningResult& selected_maneuver)
41  {
42  if(!xreader_->hasData())return;
44  xreader_->getData(x);
45 
47  //set indicators only if automatic control enabled
49  {
50  if( selected_maneuver.combined_maneuver_valid
51  && selected_maneuver.combined_maneuver.isActive(x.getTime()) )
52  {
53  ic.setIndicatorLeftOn(selected_maneuver.indicator_left);
54  ic.setIndicatorRightOn(selected_maneuver.indicator_right);
55  }
56  else
57  {
58  if(x.getvx()>2.0)
59  {
60  //if no maneuver is active, set emergency indicators
61  ic.setIndicatorLeftOn(true);
62  ic.setIndicatorRightOn(true);
63  }
64  else
65  {
66  ic.setIndicatorLeftOn(false);
67  ic.setIndicatorRightOn(false);
68  }
69  }
70  }
71  else
72  {
73  //if in manual mode, always set automatic control of indicators to false
74  ic.setIndicatorLeftOn(false);
75  ic.setIndicatorRightOn(false);
76  }
77  icw_->write(ic);
78  }
79 
80  };
81 }
82 }
virtual TVehicleMotionStateReader * getVehicleMotionStateReader()=0
Definition: activationstateobserver.h:22
bool isAutomaticControlEnabled()
Definition: activationstateobserver.h:34
static adore::fun::AFactory * get()
Definition: afactory.h:170
Dispatches indicator command for maneuver, which is currently executed.
Definition: indicator_dispatcher.h:25
AFactory::TIndicatorCommandWriter * icw_
Definition: indicator_dispatcher.h:27
~IndicatorDispatcher()
Definition: indicator_dispatcher.h:36
void setIndicators(const PlanningResult &selected_maneuver)
Definition: indicator_dispatcher.h:40
AFactory::TMotionStateReader * xreader_
Definition: indicator_dispatcher.h:29
ActivationStateObserver activation_observer_
Definition: indicator_dispatcher.h:28
IndicatorDispatcher()
Definition: indicator_dispatcher.h:31
bool isActive(double t) const
Definition: setpointrequest.h:332
Definition: com_patterns.h:68
virtual void getData(T &value)=0
virtual bool hasData() const =0
Definition: com_patterns.h:97
virtual void write(const T &value)=0
x
Definition: adore_set_goal.py:30
Definition: areaofeffectconverter.h:20
This struct holds the motion state of the vehicle in 9d.
Definition: vehiclemotionstate9d.h:39
Definition: indicatorcommand.h:25
void setIndicatorRightOn(bool indicatorRightOn)
Definition: indicatorcommand.h:49
void setIndicatorLeftOn(bool indicatorLeftOn)
Definition: indicatorcommand.h:39
Definition: planning_result.h:29
bool combined_maneuver_valid
Definition: planning_result.h:64
bool indicator_right
Definition: planning_result.h:77
bool indicator_left
Definition: planning_result.h:76
SetPointRequest combined_maneuver
Definition: planning_result.h:35