Skip to content
Snippets Groups Projects
Commit 29c96d57 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add flag to suppress warnings

parent 03dc11b0
No related branches found
No related tags found
1 merge request!271Feature: Object memory fetches robots on demand
......@@ -135,7 +135,11 @@ namespace armarx::armem::robot_state
}
std::optional<robot::RobotDescription>
RobotReader::queryDescription(const std::string& name, const armem::Time& timestamp)
RobotReader::queryDescription(
const std::string& name,
const armem::Time& timestamp,
bool warnings
)
{
const auto sanitizedTimestamp = timestamp.isValid() ? timestamp : Clock::Now();
......@@ -155,8 +159,11 @@ namespace armarx::armem::robot_state
if (not memoryReader)
{
ARMARX_WARNING << "Memory reader is null. Did you forget to call "
"RobotReader::connect() in onConnectComponent()?";
if (warnings)
{
ARMARX_WARNING << "Memory reader is null. Did you forget to call "
"RobotReader::connect() in onConnectComponent()?";
}
return std::nullopt;
}
......@@ -175,7 +182,10 @@ namespace armarx::armem::robot_state
}
catch (...)
{
ARMARX_WARNING << "query description failure" << GetHandledExceptionString();
if (warnings)
{
ARMARX_WARNING << "query description failure" << GetHandledExceptionString();
}
}
return std::nullopt;
......
......@@ -58,7 +58,8 @@ namespace armarx::armem::robot_state
const armem::Time& timestamp) override;
std::optional<robot::RobotDescription> queryDescription(const std::string& name,
const armem::Time& timestamp);
const armem::Time& timestamp,
bool warnings = true);
std::optional<robot::RobotState> queryState(const robot::RobotDescription& description,
const armem::Time& timestamp);
......
......@@ -61,21 +61,25 @@ namespace armarx::armem::robot_state
VirtualRobot::RobotPtr
VirtualRobotReader::getRobot(const std::string& name,
const armem::Time& timestamp,
const VirtualRobot::RobotIO::RobotDescription& loadMode)
const VirtualRobot::RobotIO::RobotDescription& loadMode,
bool warnings)
{
ARMARX_INFO << "Querying robot description for robot '" << name << "'";
const auto description = queryDescription(name, timestamp);
const auto description = queryDescription(name, timestamp, warnings);
if (not description)
{
ARMARX_WARNING << "The description of robot `" << name << "` is nota available!";
if (warnings)
{
ARMARX_WARNING << "The description of robot `" << name << "` is not a available!";
}
return nullptr;
}
const std::string xmlFilename =
ArmarXDataPath::resolvePath(description->xml.serialize().path);
ARMARX_INFO << "Loading (virtual) robot '" << description->name << "' from XML file '"
<< xmlFilename << "'";
<< xmlFilename << "'";
auto robot = VirtualRobot::RobotIO::loadRobot(xmlFilename, loadMode);
ARMARX_CHECK_NOT_NULL(robot) << "Could not load robot from file `" << xmlFilename << "`";
......
......@@ -53,7 +53,8 @@ namespace armarx::armem::robot_state
getRobot(const std::string& name,
const armem::Time& timestamp = armem::Time::Invalid(),
const VirtualRobot::RobotIO::RobotDescription& loadMode =
VirtualRobot::RobotIO::RobotDescription::eStructure);
VirtualRobot::RobotIO::RobotDescription::eStructure,
bool warnings = true);
[[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