Quad-SDK
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
PlannerClass Class Reference

#include <planner_class.h>

Inheritance diagram for PlannerClass:
Inheritance graph
[legend]
Collaboration diagram for PlannerClass:
Collaboration graph
[legend]

Public Member Functions

 PlannerClass (int direction, const PlannerConfig &planner_config)
 Constructor for PlannerClass.
 
State randomState (const PlannerConfig &planner_config)
 Generate a random state by sampling from within the bounds of the terrain.
 
std::vector< int > neighborhoodN (State s, int N) const
 Get the closest N vertices to the specified state by Euclidean distance.
 
std::vector< int > neighborhoodDist (State q, double dist) const
 Get the vertices within the specified Euclidean distance of the specified state.
 
int getNearestNeighbor (State q) const
 Get the closest verticex to the specified state by Euclidean distance.
 
- Public Member Functions inherited from GraphClass
 GraphClass ()
 Constructor for GraphClass.
 
void addVertex (int index, State s)
 Add a new vertex to the graph along with its state data.
 
State getVertex (int index)
 Retrieve the state stored at a particular index in the graph.
 
int getNumVertices ()
 Retrieve the total number of vertices in the graph, computed as the size of the vertices vector.
 
virtual void addEdge (int idx1, int idx2)
 Add a new edge to the graph.
 
virtual void addEdge (int idx1, int idx2, double edge_cost)
 Add a new edge to the graph.
 
void removeEdge (int idx1, int idx2)
 Remove an edge of the graph.
 
virtual int getPredecessor (int idx)
 Get the parent of a vertex.
 
std::vector< int > getSuccessors (int idx)
 Get the children of a vertex.
 
void addAction (int idx, Action a)
 Add an action to a particular vertex. This is the action that lead to this particular vertex from its parent.
 
Action getAction (int idx)
 Get the action of a vertex.
 
void updateGValue (int idx, double val)
 Update the g-value of a vertex and propogate to all its successors.
 
double getGValue (int idx)
 Get the g-value of a vertex.
 
double computeEdgeCost (int idx1, int idx2)
 Compute the cost of an edge between two vertices.
 
void printVertex (State s)
 Print the state information via stdout.
 
void printVertices ()
 Print the all vertices in the graph via stdout.
 
void printIncomingEdges (int idx)
 Print the edges leading to a vertex via stdout.
 
virtual void printEdges ()
 Print the all edges in the graph via stdout.
 
virtual void init (State s)
 Initialize the graph by adding the root vertex (idx = 0) and setting g(idx) = 0.
 

Public Attributes

int direction_ = FORWARD
 Direction.
 
std::shared_ptr< std::lognormal_distribution< double > > vel_distribution_
 Lognormal distribution for velocity sampling.
 

Additional Inherited Members

- Protected Attributes inherited from GraphClass
std::unordered_map< int, Statevertices
 Map from vertex indices to corresponding states.
 
std::unordered_map< int, Actionactions
 Map from vertex indices to the actions leading to those vertices.
 
std::unordered_map< int, std::vector< int > > edges
 Map from vertex indices to their parent(s)
 
std::unordered_map< int, std::vector< int > > successors
 Map from vertex indices to their children.
 
std::unordered_map< int, double > g_values
 Map from vertex indices to their costs (g-values)
 

Detailed Description

A directed graph class with supplemental methods to aid in sample-based planning.

This class inherits GraphClass, and adds method to add random states to the graph and search for neighbors. These functions are useful for sample-based planners such as RRTs or PRMs.

Constructor & Destructor Documentation

◆ PlannerClass()

PlannerClass::PlannerClass ( int  direction,
const PlannerConfig planner_config 
)

Constructor for PlannerClass.

Parameters
[in]directionDirection of tree expansion
[in]planner_configConfiguration structure used for sampling params
Returns
Constructed object of type PlannerClass

Member Function Documentation

◆ getNearestNeighbor()

int PlannerClass::getNearestNeighbor ( State  q) const

Get the closest verticex to the specified state by Euclidean distance.

Parameters
[in]sState to query the neighborhood
Returns
Index of closest vertex

◆ neighborhoodDist()

std::vector< int > PlannerClass::neighborhoodDist ( State  q,
double  dist 
) const

Get the vertices within the specified Euclidean distance of the specified state.

Parameters
[in]sState to query the neighborhood
[in]distdistance threshold for the neighborhood
Returns
Vector of indices included in the neighborhood

◆ neighborhoodN()

std::vector< int > PlannerClass::neighborhoodN ( State  s,
int  N 
) const

Get the closest N vertices to the specified state by Euclidean distance.

Parameters
[in]sState to query the neighborhood
[in]NNumber of vertices to include in the neighborhood
Returns
Vector of indices included in the neighborhood

◆ randomState()

State PlannerClass::randomState ( const PlannerConfig planner_config)

Generate a random state by sampling from within the bounds of the terrain.

Parameters
[in]terrainHeight map of the terrain
Returns
Newly generated random state

The documentation for this class was generated from the following files: