ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
trajectory_planner_base.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  * Daniel Heß - base class for trajectory planners
13  ********************************************************************************/
14 
15 
16 #pragma once
17 
18 #include <adore/fun/afactory.h>
20 
21 
22 namespace adore
23 {
24  namespace apps
25  {
31  {
32  private:
35 
36  public:
38  {
39  delete result_writer_;
40  delete request_listener_;
41  }
43  {
44  result_writer_ = adore::fun::FunFactoryInstance::get()->getPlanningResultWriter();
45  request_listener_ = adore::fun::FunFactoryInstance::get()->getPlanningRequestTrigger();
46  }
47  void prime()
48  {
49  std::function<void()> handler(std::bind(&adore::apps::TrajectoryPlannerBase::planning_request_handler,this));
51  }
53  {
54  adore::fun::PlanningRequest planning_request;
55  adore::fun::PlanningResult planning_result;
57  {
58  request_listener_->getLatest(planning_request);
59  try{
60  computeTrajectory(planning_request,planning_result);
61  result_writer_->write(planning_result);
62  }catch( const std::exception & ex ) {
63  std::cerr << ex.what() << std::endl;
64  }
65  }
66  }
71  };
72  }
73 }
Base class for different trajectory planners: Handles communication w/ decision making module....
Definition: trajectory_planner_base.h:31
virtual void computeTrajectory(const adore::fun::PlanningRequest &request, adore::fun::PlanningResult &result)=0
override computeTrajectory with actual planning method
virtual ~TrajectoryPlannerBase()
Definition: trajectory_planner_base.h:37
adore::mad::AFeedWithCallback< adore::fun::PlanningRequest > * request_listener_
Definition: trajectory_planner_base.h:34
TrajectoryPlannerBase()
Definition: trajectory_planner_base.h:42
void prime()
Definition: trajectory_planner_base.h:47
adore::mad::AWriter< adore::fun::PlanningResult > * result_writer_
Definition: trajectory_planner_base.h:33
void planning_request_handler()
Definition: trajectory_planner_base.h:52
static adore::fun::AFactory * get()
Definition: afactory.h:170
virtual bool hasNext() const =0
virtual void setCallback(std::function< void()> fcn)=0
virtual void getLatest(T &value)=0
virtual void write(const T &value)=0
Definition: areaofeffectconverter.h:20
Definition: planning_request.h:22
Definition: planning_result.h:29