Buran Motion Planning Framework
trajectory_finding_server.h
1 #pragma once
2 
3 #include "base_server.h"
4 #include "monotone_trajectory_finder.h"
5 
10 public:
11 
15  static const int COMMAND_IS_READY = 0;
19  static const int COMMAND_START_FIND_TRAJECTORY = 1;
23  static const int COMMAND_GET_POSITIONS = 2;
27  static const int COMMAND_GET_SPEED = 3;
31  static const int COMMAND_GET_ACCELERATIONS = 4;
32 
39  void processCommand(int clientSocket, int command, Json::Value jsonData) override;
40 
49  static void startFindTrajectory(
50  TrajectoryFindingServer *tps, std::shared_ptr<bmpf::MonotoneTrajectoryFinder> tf,
51  int clientSocket, std::vector<double> start, std::vector<double> end);
52 
57  void onSocketConnected(int clientSocket) override;
58 
70  TrajectoryFindingServer(const std::shared_ptr<bmpf::Scene> &scene, double intervalDuration, bool showTrace,
71  unsigned int maxOpenSetSize, int gridSize, unsigned int maxNodeCnt, int checkCnt,
72  int threadCnt = 1) {
73  _scene = scene;
74  _intervalDuration = intervalDuration;
75  _showTrace = showTrace;
76  _maxOpenSetSize = maxOpenSetSize;
77  _gridSize = gridSize;
78  _maxNodeCnt = maxNodeCnt;
79  _checkCnt = checkCnt;
80  _threadCnt = threadCnt;
81  }
82 
83 protected:
87  std::unordered_map<int, bool> trajectoryFindingReady;
91  std::unordered_map<int, std::shared_ptr<bmpf::MonotoneTrajectoryFinder>> tfs;
95  std::shared_ptr<bmpf::Scene> _scene;
107  unsigned int _maxOpenSetSize;
115  unsigned int _maxNodeCnt;
124 };
BaseServer
Базовый класс для всех серверов Для реализации сервера, необходимо переопределить две чисто виртуальн...
Definition: base_server.h:26
TrajectoryFindingServer::_threadCnt
int _threadCnt
Definition: trajectory_finding_server.h:123
TrajectoryFindingServer::trajectoryFindingReady
std::unordered_map< int, bool > trajectoryFindingReady
Definition: trajectory_finding_server.h:87
TrajectoryFindingServer::_scene
std::shared_ptr< bmpf::Scene > _scene
Definition: trajectory_finding_server.h:95
TrajectoryFindingServer::_gridSize
int _gridSize
Definition: trajectory_finding_server.h:111
TrajectoryFindingServer::COMMAND_GET_POSITIONS
static const int COMMAND_GET_POSITIONS
Definition: trajectory_finding_server.h:23
TrajectoryFindingServer::COMMAND_START_FIND_TRAJECTORY
static const int COMMAND_START_FIND_TRAJECTORY
Definition: trajectory_finding_server.h:19
TrajectoryFindingServer::TrajectoryFindingServer
TrajectoryFindingServer(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: trajectory_finding_server.h:70
TrajectoryFindingServer::COMMAND_IS_READY
static const int COMMAND_IS_READY
Definition: trajectory_finding_server.h:15
TrajectoryFindingServer::COMMAND_GET_SPEED
static const int COMMAND_GET_SPEED
Definition: trajectory_finding_server.h:27
TrajectoryFindingServer::_showTrace
bool _showTrace
Definition: trajectory_finding_server.h:103
TrajectoryFindingServer::processCommand
void processCommand(int clientSocket, int command, Json::Value jsonData) override
Definition: trajectory_finding_server.cpp:53
TrajectoryFindingServer::_maxNodeCnt
unsigned int _maxNodeCnt
Definition: trajectory_finding_server.h:115
TrajectoryFindingServer::startFindTrajectory
static void startFindTrajectory(TrajectoryFindingServer *tps, std::shared_ptr< bmpf::MonotoneTrajectoryFinder > tf, int clientSocket, std::vector< double > start, std::vector< double > end)
Definition: trajectory_finding_server.cpp:11
TrajectoryFindingServer::_maxOpenSetSize
unsigned int _maxOpenSetSize
Definition: trajectory_finding_server.h:107
TrajectoryFindingServer::_intervalDuration
double _intervalDuration
Definition: trajectory_finding_server.h:99
TrajectoryFindingServer::tfs
std::unordered_map< int, std::shared_ptr< bmpf::MonotoneTrajectoryFinder > > tfs
Definition: trajectory_finding_server.h:91
TrajectoryFindingServer::COMMAND_GET_ACCELERATIONS
static const int COMMAND_GET_ACCELERATIONS
Definition: trajectory_finding_server.h:31
TrajectoryFindingServer::_checkCnt
int _checkCnt
Definition: trajectory_finding_server.h:119
TrajectoryFindingServer::onSocketConnected
void onSocketConnected(int clientSocket) override
Definition: trajectory_finding_server.cpp:29
TrajectoryFindingServer
Definition: trajectory_finding_server.h:9