|
A structure holding and managing all data connected to the tree used in the ADDIRRT* algorithm. More...
#include <RobotComponents/components/MotionPlanning/Tasks/AdaptiveDynamicDomainInformedRRTStar/Tree.h>
Classes | |
struct | NodeType |
Represents a node of thr rrt. More... | |
Public Types | |
using | ConfigType = VectorXf |
The type of configurations. More... | |
using | PendingUpdateLookuptableConstIterator = typename PendingUpdateLookuptableType::const_iterator |
Const iterator for the PendingUpdateLookuptable. More... | |
using | PendingUpdateLookuptableIterator = typename PendingUpdateLookuptableType::iterator |
Iterator for the PendingUpdateLookuptable. More... | |
using | PendingUpdateLookuptableType = std::unordered_map< std::pair< std::size_t, std::size_t >, std::size_t > |
Lookuptable for pending updates. More... | |
Public Member Functions | |
void | addGoalReached (const NodeId &goal, float costToGoToGoal) |
Adds a node to the list of nodes that can reach the goal configuration. More... | |
NodeId | addNode (ConfigType cfg, const NodeId &parent, float fromParentCost) |
Adds a node to the tree. More... | |
void | addPendingUpdate (const Update &u) |
Adds a new update to the list of pending updates. More... | |
void | applyPendingUpdates () |
Applies all pending updates. More... | |
template<class LockType , class RemoteUpdateGetter > | |
void | applyPendingUpdates (LockType &&treeLock, RemoteUpdateGetter getRemoteUpdate) |
The same as applyPendingUpdates(LockType, RemoteUpdateGetter, UpdateConsumer) but uses an noop as updateConsumer This overload is needed since the defaultparameter does not work. More... | |
template<class LockType , class RemoteUpdateGetter , class UpdateConsumer > | |
void | applyPendingUpdates (LockType &&treeLock, RemoteUpdateGetter getRemoteUpdate, UpdateConsumer updateConsumer=[](Update &&) {}) |
Applies all pending updates. More... | |
void | applyUpdate (const Update &u) |
Applies the given update. More... | |
NodeType & | at (const NodeId &id) |
const NodeType & | at (const NodeId &id) const |
NodeType & | at (std::size_t index) |
const NodeType & | at (std::size_t index) const |
bool | canApplyUpdate (const Update &u) |
void | decreaseRadius (const NodeId &id) |
Decreases a node's radius. More... | |
const Ice::LongSeq & | getAppliedUpdateIds () const |
float | getBestCost () const |
PathWithCost | getBestPath () const |
const Update & | getCurrentUpdate () const |
Ice::Long | getCurrentUpdateId () const |
FullIceTree | getIceTree () const |
NodeId | getIdOfIndex (std::size_t index) const |
std::vector< std::pair< NodeId, float > > | getKNearestNeighboursAndDistances (const ConfigType &cfg, std::size_t k) |
const std::deque< Update > & | getLocalUpdates () const |
std::pair< NodeId, float > | getNearestNeighbourAndDistance (const ConfigType &cfg) |
NodeId | getNextNodeIdFor (std::size_t workerId) |
NodeType & | getNode (const NodeId &id) |
const NodeType & | getNode (const NodeId &id) const |
const std::deque< std::deque< NodeType > > & | getNodes () const |
float | getNthPathCost (std::size_t n) const |
NodeIdList | getNthPathIds (std::size_t n) const |
PathWithCost | getNthPathWithCost (std::size_t n) const |
std::size_t | getPathCount () const |
const Update & | getPendingUpdate (std::size_t workerId, std::size_t updateId) const |
Ice::Long | getPreviousUpdateId () const |
bool | hasAppliedUpdate (std::size_t workerId, Ice::Long updateId) |
bool | hasGoalNode (const NodeId &nodeId) const |
bool | hasPendingUpdate (std::size_t workerId, std::size_t updateId) const |
void | increaseRadius (const NodeId &id) |
Increases a node's radius. More... | |
void | increaseWorkerCountTo (std::size_t count) |
Increases the storage of all data structures to be appropriate for count workers. More... | |
void | init (const FullIceTree &iceTree, AdaptiveDynamicDomainParameters newaddParams, std::size_t newWorkerId) |
Initailizes the tree from the given tree. More... | |
template<class LockType , class RemoteUpdateGetter , class UpdateConsumer > | |
void | prepareUpdate (Ice::LongSeq dependetOnUpdateIds, LockType &&treeLock, RemoteUpdateGetter getRemoteUpdate, UpdateConsumer updateConsumer) |
Prepares an update by applying all dependet on updates. More... | |
void | sendCurrentUpdate (TreeUpdateInterfacePrx &prx) |
Sends the current update to the given proxy. More... | |
void | setNodeParent (const NodeId &child, const NodeId &newParent, float fromParentCost) |
Sets the parent node of child to parent. More... | |
std::size_t | size () const |
Tree ()=default | |
Default ctor. More... | |
Tree (const VectorXf &startCfg) | |
Creates a tree that can be used to analyze and apply updates. More... | |
Static Public Attributes | |
static const NodeId | ROOT_ID |
The root node's id. More... | |
Protected Member Functions | |
void | applyGoalReachedUpdates (const GoalInfoList newGoalNodes) |
Applies multiple goal reached updates to the tree. More... | |
void | applyNodeCreationUpdate (const NodeCreationUpdate &u, std::size_t workerId) |
Applies a node creation update to the tree. More... | |
template<class LockType , class RemoteUpdateGetter , class UpdateConsumer > | |
void | applyPendingUpdate (std::size_t updateIndex, LockType &&treeLock, RemoteUpdateGetter getRemoteUpdate, UpdateConsumer updateConsumer) |
Applies one pending update from the list of pending updates. More... | |
void | applyRadiusUpdate (const RadiusUpdate &u) |
Applies a radius update to the tree. More... | |
void | applyRewireUpdate (const RewireUpdate &rewireUpdate) |
Applies a rewire update to the tree. More... | |
void | createNewGoalReachedUpdate (const NodeId &goal, float costToGoToGoal) |
Adds a new goal reached update to the current update. More... | |
void | createNewNodeCreationUpdate (const ConfigType &cfg, const NodeId &parent, float fromParentCost) |
Adds a new node creation update to the current update. More... | |
void | createNewRadiusUpdate (const NodeId &id, bool increaseRadius) |
Adds a new radius update to the current update. More... | |
void | createNewRewireUpdate (const NodeId &child, const NodeId &newParent, float fromParentCost) |
Adds a new node creation update to the current update. More... | |
void | doAddGoalReached (const NodeId &goal, float costToGoToGoal) |
Adds a node to the list of nodes that can reach the goal configuration. More... | |
NodeId | doAddNode (ConfigType cfg, const NodeId &parent, float fromParentCost, std::size_t workerId) |
Adds a node to the tree. More... | |
void | doDecreaseRadius (const NodeId &id) |
Decreases a node's radius. More... | |
void | doIncreaseRadius (const NodeId &id) |
Increases a node's radius. More... | |
void | doSetNodeParent (const NodeId &child, const NodeId &newParent, float fromParentCost, bool updateFromStartCost=true) |
Sets the parent node of child to parent. More... | |
PendingUpdateLookuptableIterator | findPendingUpdate (std::size_t workerId, std::size_t updateId) |
PendingUpdateLookuptableConstIterator | findPendingUpdate (std::size_t workerId, std::size_t updateId) const |
std::deque< GoalInfo >::const_iterator | getBestCostIt () const |
Update & | getCurrentUpdateNonConst () |
VectorXfSeq | getPathTo (NodeId id) const |
void | prepareNextUpdate () |
Prepares the next update. More... | |
void | pushCosts (const NodeId &root) |
Updates fromStartCosts for all children from root. More... | |
Protected Attributes | |
AdaptiveDynamicDomainParameters | addParams |
The parameters of adaptive dynamic domain) More... | |
Ice::LongSeq | appliedUpdateIds |
List of ids of applied updates. More... | |
std::deque< GoalInfo > | goalNodes |
List of nodes able to reach the goal configuration. More... | |
std::deque< Update > | localUpdates |
Updates created by this tree. More... | |
std::size_t | nodeCount |
The number of nodes in the rrt. More... | |
std::deque< std::deque< NodeType > > | nodes |
Holds all nodes. More... | |
std::deque< Update > | pendingUpdates |
Updates to apply to the tree. More... | |
PendingUpdateLookuptableType | pendingUpdatesLookupTable |
Speeds up lookup for available updates. More... | |
std::size_t | workerId |
The worker id of this trees owner. More... | |
A structure holding and managing all data connected to the tree used in the ADDIRRT* algorithm.
Function overview: [public ] applyXYZUpdate(XYZUpdate u): applies an existing update u to the tree [protected] createNewXYZUpdate(...) : creates a new update and adds it to the tree's current update [public ] addNode/{in,de}creaseRadius/setNodeParent/addGoalReached: modifies the tree (through do functions) and adds the corresponding update to the local tree [protected] doXYZ: performs the actual modification of the tree
using ConfigType = VectorXf |
using PendingUpdateLookuptableConstIterator = typename PendingUpdateLookuptableType::const_iterator |
using PendingUpdateLookuptableIterator = typename PendingUpdateLookuptableType::iterator |
using PendingUpdateLookuptableType = std::unordered_map<std::pair<std::size_t, std::size_t>, std::size_t> |
|
default |
Default ctor.
Tree | ( | const VectorXf & | startCfg | ) |
|
inline |
Adds a node to the list of nodes that can reach the goal configuration.
(creates an appropriate update)
goal | The node to add. |
costToGoToGoal | The cost to reach the gol configuration from the given node. |
Definition at line 528 of file Tree.h.
NodeId addNode | ( | ConfigType | cfg, |
const NodeId & | parent, | ||
float | fromParentCost | ||
) |
Adds a node to the tree.
(creates an appropriate update)
cfg | The node's configuration. |
parent | The node's parent. |
fromParentCost | The cost of the edge (node, parent) |
Definition at line 241 of file Tree.cpp.
void addPendingUpdate | ( | const Update & | u | ) |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Applies one pending update from the list of pending updates.
updateIndex | The pending update's index. |
treeLock | The lock used to protect the update structures. It will be unlocked when getting a remote update. |
getRemoteUpdate | Function used to request a missing update. |
updateConsumer | Function used to consume updates after they were added. (will be moved to the consumer) |
Definition at line 372 of file Tree.h.
|
inline |
Applies all pending updates.
Updates are not consumes. If a required update is missing this methode will fail. (no update getter is providet). This function is not thread save! Use it only in a serial/protected environment.
Definition at line 197 of file Tree.h.
|
inline |
The same as applyPendingUpdates(LockType, RemoteUpdateGetter, UpdateConsumer) but uses an noop as updateConsumer This overload is needed since the defaultparameter does not work.
getRemoteUpdate | Function used to request a missing update. |
Definition at line 219 of file Tree.h.
|
inline |
Applies all pending updates.
treeLock | The lock used to protect the update structures. It will be unlocked when getting a remote update. |
getRemoteUpdate | Function used to request a missing update. |
updateConsumer | Function used to consume updates after they were added. (will be moved to the consumer) |
|
protected |
|
protected |
void applyUpdate | ( | const Update & | u | ) |
|
inline |
|
inline |
|
inline |
|
inline |
bool canApplyUpdate | ( | const Update & | u | ) |
|
inlineprotected |
Adds a new goal reached update to the current update.
goal | The node that can reach the goal configuration. |
costToGoToGoal | The cost to reach the goal configuration from the given node) |
Definition at line 358 of file Tree.h.
|
inlineprotected |
Adds a new node creation update to the current update.
cfg | The new node's configuration. |
parent | The new node's parent node. |
fromParentCost | The cost of the edge (node, parent) |
Definition at line 339 of file Tree.h.
|
inlineprotected |
|
inlineprotected |
Adds a new node creation update to the current update.
child | The rewired child node. |
newParent | The new parent node. |
fromParentCost | The cost of the edge (child, new parent) |
Definition at line 349 of file Tree.h.
|
inline |
|
inlineprotected |
|
protected |
Adds a node to the tree.
cfg | The node's configuration. |
parent | The node's parent. |
fromParentCost | The cost of the edge (node, parent) |
workerId | The worker creating this node. |
Definition at line 261 of file Tree.cpp.
|
protected |
|
inlineprotected |
|
protected |
Sets the parent node of child to parent.
(costs are updated)
child | The cild node. |
newParent | The new parent node. |
fromParentCost | The cost of the edge (child, new parent) |
updateFromStartCost | Whether to update the costs of the subtree beneath cild. |
Definition at line 281 of file Tree.cpp.
|
inlineprotected |
|
inlineprotected |
|
inline |
float getBestCost | ( | ) | const |
|
inlineprotected |
PathWithCost getBestPath | ( | ) | const |
|
inline |
|
inline |
|
inlineprotected |
FullIceTree getIceTree | ( | ) | const |
NodeId getIdOfIndex | ( | std::size_t | index | ) | const |
std::vector< std::pair< NodeId, float > > getKNearestNeighboursAndDistances | ( | const ConfigType & | cfg, |
std::size_t | k | ||
) |
|
inline |
|
inline |
|
inline |
Tree::NodeType & getNode | ( | const NodeId & | id | ) |
const Tree::NodeType & getNode | ( | const NodeId & | id | ) | const |
|
inline |
|
inline |
NodeIdList getNthPathIds | ( | std::size_t | n | ) | const |
PathWithCost getNthPathWithCost | ( | std::size_t | n | ) | const |
|
inline |
|
protected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void increaseWorkerCountTo | ( | std::size_t | count | ) |
void init | ( | const FullIceTree & | iceTree, |
AdaptiveDynamicDomainParameters | newaddParams, | ||
std::size_t | newWorkerId | ||
) |
|
protected |
|
inline |
Prepares an update by applying all dependet on updates.
dependetOnUpdateIds | The ids of dependet on updates. |
treeLock | The lock used to protect the update structures. It will be unlocked when getting a remote update. |
getRemoteUpdate | Function used to request a missing update. |
updateConsumer | Function used to consume updates after they were added. (will be moved to the consumer) |
Definition at line 423 of file Tree.h.
|
protected |
void sendCurrentUpdate | ( | TreeUpdateInterfacePrx & | prx | ) |
|
inline |
Sets the parent node of child to parent.
(costs are updated) (creates an appropriate update)
child | The cild node. |
newParent | The new parent node. |
fromParentCost | The cost of the edge (child, new parent) |
Definition at line 500 of file Tree.h.
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
protected |