Skip to content
Snippets Groups Projects
Commit 5be6b7fd authored by Robin Müller's avatar Robin Müller
Browse files

Merge branch 'master' into feature/MongoDB

parents 70ed32b5 330ac3f5
No related branches found
No related tags found
1 merge request!464Draft: Feature/mongo db
Pipeline #21096 failed
......@@ -381,7 +381,7 @@ namespace armarx
if (!fs::is_regular_file(simoxXML().absolutePath))
{
if (_logError)
if (false and _logError )
{
ARMARX_WARNING << "Expected simox object file for object " << *this << ": "
<< simoxXML().absolutePath;
......
......@@ -24,8 +24,7 @@ namespace armarx::armem::robot_state
if (not robotState)
{
ARMARX_VERBOSE << deactivateSpam(5) << "Querying robot state failed for robot `"
<< robot.getName() << "` "
<< "(type `" << robot.getType() << "`)!";
<< robot.getName() << "` " << "(type `" << robot.getType() << "`)!";
return false;
}
......@@ -43,8 +42,7 @@ namespace armarx::armem::robot_state
if (not robotState)
{
ARMARX_VERBOSE << deactivateSpam(5) << "Querying robot state failed for robot `"
<< robot.getName() << "` "
<< "(type `" << robot.getType() << "`)!";
<< robot.getName() << "` " << "(type `" << robot.getType() << "`)!";
return false;
}
......@@ -84,6 +82,32 @@ namespace armarx::armem::robot_state
return robot;
}
VirtualRobot::RobotPtr
VirtualRobotReader::getRobotWaiting(const std::string& name,
const armem::Time& timestamp,
const VirtualRobot::RobotIO::RobotDescription& loadMode)
{
ARMARX_INFO << "Trying to get robot `" << name << "` ...";
VirtualRobot::RobotPtr robot = nullptr;
while (robot == nullptr)
{
// might be nullptr if query fails
robot = getRobot(name, timestamp, loadMode);
if (robot == nullptr)
{
ARMARX_INFO << deactivateSpam(1) << "Failed to query robot `" << name
<< "`. Will try again ...";
}
Clock::WaitFor(Duration::MilliSeconds(200));
}
ARMARX_INFO << "Got robot `" << name << "`.";
return robot;
}
VirtualRobot::RobotPtr
VirtualRobotReader::getSynchronizedRobot(const std::string& name,
const VirtualRobot::BaseIO::RobotDescription& loadMode,
......@@ -128,4 +152,4 @@ namespace armarx::armem::robot_state
}
} // namespace armarx::armem::robot_state::client::common
} // namespace armarx::armem::robot_state
......@@ -69,6 +69,15 @@ namespace armarx::armem::robot_state
VirtualRobot::RobotIO::RobotDescription::eStructure,
bool blocking = true);
/**
@brief In contrast to getRobot(), this function will retry to query the robot until it exists.
*/
[[nodiscard]] VirtualRobot::RobotPtr
getRobotWaiting(const std::string& name,
const armem::Time& timestamp = armem::Time::Invalid(),
const VirtualRobot::RobotIO::RobotDescription& loadMode =
VirtualRobot::RobotIO::RobotDescription::eStructure);
private:
[[nodiscard]] VirtualRobot::RobotPtr
_getSynchronizedRobot(const std::string& name,
......
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