3 #include <sbpl/discrete_space_information/environment.h>
5 #include <traversability_generator3d/TraversabilityGenerator3d.hpp>
6 #include <maps/grid/TraversabilityMap3d.hpp>
7 #include <base/Pose.hpp>
10 #include <trajectory_follower/SubTrajectory.hpp>
26 typedef traversability_generator3d::TraversabilityGenerator3d::MLGrid
MLGrid;
28 traversability_generator3d::TraversabilityGenerator3d
travGen;
34 msg(
"SBPL has encountered a fatal error: " +
what){}
36 virtual const char*
what()
const throw()
40 const std::string
msg;
58 traversability_generator3d::TravGenNode *
travNode;
75 typedef maps::grid::TraversabilityNode<PlannerData>
XYZNode;
108 bool checkStartGoalNode(
const std::string& name, traversability_generator3d::TravGenNode* node,
double theta);
113 bool obstacleCheck(
const maps::grid::Vector3d& pos,
double theta,
const traversability_generator3d::TraversabilityGenerator3d&
travGen,
114 const traversability_generator3d::TraversabilityConfig& travConf,
115 const sbpl_spline_primitives::SplinePrimitivesConfig& splineConf,
116 const std::string& nodeName=
"node");
122 const traversability_generator3d::TraversabilityConfig &travConf,
123 const sbpl_spline_primitives::SplinePrimitivesConfig &primitiveConfig,
129 void setInitialPatch(
const Eigen::Affine3d &ground2Mls,
double patchRadius);
136 void expandMap(
const std::vector<Eigen::Vector3d>& positions);
145 const Eigen::Affine3d& ground2Body);
162 virtual void GetPreds(
int TargetStateID, std::vector< int >* PredIDV, std::vector< int >* CostV);
163 virtual void GetSuccs(
int SourceStateID, std::vector< int >* SuccIDV, std::vector< int >* CostV);
164 virtual void GetSuccs(
int SourceStateID, std::vector< int >* SuccIDV, std::vector< int >* CostV, std::vector< size_t >& motionIdV);
167 virtual void PrintState(
int stateID,
bool bVerbose, FILE* fOut = 0);
173 void setStart(
const Eigen::Vector3d &startPos,
double theta);
174 void setGoal(
const Eigen::Vector3d &goalPos,
double theta);
183 const maps::grid::TraversabilityMap3d<traversability_generator3d::TravGenNode *> &
getTraversabilityMap()
const;
185 traversability_generator3d::TraversabilityGenerator3d&
getTravGen();
189 std::vector<Motion>
getMotions(
const std::vector<int> &stateIDPath);
191 void getTrajectory(
const std::vector<int> &stateIDPath, std::vector<trajectory_follower::SubTrajectory> &result,
192 bool setZToZero,
const Eigen::Vector3d &startPos,
const Eigen::Vector3d &goalPos,
const double& goalHeading,
const Eigen::Affine3d &plan2Body = Eigen::Affine3d::Identity());
199 void setTravConfig(
const traversability_generator3d::TraversabilityConfig& cfg);
203 void dijkstraComputeCost(
const traversability_generator3d::TravGenNode* source, std::vector<double> &outDistances,
204 const double maxDist)
const;
214 traversability_generator3d::TravGenNode* checkTraversableHeuristic(
const maps::grid::Index sourceIndex, traversability_generator3d::TravGenNode* sourceNode,
215 const ugv_nav4d::Motion& motion,
const maps::grid::TraversabilityMap3d< traversability_generator3d::TravGenNode* >& trMap);
220 bool checkOrientationAllowed(
const traversability_generator3d::TravGenNode* node,
221 const base::Orientation2D& orientation)
const;
225 void precomputeCost();
228 double getAvgSlope(std::vector<const traversability_generator3d::TravGenNode*> path)
const;
231 double getMaxSlope(std::vector<const traversability_generator3d::TravGenNode*> path)
const;
235 double getHeuristicDistance(
const Eigen::Vector3d& a,
const Eigen::Vector3d& b)
const;
241 traversability_generator3d::TravGenNode* movementPossible(traversability_generator3d::TravGenNode* fromTravNode,
const maps::grid::Index& fromIdx,
const maps::grid::Index& toIdx);
246 bool checkExpandTreadSafe(traversability_generator3d::TravGenNode * node);
248 bool usePathStatistics;
250 traversability_generator3d::TraversabilityConfig travConf;
251 sbpl_spline_primitives::SplinePrimitivesConfig primitiveConfig;
253 unsigned int numAngles;
std::ostream & operator<<(std::ostream &stream, const DiscreteTheta &angle)
Definition: DiscreteTheta.cpp:3
Definition: DiscreteTheta.hpp:7
Definition: EnvironmentXYZTheta.hpp:24
Eigen::Vector3d robotHalfSize
Definition: EnvironmentXYZTheta.hpp:117
std::vector< Distance > travNodeIdToDistance
Definition: EnvironmentXYZTheta.hpp:95
void setTravConfig(const traversability_generator3d::TraversabilityConfig &cfg)
Definition: EnvironmentXYZTheta.cpp:1212
virtual void PrintState(int stateID, bool bVerbose, FILE *fOut=0)
Definition: EnvironmentXYZTheta.cpp:911
bool obstacleCheck(const maps::grid::Vector3d &pos, double theta, const traversability_generator3d::TraversabilityGenerator3d &travGen, const traversability_generator3d::TraversabilityConfig &travConf, const sbpl_spline_primitives::SplinePrimitivesConfig &splineConf, const std::string &nodeName="node")
Definition: EnvironmentXYZTheta.cpp:159
const maps::grid::TraversabilityMap3d< traversability_generator3d::TravGenNode * > & getTraversabilityMap() const
Definition: EnvironmentXYZTheta.cpp:1133
ThetaNode * startThetaNode
Definition: EnvironmentXYZTheta.hpp:99
std::vector< Motion > getMotions(const std::vector< int > &stateIDPath)
Definition: EnvironmentXYZTheta.cpp:926
virtual ~EnvironmentXYZTheta()
Definition: EnvironmentXYZTheta.cpp:94
virtual bool InitializeEnv(const char *sEnvFile)
Definition: EnvironmentXYZTheta.cpp:503
XYZNode * createNewXYZState(traversability_generator3d::TravGenNode *travNode)
Definition: EnvironmentXYZTheta.cpp:120
void dijkstraComputeCost(const traversability_generator3d::TravGenNode *source, std::vector< double > &outDistances, const double maxDist) const
void setStart(const Eigen::Vector3d &startPos, double theta)
Definition: EnvironmentXYZTheta.cpp:344
virtual int GetStartHeuristic(int stateID)
heuristic estimate from start state to state with stateID
Definition: EnvironmentXYZTheta.cpp:487
traversability_generator3d::TraversabilityGenerator3d & getTravGen()
Definition: EnvironmentXYZTheta.cpp:1207
virtual void SetAllPreds(CMDPSTATE *state)
Definition: EnvironmentXYZTheta.cpp:368
void clear()
Definition: EnvironmentXYZTheta.cpp:59
maps::grid::TraversabilityMap3d< XYZNode * > searchGrid
Definition: EnvironmentXYZTheta.hpp:78
std::shared_ptr< MLGrid > mlsGrid
Definition: EnvironmentXYZTheta.hpp:29
virtual int SizeofCreatedEnv()
Definition: EnvironmentXYZTheta.cpp:901
virtual void GetSuccs(int SourceStateID, std::vector< int > *SuccIDV, std::vector< int > *CostV)
traversability_generator3d::TraversabilityGenerator3d travGen
Definition: EnvironmentXYZTheta.hpp:28
void setInitialPatch(const Eigen::Affine3d &ground2Mls, double patchRadius)
Definition: EnvironmentXYZTheta.cpp:99
virtual void GetPreds(int TargetStateID, std::vector< int > *PredIDV, std::vector< int > *CostV)
Definition: EnvironmentXYZTheta.cpp:895
const PreComputedMotions & getAvailableMotions() const
Definition: EnvironmentXYZTheta.cpp:1143
maps::grid::TraversabilityNode< PlannerData > XYZNode
Definition: EnvironmentXYZTheta.hpp:75
virtual int GetFromToHeuristic(int FromStateID, int ToStateID)
heuristic estimate from state FromStateID to state ToStateID
Definition: EnvironmentXYZTheta.cpp:383
bool checkStartGoalNode(const std::string &name, traversability_generator3d::TravGenNode *node, double theta)
Definition: EnvironmentXYZTheta.cpp:220
XYZNode * startXYZNode
Definition: EnvironmentXYZTheta.hpp:100
virtual void PrintEnv_Config(FILE *fOut)
Definition: EnvironmentXYZTheta.cpp:906
virtual void SetAllActionsandAllOutcomes(CMDPSTATE *state)
Definition: EnvironmentXYZTheta.cpp:376
void enablePathStatistics(bool enable)
Definition: EnvironmentXYZTheta.cpp:483
void updateMap(std::shared_ptr< MLGrid > mlsGrid)
Definition: EnvironmentXYZTheta.cpp:104
void getTrajectory(const std::vector< int > &stateIDPath, std::vector< trajectory_follower::SubTrajectory > &result, bool setZToZero, const Eigen::Vector3d &startPos, const Eigen::Vector3d &goalPos, const double &goalHeading, const Eigen::Affine3d &plan2Body=Eigen::Affine3d::Identity())
Definition: EnvironmentXYZTheta.cpp:939
std::shared_ptr< trajectory_follower::SubTrajectory > findTrajectoryOutOfObstacle(const Eigen::Vector3d &start, double theta, const Eigen::Affine3d &ground2Body)
Definition: EnvironmentXYZTheta.cpp:1217
virtual bool InitializeMDPCfg(MDPConfig *MDPCfg)
Definition: EnvironmentXYZTheta.cpp:508
EnvironmentXYZTheta(std::shared_ptr< MLGrid > mlsGrid, const traversability_generator3d::TraversabilityConfig &travConf, const sbpl_spline_primitives::SplinePrimitivesConfig &primitiveConfig, const Mobility &mobilityConfig)
Definition: EnvironmentXYZTheta.cpp:33
virtual void GetSuccs(int SourceStateID, std::vector< int > *SuccIDV, std::vector< int > *CostV, std::vector< size_t > &motionIdV)
virtual int GetGoalHeuristic(int stateID)
heuristic estimate from state with stateID to goal state
Definition: EnvironmentXYZTheta.cpp:429
ThetaNode * goalThetaNode
Definition: EnvironmentXYZTheta.hpp:101
std::vector< Hash > idToHash
Definition: EnvironmentXYZTheta.hpp:91
void expandMap(const std::vector< Eigen::Vector3d > &positions)
Definition: EnvironmentXYZTheta.cpp:326
PreComputedMotions availableMotions
Definition: EnvironmentXYZTheta.hpp:97
void setGoal(const Eigen::Vector3d &goalPos, double theta)
Definition: EnvironmentXYZTheta.cpp:240
const Motion & getMotion(const int fromStateID, const int toStateID)
Definition: EnvironmentXYZTheta.cpp:398
traversability_generator3d::TraversabilityGenerator3d::MLGrid MLGrid
Definition: EnvironmentXYZTheta.hpp:26
const MLGrid & getMlsMap() const
Definition: EnvironmentXYZTheta.cpp:1138
ThetaNode * createNewStateFromPose(const std::string &name, const Eigen::Vector3d &pos, double theta, ugv_nav4d::EnvironmentXYZTheta::XYZNode **xyzBackNode)
Definition: EnvironmentXYZTheta.cpp:129
XYZNode * goalXYZNode
Definition: EnvironmentXYZTheta.hpp:102
ThetaNode * createNewState(const DiscreteTheta &curTheta, EnvironmentXYZTheta::XYZNode *curNode)
Definition: EnvironmentXYZTheta.cpp:520
maps::grid::Vector3d getStatePosition(const int stateID) const
Definition: EnvironmentXYZTheta.cpp:389
Definition: PreComputedMotions.hpp:29
Definition: EnvironmentXYZTheta.hpp:18
Definition: EnvironmentXYZTheta.hpp:19
Definition: EnvironmentXYZTheta.hpp:20
Definition: PreComputedMotions.hpp:88
Definition: EnvironmentXYZTheta.hpp:17
Definition: Dijkstra.cpp:8
Definition: EnvironmentXYZTheta.hpp:68
Distance(double toStart, double toGoal)
Definition: EnvironmentXYZTheta.hpp:71
double distToStart
Definition: EnvironmentXYZTheta.hpp:69
double distToGoal
Definition: EnvironmentXYZTheta.hpp:70
Definition: EnvironmentXYZTheta.hpp:32
virtual const char * what() const
Definition: EnvironmentXYZTheta.hpp:36
EnvironmentXYZThetaException(const std::string &what)
Definition: EnvironmentXYZTheta.hpp:33
const std::string msg
Definition: EnvironmentXYZTheta.hpp:40
Definition: EnvironmentXYZTheta.hpp:82
Hash(XYZNode *node, ThetaNode *thetaNode)
Definition: EnvironmentXYZTheta.hpp:83
XYZNode * node
Definition: EnvironmentXYZTheta.hpp:86
ThetaNode * thetaNode
Definition: EnvironmentXYZTheta.hpp:87
Definition: EnvironmentXYZTheta.hpp:54
traversability_generator3d::TravGenNode * travNode
Definition: EnvironmentXYZTheta.hpp:55
PlannerData()
Definition: EnvironmentXYZTheta.hpp:55
std::map< DiscreteTheta, ThetaNode * > thetaToNodes
Definition: EnvironmentXYZTheta.hpp:63
Definition: EnvironmentXYZTheta.hpp:46
DiscreteTheta theta
Definition: EnvironmentXYZTheta.hpp:49
ThetaNode(const DiscreteTheta &t)
Definition: EnvironmentXYZTheta.hpp:47
int id
Definition: EnvironmentXYZTheta.hpp:47
Definition: Mobility.hpp:12