54 catch (Ice::Exception& e)
57 <<
"The worker thread of worker " << workerId
58 <<
" had an Ice::Exception! \nStack trace:\n"
59 << e.ice_stackTrace();
76 ARMARX_VERBOSE_S <<
"[worker " << workerId <<
"] request for update " << updateId <<
" (of "
106 updater.applyPendingUpdates(lock,
107 [
this](Ice::Long workerId, Ice::Long updateId)
125 cspace->initCollisionTest();
128 const auto cspaceDims = cspace->getDimensionsBounds();
129 std::vector<std::pair<float, float>> dimensionBounds{};
131 std::transform(cspaceDims.begin(),
133 std::back_inserter(dimensionBounds),
134 [](
const FloatRange& dim) { return std::make_pair(dim.min, dim.max); });
138 dimensionBounds.end()},
142 auto cspaceDerived = CSpacePtr::dynamicCast(cspace);
153 {
return cspaceDerived->isCollisionFree(cfg); });
178 (*sampler)(randomCfg.data());
180 const auto nearId = primTree.getNearestNeighbour(randomCfg);
181 const auto& nearNode = primTree.getNode(nearId);
183 const auto reachCfg = steer(nearNode.cfg, randomCfg);
184 if (reachCfg != nearNode.cfg)
189 const auto nearSecondId = secnTree.getNearestNeighbour(reachCfg);
190 const auto& nearSecondNode = secnTree.getNode(nearSecondId);
192 const auto reachSecondCfg = steer(nearSecondNode.cfg, reachCfg);
193 if (reachSecondCfg != nearSecondNode.cfg)
197 if (reachSecondCfg == reachCfg)
206 VectorXfSeq pPart2 =
treeFromGoal.getReversedPathTo(goalTreeId);
207 std::move(pPart2.begin(), pPart2.end(), std::back_inserter(p));
208 task->setPath({p,
"Path"});
221 task->workerHasAborted(workerId);
231 updater.getAppliedUpdateIds().size());
254 const NodeId& parent,
255 bool addToPrimaryTree)
257 cspace->initCollisionTest();
259 tree.addNode(cfg, parent, workerId);
264 localUpdates.back().updatesPerTree.at(treeId).nodes.emplace_back(
265 NodeCreationUpdate{cfg, parent});
269 static_cast<Ice::Long
>(tree.getNodes().at(workerId).size()) -
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
std::mt19937 GeneratorType
UniformCuboidDistribution< float > DistributionType
void updateTree(const Update &u, const Ice::Current &=Ice::emptyCurrent) override
void onInitComponent() override
Pure virtual hook for the subclass.
void abort(const ::Ice::Current &=Ice::emptyCurrent) override
void ice_postUnmarshal() override
NodeId addNodeToSecondaryTree(const ConfigType &cfg, const NodeId &parent)
void workerTask()
The worker task.
std::unique_ptr< CuboidSampler > sampler
Ice::Byte getSecondaryTreeId() const
std::deque< Update > localUpdates
Ice::Byte getPrimaryTreeId() const
TreeUpdateInterfacePrx globalWorkers
Update getUpdate(Ice::Long updateId, const Ice::Current &=Ice::emptyCurrent) const override
WorkerNodeBasePrxList workers
Tree & getSecondaryTree()
NodeId addNodeToPrimaryTree(const ConfigType &cfg, const NodeId &parent)
std::atomic_bool abortRequest
std::size_t getDimensionality()
std::atomic_bool doApplyUpdates
NodeId addNode(const ConfigType &cfg, const NodeId &parent, bool addToPrimaryTree)
void onConnectComponent() override
Pure virtual hook for the subclass.
Update getRemoteUpdate(Ice::Long workerNodeId, Ice::Long updateSubId)
void setWorkerNodes(const WorkerNodeBasePrxList &workers, const Ice::Current &=Ice::emptyCurrent) override
bool fromStartIsPrimaryTree
void onExitComponent() override
Hook for subclass.
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#define ARMARX_ERROR_S
The logging level for unexpected behaviour, that must be fixed.
ConfigType dcdSteer(const ConfigType &from, const ConfigType &to, RealType dcdStepSize, CollisionChecker isCollisionFree)
Tries to reach to from from using the given stepsize.
Sampler< UniformCuboidDistribution< float >, std::mt19937 > CuboidSampler