34const armarx::rrtconnect::NodeId armarx::rrtconnect::Tree::ROOT_NODE_ID{0, 0};
40 if (nodes.at(0).empty())
46 nodes.at(0).at(0).cfg = root;
50std::vector<armarx::rrtconnect::Tree::ConfigType>
53 std::vector<ConfigType> path;
54 while (nodeId != ROOT_NODE_ID)
56 const auto& node =
getNode(nodeId);
57 path.emplace_back(node.cfg);
60 path.emplace_back(
getNode(ROOT_NODE_ID).cfg);
64std::vector<armarx::rrtconnect::Tree::ConfigType>
67 std::vector<ConfigType> path = getReversedPathTo(nodeId);
68 std::reverse(path.begin(), path.end());
72armarx::rrtconnect::NodeId
75 float minDistance = std::numeric_limits<float>::infinity();
77 for (std::size_t workerId = 0; workerId < nodes.size(); ++workerId)
79 const auto& workerNodes = nodes.at(workerId);
80 for (std::size_t nodeSubId = 0; nodeSubId < workerNodes.size(); ++nodeSubId)
82 NodeId currentNodeId{
static_cast<Ice::Long
>(workerId),
83 static_cast<Ice::Long
>(nodeSubId)};
84 const auto& node =
getNode(currentNodeId);
85 float currentDistance =
87 if (currentDistance < minDistance)
89 minDistance = currentDistance;
90 nearesNode = currentNodeId;
NodeId getNearestNeighbour(const ConfigType &cfg)
const NodeType & getNode(const NodeId &nodeId) const
std::vector< ConfigType > getPathTo(const NodeId &nodeId) const
std::vector< ConfigType > getReversedPathTo(NodeId nodeId) const
void addNode(const ConfigType &cfg, const NodeId &parent, std::size_t workerId)
void setRoot(const ConfigType &root)
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
float euclideanDistance(IteratorType1 first1, IteratorType1 last1, IteratorType2 first2)
Returns the euclidean distance.