Go to the documentation of this file.
26 #include <unordered_map>
27 #include <condition_variable>
38 #include <RobotComponents/interface/components/MotionPlanning/MotionPlanningServer.h>
46 class MotionPlanningTask;
71 defineOptionalProperty<std::string>(
"RemoteObjectNodes",
"",
"CSV of RemoteObjectNode names");
72 defineOptionalProperty<bool>(
"LocalRONStart",
true,
"start a local remote object node if the CSV RemoteObjectNodes is empty");
73 defineOptionalProperty<float>(
"LocalRONCorePerc", 0.5,
"Local remote object node core count percentage. (has to be >0; 0.5 => 50%");
86 virtual public MotionPlanningServerInterface,
100 #pragma GCC diagnostic push
101 #pragma GCC diagnostic ignored "-Wterminate"
105 #pragma GCC diagnostic pop
115 return "MotionPlanningServer";
158 armarx::ClientSideRemoteHandleControlBlockBasePtr
enqueueTask(
const MotionPlanningTaskBasePtr& task,
const Ice::Current& = Ice::emptyCurrent)
override;
175 TaskInfoSeq
getAllTaskInfo(
const Ice::Current& = Ice::emptyCurrent)
const override;
179 bool loadLibFromPath(
const std::string& path,
const Ice::Current& = Ice::emptyCurrent)
override;
180 bool loadLibFromPackage(
const std::string& package,
const std::string& lib,
const Ice::Current& = Ice::emptyCurrent)
override;
231 using TaskMap = std::unordered_map<Ice::Long, TaskAndRemoteHandle>;
280 bool loadLibFromAbsolutePath(
const std::string& path);
std::atomic_bool dispatcherKillRequest
Whether the dispatcher should shut down.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onDisconnectComponent() override
noop
std::thread dispatcherThread
The dispatcher's thread.
std::shared_ptr< DynamicLibrary > DynamicLibraryPtr
std::condition_variable_any waitForTaskOrDispatcherKill
The dispatcher's cv.
std::vector< std::string > remoteObjectNodeNames
The used remote object nodes' names.
armarx::RemoteHandleControlBlockPtr rh
MotionPlanningServer()=default
ctor
TaskMap tasks
The map of tasks.
void onConnectComponent() override
Connects to the used RemoteObjectNodes.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
TaskAndRemoteHandle currentTask
currentTask stores a handle to the currently dispatched planning task.
CSpaceAndPaths getTaskCSpaceAndPathsById(Ice::Long id, const Ice::Current &=Ice::emptyCurrent) override
Returns a task's cspace and all found paths.
std::vector< armarx::RemoteObjectNodeInterfacePrx > remoteObjectNodes
The used remote object nodes.
bool loadLibFromPackage(const std::string &package, const std::string &lib, const Ice::Current &=Ice::emptyCurrent) override
Properties for a MotionPlanningServerComponent.
std::string getDefaultName() const override
Returns the server's default name.
void onInitComponent() override
Initializes the server and starts the dispatcher thread.
MotionPlanningServerPropertyDefinitions(std::string prefix)
ctor
float localNodePercent
Percentage of cores used by the local ron (if started).
void onExitComponent() override
cleans up and joins the dispatcher
Ice::Long getNumberOfQueuedTasks(const Ice::Current &) const override
Returns the number of queued tasks.
std::unordered_map< Ice::Long, TaskAndRemoteHandle > TaskMap
The type of the map of tasks.
TaskInfoSeq getAllTaskInfo(const Ice::Current &=Ice::emptyCurrent) const override
Returns information about all tasks.
RemoteObjectNodePtr localNode
armarx::ClientSideRemoteHandleControlBlockBasePtr enqueueTask(const MotionPlanningTaskBasePtr &task, const Ice::Current &=Ice::emptyCurrent) override
Enqueues a task.
ClientSideRemoteHandleControlBlockBasePtr getCurrentTaskHandle(const Ice::Current &) override
~MotionPlanningServer() override
dtor
Baseclass for all ArmarX ManagedIceObjects requiring properties.
bool startLocalNode
Whether a local node should be started, if no rons were provided.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
std::set< Ice::Long > taskQueue
Contains the queue of task ids to execute.
std::map< std::string, DynamicLibraryPtr > loadedLibs
bool loadLibFromPath(const std::string &path, const Ice::Current &=Ice::emptyCurrent) override
MotionPlanningTaskPtr task
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Ice::Long getNumberOfTasks(const Ice::Current &=Ice::emptyCurrent) const override
Returns the number of tasks.
Default component property definition container.
Ice::Long getNewTaskId()
Returns a new task id.
void dispatcherTask()
the dispatcher task.
std::atomic< Ice::Long > nextTaskId
the next task id.
SimoxCSpacePtr cacheCSpace
std::recursive_mutex queueMutex
mutex protecting the task queue
The DynamicLibrary class provides a mechanism to load libraries at runtime.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
This file offers overloads of toIce() and fromIce() functions for STL container types.
bool deleteTaskById(Ice::Long id)