ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
mission_controller.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  * Jan Lauermann - initial implementation
13  ********************************************************************************/
14 #pragma once
15 
16 #include <adore/fun/afactory.h>
17 #include <adore/params/afactory.h>
18 #include <adore/mad/com_patterns.h>
19 #include <adore/fun/missiondata.h>
20 
21 namespace adore
22 {
23  namespace apps
24  {
29  {
30  private:
31  /* read: */
35  adore::params::APMissionControl* p_mission_control_; /* parameters for mission control*/
36 
37  /* write: */
39 
44 
45  public:
47  {
49  x_state_reader_ = adore::fun::FunFactoryInstance::get()->getVehicleExtendedStateReader();
53  }
55  {
56  delete motion_state_reader_;
57  delete x_state_reader_;
58  delete nav_goal_reader_;
59  delete p_mission_control_;
60  delete mission_data_writer_;
61  }
62 
63  void run()
64  {
65  //update data
69 
70  double distance_to_goal = std::sqrt((motion_state_.getX()-nav_goal_.target_.x_)*(motion_state_.getX()-nav_goal_.target_.x_)
72 
73  //state machine
75  {
77  {
79  {
81  }
82  }
83  break;
85  {
86  if(distance_to_goal < p_mission_control_->getDistanceToGoalForStop())
87  {
89  }
90  }
91  break;
93  {
94  if(distance_to_goal > p_mission_control_->getDistanceToGoalForStart())
95  {
97  }
98  }
99  break;
100  }
101 
102  //reset mission state, if automation is not actived
104  {
106  }
107 
108  //write mission data
110  }
111  };
112  }
113 }
Simple state machine for mission controlling.
Definition: mission_controller.h:29
void run()
Definition: mission_controller.h:63
adore::fun::NavigationGoal nav_goal_
Definition: mission_controller.h:42
adore::fun::MissionData mission_data_
Definition: mission_controller.h:43
adore::mad::AWriter< adore::fun::MissionData > * mission_data_writer_
Definition: mission_controller.h:38
adore::fun::VehicleExtendedState x_state_
Definition: mission_controller.h:41
adore::fun::VehicleMotionState9d motion_state_
Definition: mission_controller.h:40
adore::mad::AReader< adore::fun::NavigationGoal > * nav_goal_reader_
Definition: mission_controller.h:34
adore::params::APMissionControl * p_mission_control_
Definition: mission_controller.h:35
adore::mad::AReader< adore::fun::VehicleExtendedState > * x_state_reader_
Definition: mission_controller.h:33
adore::mad::AReader< adore::fun::VehicleMotionState9d > * motion_state_reader_
Definition: mission_controller.h:32
~MissionController()
Definition: mission_controller.h:54
MissionController()
Definition: mission_controller.h:46
virtual TNavigationGoalReader * getNavigationGoalReader()=0
virtual TVehicleMotionStateReader * getVehicleMotionStateReader()=0
static adore::fun::AFactory * get()
Definition: afactory.h:170
Definition: missiondata.h:25
void setMissionState(MissionState missionState)
Definition: missiondata.h:45
MissionState getMissionState() const
Definition: missiondata.h:42
@ DRIVING_TO_GOAL
Definition: missiondata.h:30
@ GOAL_REACHED
Definition: missiondata.h:31
@ AUTOMATION_NOT_ACTIVE
Definition: missiondata.h:29
Definition: vehicleextendedstate.h:26
bool getAutomaticControlAccelerationOn() const
Definition: vehicleextendedstate.h:75
virtual void getData(T &value)=0
virtual void write(const T &value)=0
virtual APMissionControl * getMissionControl() const =0
abstract class containing parameters for mission controller configuration
Definition: ap_mission_control.h:25
virtual double getDistanceToGoalForStart() const =0
static adore::params::AFactory * get()
Definition: afactory.h:103
Definition: areaofeffectconverter.h:20
This struct holds the motion state of the vehicle in 9d.
Definition: vehiclemotionstate9d.h:39
double getX() const
Get the x-coordinate.
Definition: vehiclemotionstate9d.h:54
double getY() const
Get the y-coordinate.
Definition: vehiclemotionstate9d.h:60
Definition: navigationgoal.h:26
adore::mad::GlobalPosition target_
Definition: navigationgoal.h:28
double x_
Definition: globalposition.h:23
double y_
Definition: globalposition.h:23