27 #ifndef BATCHING_POMP_BATCHINGPOMP_HPP_ 28 #define BATCHING_POMP_BATCHINGPOMP_HPP_ 33 #include <boost/graph/adjacency_list.hpp> 34 #include <boost/graph/properties.hpp> 35 #include <boost/graph/dijkstra_shortest_paths.hpp> 36 #include <boost/graph/astar_search.hpp> 37 #include <boost/graph/properties.hpp> 38 #include <boost/property_map/dynamic_property_map.hpp> 40 #include <ompl/base/Planner.h> 41 #include <ompl/base/StateSpace.h> 42 #include <ompl/base/ScopedState.h> 43 #include <ompl/base/spaces/RealVectorStateSpace.h> 44 #include <ompl/datastructures/NearestNeighbors.h> 45 #include <ompl/datastructures/NearestNeighborsGNAT.h> 47 #include "batching.hpp" 48 #include "cspacebelief.hpp" 57 const ompl::base::StateSpacePtr space;
58 ompl::base::State * state;
59 StateCon(
const ompl::base::StateSpacePtr _space)
61 , state{space->allocState()} {}
62 ~
StateCon() {space->freeState(this->state); }
65 typedef std::shared_ptr<StateCon> StateConPtr;
74 static const int FREE{1};
77 static const int BLOCKED{-1};
80 static const int UNKNOWN{0};
106 typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, VProps, EProps> Graph;
107 typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
108 typedef boost::graph_traits<Graph>::vertex_iterator VertexIter;
109 typedef boost::graph_traits<Graph>::edge_descriptor Edge;
110 typedef boost::graph_traits<Graph>::edge_iterator EdgeIter;
111 typedef boost::graph_traits<Graph>::out_edge_iterator OutEdgeIter;
114 typedef boost::property_map<Graph, StateConPtr VProps::*>::type VPStateMap;
115 typedef boost::property_map<Graph, double EProps::*>::type EPDistanceMap;
116 typedef boost::property_map<Graph, boost::vertex_index_t>::type VertexIndexMap;
122 std::shared_ptr< batching::BatchingManager<Graph,VPStateMap,StateCon,EPDistanceMap> >
mBatchingPtr;
125 std::shared_ptr< cspacebelief::Model<cspacebelief::BeliefPoint> >
mBeliefModel;
133 BatchingPOMP(
const ompl::base::SpaceInformationPtr & si);
147 BatchingPOMP(
const ompl::base::SpaceInformationPtr & si,
151 const std::string& _roadmapFileName,
152 double _startGoalRadius,
153 double _increment = 0.2,
154 double _pruneThreshold = 0.05);
160 double getCurrentAlpha()
const;
162 double getCurrentBestCost()
const;
164 Vertex getStartVertex()
const;
166 Vertex getGoalVertex()
const;
168 bool isInitSearchBatch()
const;
170 double getIncrement()
const;
171 void setIncrement(
double _decrement);
172 double getStartGoalRadius()
const;
173 void setStartGoalRadius(
double _startGoalRadius);
174 double getPruneThreshold()
const;
175 void setPruneThreshold(
double _pruneThreshold);
177 std::string getGraphType()
const;
178 void setGraphType(
const std::string& _graphType);
179 std::string getBatchingType()
const;
180 void setBatchingType(
const std::string& _selectorType);
181 std::string getSelectorType()
const;
182 void setSelectorType(
const std::string& _selectorType);
183 std::string getRoadmapFileName()
const;
184 void setRoadmapFileName(
const std::string& _roadmapFileName);
203 void setProblemDefinition(
const ompl::base::ProblemDefinitionPtr & pdef);
204 ompl::base::PlannerStatus solve(
const ompl::base::PlannerTerminationCondition & ptc);
212 double vertexDistFun(
const Vertex& u,
const Vertex& v)
const;
219 void initializeEdgePoints(
const Edge& e);
226 double computeAndSetEdgeFreeProbability(
const Edge& e);
232 bool checkAndSetEdgeBlocked(
const Edge& e);
237 std::unique_ptr<util::Selector<Graph>> mSelector;
238 std::unique_ptr<ompl::NearestNeighborsGNAT<Vertex>> mVertexNN;
239 std::function<double(unsigned int)> mRadiusFun;
243 std::vector<Edge> mCurrBestPath;
244 std::set<Edge> mEdgesToUpdate;
247 double mCurrentAlpha;
249 double mStartGoalRadius;
250 double mPruneThreshold;
251 bool mIsInitSearchBatch;
254 double mBestPathCost;
256 std::string mGraphType;
257 std::string mBatchingType;
258 std::string mSelectorType;
259 std::string mRoadmapName;
262 unsigned int mNumEdgeChecks;
263 unsigned int mNumCollChecks;
264 unsigned int mNumSearches;
265 unsigned int mNumLookups;
267 double mCollCheckTime;
272 double haltonRadiusFun(
unsigned int n)
const;
273 double rggRadiusFun(
unsigned int n)
const;
274 bool checkAndUpdatePathBlocked(
const std::vector<Edge>& _ePath);
275 void addAffectedEdges(
const Edge& e);
276 void updateAffectedEdgeWeights();
277 bool isVertexInadmissible(
const ompl::base::State* vState)
const ;
278 bool vertexPruneFunction(
const ompl::base::State* vState)
const;
279 double getPathDistance(
const std::vector<Edge>& _ePath)
const;
283 #endif //BATCHING_POMP_BATCHINGPOMP_HPP_ int blockedStatus
The collision status of the edge (free, blocked or unknown)
Definition: BatchingPOMP.hpp:99
Generates a Van Der Corput sequence ordering for states to check along an edge.
Definition: BisectPerm.hpp:35
std::shared_ptr< batching::BatchingManager< Graph, VPStateMap, StateCon, EPDistanceMap > > mBatchingPtr
The pointer to the batching manager instance to be used by the planner.
Definition: BatchingPOMP.hpp:122
double getLookupTime()
Total time spent doing model lookups.
Definition: BatchingPOMP.hpp:196
unsigned int getNumCollChecks()
Number of calls to collision checker made thus far.
Definition: BatchingPOMP.hpp:190
double distance
The length of the edge using the space distance metric.
Definition: BatchingPOMP.hpp:93
Graph g
The roadmap that will be continuously searched and updated.
Definition: BatchingPOMP.hpp:128
Abstract class that represents the batching strategy used for the planning algorithm.
Definition: BatchingManager.hpp:51
StateConPtr v_state
The underlying state of the vertex.
Definition: BatchingPOMP.hpp:86
std::shared_ptr< cspacebelief::Model< cspacebelief::BeliefPoint > > mBeliefModel
The pointer to the C-space belief model instance to be used by the planner.
Definition: BatchingPOMP.hpp:125
std::vector< StateConPtr > edgeStates
The set of states embedded in the edge.
Definition: BatchingPOMP.hpp:102
Abstract class that represents the configuration space belief manager.
Definition: Model.hpp:40
Properties associated with each roadmap edge.
Definition: BatchingPOMP.hpp:90
double probFree
The probability of collision of the edge.
Definition: BatchingPOMP.hpp:96
The OMPL Planner class that implements the algorithm.
Definition: BatchingPOMP.hpp:68
unsigned int getNumEdgeChecks()
Number of edges evaluated thus far.
Definition: BatchingPOMP.hpp:188
Definition: BatchingManager.hpp:36
double getSearchTime()
Total time spent doing searches.
Definition: BatchingPOMP.hpp:198
const ompl::base::StateSpacePtr mSpace
The pointer to the OMPL state space.
Definition: BatchingPOMP.hpp:119
A selector assigns an ordering for evaluating edges on a candidate path.
Definition: Selector.hpp:47
double getCollCheckTime()
Total time spent doing collision checks.
Definition: BatchingPOMP.hpp:200
Composite struct to associate the state space with each state.
Definition: BatchingPOMP.hpp:55
Graph full_g
The large, dense roadmap that remains unchanged after being loaded once.
Definition: BatchingPOMP.hpp:131
Properties associated with each roadmap vertex.
Definition: BatchingPOMP.hpp:83
unsigned int getNumLookups()
Number of model lookups made thus far.
Definition: BatchingPOMP.hpp:194
unsigned int getNumSearches()
Number of roadmap searches done thus far.
Definition: BatchingPOMP.hpp:192