9 #include "StateChecker.hpp" 13 planningDimension = si->getStateDimension();
35 _map = (
new octomap::OcTree(mapFile));
36 _map_res = _map->getResolution();
49 _map_res = _map->getResolution();
61 _depth_limit = depth_limit;
68 bool collision(
false);
69 double node_occupancy;
72 const ob::RealVectorStateSpace::StateType *pos = state->as<ob::RealVectorStateSpace::StateType>();
76 if(planningDimension==2)
78 pos->values[2]=_depth_limit;
82 for(
double xi = pos->values[0]-(_check_box.x/2.0);xi <= pos->values[0]+(_check_box.x/2.0);xi=xi+_map_res)
83 for(
double yi = pos->values[1]-(_check_box.y/2.0);yi <= pos->values[1]+(_check_box.y/2.0);yi=yi+_map_res)
84 for(
double zi = pos->values[2]-(_check_box.z/2.0);zi <= pos->values[2]+(_check_box.z/2.0);zi=zi+_map_res){
88 result = _map->search (query);
92 node_occupancy = result->getOccupancy();
94 if (node_occupancy > 0.4)
StateChecker(const ob::SpaceInformationPtr &si)
Constructor.
void setDepthLimit(double depth_limit)
Set the depth limit (constant for 2D checking)
void setCollisionMask(double x, double y, double z=0.2)
Set the area around every state considered for state checking.
virtual bool isValid(const ob::State *state) const
State validator.
void loadMap(const std::string mapFile)
Load the octomap where the states are checked.
~StateChecker()
Destructor.