Buran Motion Planning Framework
monotone_trajectory_finder.h
1 #pragma once
2 
3 #include "base/path_finder.h"
4 #include "continuous_path_finder.h"
5 #include "monotone_cubic_interpolation.h"
6 #include <scene.h>
7 #include <log.h>
8 #include "state.h"
9 
10 namespace bmpf {
15  public:
27  virtual void init(const std::shared_ptr<bmpf::Scene> &scene, double intervalDuration,
28  bool showTrace,
29  unsigned int maxOpenSetSize, int gridSize, unsigned int maxNodeCnt, int checkCnt,
30  int threadCnt = 1);
31 
38  virtual void prepareTrajectory(
39  const std::vector<double> &startState, const std::vector<double> &endState, int &errorCode
40  );
41 
46  _interpolators.clear();
47  }
48 
57  std::vector<double> getTrajectoryNode(double tm);
58 
64  std::vector<double> getTrajectoryPosition(double tm);
65 
71  std::vector<double> getTrajectorySpeed(double tm);
72 
78  std::vector<double> getTrajectoryAcceleration(double tm);
79 
80 
81  protected:
82 
90  void _prepareTrajectory(
91  const std::vector<double> &startState, const std::vector<double> &endState,
92  std::vector<double> &timeIntervals, int &errorCode
93  );
94 
98  std::vector<std::shared_ptr<MonotoneCubicInterpolation>> _interpolators;
102  std::vector<std::vector<double>> _lastPath;
106  std::shared_ptr<bmpf::PathFinder> _pf;
110  std::vector<double> _timeIntervals;
118  std::vector<std::vector<double>> _lastTrajectory;
122  int _nodeCnt{};
126  std::shared_ptr<bmpf::Scene> _scene;
130  double _wholeDuration{};
134  bool _isReady{};
135 
136  public:
137 
142  double getWholeDuration() const { return _wholeDuration; }
143 
148  const std::vector<std::vector<double>> &getLastPath() const { return _lastPath; }
149 
154  const std::vector<std::vector<double>> &getLastTrajectory() const { return _lastTrajectory; }
155 
160  int getNodeCnt() const { return _nodeCnt; }
161 
166  const std::shared_ptr<bmpf::PathFinder> &getPF() const { return _pf; }
167 
172  const std::shared_ptr<bmpf::Scene> &getScene() const { return _scene; }
173 
178  bool isReady() const { return _isReady; }
179 
180  };
181 }
bmpf::MonotoneTrajectoryFinder::_wholeDuration
double _wholeDuration
Definition: monotone_trajectory_finder.h:130
bmpf::MonotoneTrajectoryFinder::_startIntervalDuration
double _startIntervalDuration
Definition: monotone_trajectory_finder.h:114
bmpf::MonotoneTrajectoryFinder::getLastTrajectory
const std::vector< std::vector< double > > & getLastTrajectory() const
Definition: monotone_trajectory_finder.h:154
bmpf::MonotoneTrajectoryFinder::getNodeCnt
int getNodeCnt() const
Definition: monotone_trajectory_finder.h:160
bmpf::MonotoneTrajectoryFinder::_timeIntervals
std::vector< double > _timeIntervals
Definition: monotone_trajectory_finder.h:110
bmpf::MonotoneTrajectoryFinder::getScene
const std::shared_ptr< bmpf::Scene > & getScene() const
Definition: monotone_trajectory_finder.h:172
bmpf::MonotoneTrajectoryFinder
Definition: monotone_trajectory_finder.h:14
bmpf::MonotoneTrajectoryFinder::getWholeDuration
double getWholeDuration() const
Definition: monotone_trajectory_finder.h:142
bmpf::MonotoneTrajectoryFinder::getPF
const std::shared_ptr< bmpf::PathFinder > & getPF() const
Definition: monotone_trajectory_finder.h:166
bmpf::MonotoneTrajectoryFinder::isReady
bool isReady() const
Definition: monotone_trajectory_finder.h:178
bmpf::MonotoneTrajectoryFinder::getTrajectoryAcceleration
std::vector< double > getTrajectoryAcceleration(double tm)
Definition: monotone_trajectory_finder.cpp:166
bmpf::MonotoneTrajectoryFinder::~MonotoneTrajectoryFinder
virtual ~MonotoneTrajectoryFinder()
Definition: monotone_trajectory_finder.h:45
bmpf::MonotoneTrajectoryFinder::_lastTrajectory
std::vector< std::vector< double > > _lastTrajectory
Definition: monotone_trajectory_finder.h:118
bmpf::MonotoneTrajectoryFinder::_nodeCnt
int _nodeCnt
Definition: monotone_trajectory_finder.h:122
bmpf::MonotoneTrajectoryFinder::_prepareTrajectory
void _prepareTrajectory(const std::vector< double > &startState, const std::vector< double > &endState, std::vector< double > &timeIntervals, int &errorCode)
Definition: monotone_trajectory_finder.cpp:57
bmpf::MonotoneTrajectoryFinder::_lastPath
std::vector< std::vector< double > > _lastPath
Definition: monotone_trajectory_finder.h:102
bmpf::MonotoneTrajectoryFinder::prepareTrajectory
virtual void prepareTrajectory(const std::vector< double > &startState, const std::vector< double > &endState, int &errorCode)
Definition: monotone_trajectory_finder.cpp:33
bmpf::MonotoneTrajectoryFinder::getLastPath
const std::vector< std::vector< double > > & getLastPath() const
Definition: monotone_trajectory_finder.h:148
bmpf::MonotoneTrajectoryFinder::_isReady
bool _isReady
Definition: monotone_trajectory_finder.h:134
bmpf::MonotoneTrajectoryFinder::_interpolators
std::vector< std::shared_ptr< MonotoneCubicInterpolation > > _interpolators
Definition: monotone_trajectory_finder.h:98
bmpf::MonotoneTrajectoryFinder::_pf
std::shared_ptr< bmpf::PathFinder > _pf
Definition: monotone_trajectory_finder.h:106
bmpf::MonotoneTrajectoryFinder::init
virtual void init(const std::shared_ptr< bmpf::Scene > &scene, double intervalDuration, bool showTrace, unsigned int maxOpenSetSize, int gridSize, unsigned int maxNodeCnt, int checkCnt, int threadCnt=1)
Definition: monotone_trajectory_finder.cpp:17
bmpf::MonotoneTrajectoryFinder::getTrajectorySpeed
std::vector< double > getTrajectorySpeed(double tm)
Definition: monotone_trajectory_finder.cpp:147
bmpf::MonotoneTrajectoryFinder::getTrajectoryPosition
std::vector< double > getTrajectoryPosition(double tm)
Definition: monotone_trajectory_finder.cpp:128
bmpf::MonotoneTrajectoryFinder::getTrajectoryNode
std::vector< double > getTrajectoryNode(double tm)
получить все ноды траекторий получить все ноды траекторий (первая координата время,...
Definition: monotone_trajectory_finder.cpp:98
bmpf::MonotoneTrajectoryFinder::_scene
std::shared_ptr< bmpf::Scene > _scene
Definition: monotone_trajectory_finder.h:126