47 #ifndef DART_PLANNING_RRT_HPP_
48 #define DART_PLANNING_RRT_HPP_
58 template <
class A>
class L2;
64 namespace simulation {
class World; }
65 namespace dynamics {
class Skeleton; }
74 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
105 const std::vector<Eigen::VectorXd> &roots,
double stepSize = 0.02);
130 virtual bool newConfig(std::list<Eigen::VectorXd> &intermediatePoints, Eigen::VectorXd &qnew,
131 const Eigen::VectorXd &qnear,
const Eigen::VectorXd &qtarget);
136 double getGap(
const Eigen::VectorXd &target);
140 void tracePath(
int node, std::list<Eigen::VectorXd> &path,
bool reverse =
false);
167 virtual int addNode(
const Eigen::VectorXd &qnew,
int parentId);
The rapidly-expanding random tree implementation.
Definition: RRT.hpp:70
const double stepSize
Step size at each node creation.
Definition: RRT.hpp:87
virtual int addNode(const Eigen::VectorXd &qnew, int parentId)
Adds a new node to the tree.
Definition: RRT.cpp:159
std::vector< int > parentVector
The ith node in configVector has parent with index pV[i].
Definition: RRT.hpp:90
const int ndim
Number of dof we can manipulate (may be less than robot's)
Definition: RRT.hpp:86
StepResult tryStep()
Try a single step with the given "stepSize" to a random configuration. Fail if collide.
Definition: RRT.cpp:116
StepResult
To get byte-aligned Eigen vectors.
Definition: RRT.hpp:77
@ STEP_PROGRESS
Definition: RRT.hpp:80
@ STEP_REACHED
Definition: RRT.hpp:79
@ STEP_COLLISION
Definition: RRT.hpp:78
flann::Index< flann::L2< double > > * index
The underlying flann data structure for fast nearest neighbor searches.
Definition: RRT.hpp:158
virtual bool newConfig(std::list< Eigen::VectorXd > &intermediatePoints, Eigen::VectorXd &qnew, const Eigen::VectorXd &qnear, const Eigen::VectorXd &qtarget)
Checks if the given new configuration is in collision with an obstacle.
Definition: RRT.cpp:154
int activeNode
Last added node or the nearest node found after a search.
Definition: RRT.hpp:89
RRT(dart::simulation::WorldPtr world, dart::dynamics::SkeletonPtr robot, const std::vector< std::size_t > &dofs, const Eigen::VectorXd &root, double stepSize=0.02)
virtual Eigen::VectorXd getRandomConfig()
Returns a random configuration with the specified node IDs.
Definition: RRT.cpp:201
RRT(simulation::WorldPtr world, dynamics::SkeletonPtr robot, const std::vector< std::size_t > &dofs, const std::vector< Eigen::VectorXd > &roots, double stepSize=0.02)
Constructor with multiple roots (so, multiple trees)
dynamics::SkeletonPtr robot
The ID of the robot for which a plan is generated.
Definition: RRT.hpp:154
double getGap(const Eigen::VectorXd &target)
Returns the distance between the current active node and the given node.
Definition: RRT.cpp:212
StepResult tryStep(const Eigen::VectorXd &qtry)
Try a single step with the given "stepSize" to the given configuration. Fail if collide.
simulation::WorldPtr world
The world that the robot is in.
Definition: RRT.hpp:153
virtual int getNearestNeighbor(const Eigen::VectorXd &qsamp)
Returns the nearest neighbor to query point.
Definition: RRT.cpp:178
std::size_t getSize()
Returns the number of nodes in the tree.
Definition: RRT.cpp:235
virtual bool checkCollisions(const Eigen::VectorXd &c)
Implementation-specific function for checking collisions.
Definition: RRT.cpp:229
bool connect()
Reach for a random node by repeatedly extending nodes from the nearest neighbor in the tree.
Definition: RRT.cpp:95
std::vector< std::size_t > dofs
The dofs of the robot the planner can manipulate.
Definition: RRT.hpp:155
bool connect(const Eigen::VectorXd &target)
Reach for a target by repeatedly extending nodes from the nearest neighbor. Stop if collide.
std::vector< const Eigen::VectorXd * > configVector
All visited configs.
Definition: RRT.hpp:95
void tracePath(int node, std::list< Eigen::VectorXd > &path, bool reverse=false)
Traces the path from some node to the initConfig node - useful in creating the full path after the go...
Definition: RRT.cpp:217
virtual ~RRT()
Destructor.
Definition: RRT.hpp:108
double randomInRange(double min, double max)
Returns a random value between the given minimum and maximum value.
Definition: RRT.cpp:192
virtual StepResult tryStepFromNode(const Eigen::VectorXd &qtry, int NNidx)
Tries to extend tree towards provided sample.
Definition: RRT.cpp:128
std::shared_ptr< Skeleton > SkeletonPtr
Definition: SmartPointer.hpp:60
std::shared_ptr< World > WorldPtr
Definition: SmartPointer.hpp:41
Definition: BulletCollisionDetector.cpp:63