Skip to content
Snippets Groups Projects
Commit 9bd03706 authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Add...

Add RobotUnitModules::ControllerManagement::deactivateAndDeleteNJointController (and memberversions for NJointController)
parent c394fda5
No related branches found
No related tags found
No related merge requests found
......@@ -138,6 +138,10 @@ namespace armarx
{
robotUnit.deleteNJointController(this);
}
void NJointController::deactivateAndDeleteController(const Ice::Current&)
{
robotUnit.deactivateAndDeleteNJointController(this);
}
void NJointController::publish(const SensorAndControl& sac, const DebugDrawerInterfacePrx& draw, const DebugObserverInterfacePrx& observer)
{
......
......@@ -249,6 +249,7 @@ namespace armarx
void activateController(const Ice::Current& = GlobalIceCurrent) final override;
void deactivateController(const Ice::Current& = GlobalIceCurrent) final override;
void deleteController(const Ice::Current& = GlobalIceCurrent) final override;
void deactivateAndDeleteController(const Ice::Current& = GlobalIceCurrent) final override;
WidgetDescription::StringWidgetDictionary getFunctionDescriptions(const Ice::Current& = GlobalIceCurrent) const override;
void callDescribedFunction(const std::string&, const StringVariantBaseMap&, const Ice::Current& = GlobalIceCurrent) override;
......
......@@ -440,9 +440,46 @@ namespace armarx
}
}
void ControllerManagement::deactivateAndDeleteNJointController(const std::string &name, const Ice::Current &)
{
deactivateAndDeleteNJointControllers(getNJointControllersNotNull({name}));
}
void ControllerManagement::deactivateAndDeleteNJointControllers(const Ice::StringSeq &names, const Ice::Current &)
{
deactivateAndDeleteNJointControllers(getNJointControllersNotNull(names));
}
void ControllerManagement::deactivateAndDeleteNJointController(const NJointControllerPtr &ctrl)
{
deactivateAndDeleteNJointControllers({ctrl});
}
void ControllerManagement::deactivateAndDeleteNJointControllers(const std::vector<NJointControllerPtr>& ctrlsToDelVec)
{
auto guard = getGuard();
throwIfDevicesNotReady(__FUNCTION__);
if (ctrlsToDelVec.empty())
{
return;
}
deactivateNJointControllers(ctrlsToDelVec);
while(
std::any_of(
ctrlsToDelVec.begin(),
ctrlsToDelVec.end(),
[](const NJointControllerPtr& ctrl) {return ctrl->isControllerActive();}
)
)
{
if(isShuttingDown())
{
return;
}
std::this_thread::sleep_for(std::chrono::microseconds{100});
}
deleteNJointControllers(ctrlsToDelVec);
}
NJointControllerClassDescription ControllerManagement::getNJointControllerClassDescription(
const std::string& className, const Ice::Current&) const
const std::string& className, const Ice::Current&) const
{
while (getRobotUnitState() == RobotUnitState::InitializingComponent || getRobotUnitState() == RobotUnitState::InitializingDevices)
{
......
......@@ -209,6 +209,26 @@ namespace armarx
* @see deleteNJointController
*/
void deleteNJointControllers(const Ice::StringSeq& names, const Ice::Current&) override;
/**
* @brief Queues the given \ref NJointController for deletion and deactivates it if necessary.
* @param name The \ref NJointController to delete.
* @see removeNJointControllersToBeDeleted
* @see nJointControllersToBeDeleted
* @see deleteNJointController
* @see deleteNJointControllers
* @see deactivateAnddeleteNJointControllers
*/
void deactivateAndDeleteNJointController(const std::string& name, const Ice::Current&) override;
/**
* @brief Queues the given \ref NJointController "NJointControllers" for deletion and deactivates them if necessary.
* @param names The \ref NJointController "NJointControllers" to delete.
* @see removeNJointControllersToBeDeleted
* @see nJointControllersToBeDeleted
* @see deleteNJointController
* @see deleteNJointControllers
* @see deactivateAnddeleteNJointController
*/
void deactivateAndDeleteNJointControllers(const Ice::StringSeq& names, const Ice::Current&) override;
/**
* @brief Requests activation for the given \ref NJointController.
......@@ -317,6 +337,27 @@ namespace armarx
* @see deleteNJointController
*/
void deleteNJointControllers(const std::vector<NJointControllerPtr>& ctrls);
/**
* @brief Queues the given \ref NJointController for deletion and deactivates it if necessary.
* @param ctrl The \ref NJointController to delete.
* @see removeNJointControllersToBeDeleted
* @see nJointControllersToBeDeleted
* @see deleteNJointController
* @see deleteNJointControllers
* @see deactivateAnddeleteNJointControllers
*/
void deactivateAndDeleteNJointController(const NJointControllerPtr& ctrl);
/**
* @brief Queues the given \ref NJointController "NJointControllers" for deletion and deactivates them if necessary.
* @param ctrls The \ref NJointController "NJointControllers" to delete.
* @see removeNJointControllersToBeDeleted
* @see nJointControllersToBeDeleted
* @see deleteNJointController
* @see deleteNJointControllers
* @see deactivateAnddeleteNJointController
*/
void deactivateAndDeleteNJointControllers(const std::vector<NJointControllerPtr>& ctrls);
/**
* @brief Requests activation for the given \ref NJointController.
......
......@@ -88,6 +88,7 @@ module armarx
void activateController();
void deactivateController();
void deleteController() throws LogicError;
void deactivateAndDeleteController() throws LogicError;
["cpp:const"] idempotent WidgetDescription::StringWidgetDictionary getFunctionDescriptions();
void callDescribedFunction(string fuinctionName, StringVariantBaseMap values) throws InvalidArgumentException;
......
......@@ -200,6 +200,9 @@ module armarx
void deleteNJointController(string controllerInstanceName)throws InvalidArgumentException, LogicError;
void deleteNJointControllers(Ice::StringSeq controllerInstanceNames)throws InvalidArgumentException, LogicError;
void deactivateAndDeleteNJointController(string controllerInstanceName)throws InvalidArgumentException, LogicError;
void deactivateAndDeleteNJointControllers(Ice::StringSeq controllerInstanceNames)throws InvalidArgumentException, LogicError;
//loading libs
bool loadLibFromPath(string path);
bool loadLibFromPackage(string package, string libname);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment