Skip to content
Snippets Groups Projects
Commit 930d158f authored by Fabian Reister's avatar Fabian Reister
Browse files

termination condition + doxy comment

parent af677eba
No related branches found
No related tags found
No related merge requests found
......@@ -137,11 +137,11 @@ namespace armarx
return *plugin;
}
void RobotUnitComponentPluginUser::waitUntilRobotUnitIsRunning() const
void RobotUnitComponentPluginUser::waitUntilRobotUnitIsRunning(const std::function<bool()>& termCond) const
{
ARMARX_INFO << "Waiting until robot unit is running ...";
while ((isNullptr(getRobotUnit()) or (not getRobotUnit()->isRunning())))
while ((not termCond()) and ((isNullptr(getRobotUnit()) or (not getRobotUnit()->isRunning()))))
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
......
......@@ -80,7 +80,17 @@ namespace armarx
RobotUnitComponentPluginUser();
RobotUnitInterfacePrx getRobotUnit() const;
void waitUntilRobotUnitIsRunning() const;
/**
* @brief Waits until the robot unit is running.
*
* Although the robot unit proxy might be initialized (\see getRobotUnit()), the robot unit might
* not be fully initialized.
*
* @param termCond Termination condition. If it evaluates to true, waitUntilRobotUnitIsRunning returns without waiting
* for the robot unit to become available.
*/
void waitUntilRobotUnitIsRunning(const std::function<bool()>& termCond = [] {return false;}) const;
plugins::RobotUnitComponentPlugin& getRobotUnitComponentPlugin();
private:
......
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