Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the parameters handler verbosity #330

Merged
merged 4 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ All notable changes to this project are documented in this file.
- Use `TextLogging` in `VariablesHandler` class (https://github.com/dic-iit/bipedal-locomotion-framework/pull/291)
- Fix `YarpImplementation::setParameterPrivate()` when a boolean or a vector of boolean is passed (https://github.com/dic-iit/bipedal-locomotion-framework/pull/311)
- Add `foot_take_off_acceleration` and `foot_take_off_velocity` parameters in the `SwingFootPlanner` class (https://github.com/dic-iit/bipedal-locomotion-framework/issues/323)
- Change the parameters handler verbosity (https://github.com/dic-iit/bipedal-locomotion-framework/pull/330)

### Fixed
- Fix missing implementation of `YarpSensorBridge::getFailedSensorReads()`. (https://github.com/dic-iit/bipedal-locomotion-framework/pull/202)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ bool YarpImplementation::setGroup(const std::string& name, IParametersHandler::s
// m_container
if (downcastedPtr == nullptr)
{
log()->error("[YarpImplementation::setGroup] Unable to downcast the pointer to "
log()->debug("[YarpImplementation::setGroup] Unable to downcast the pointer to "
"YarpImplementation.");

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bool StdImplementation::getParameterPrivate(const std::string& parameterName, T&
auto parameterAny = m_map.find(parameterName);
if (parameterAny == m_map.end())
{
log()->error("{} Parameter named '{}' not found.", logPrefix, parameterName);
log()->debug("{} Parameter named '{}' not found.", logPrefix, parameterName);
return false;
}

Expand All @@ -37,7 +37,7 @@ bool StdImplementation::getParameterPrivate(const std::string& parameterName, T&
parameter = std::any_cast<T>(parameterAny->second);
} catch (const std::bad_any_cast& exception)
{
log()->error("{} The type of the parameter named '{}' is different from the one "
log()->debug("{} The type of the parameter named '{}' is different from the one "
"expected.",
logPrefix,
parameterName);
Expand All @@ -52,7 +52,7 @@ bool StdImplementation::getParameterPrivate(const std::string& parameterName, T&
castedParameter = std::any_cast<std::vector<elementType>>(parameterAny->second);
} catch (const std::bad_any_cast& exception)
{
log()->error("{} The type of the parameter named {} is different from the one "
log()->debug("{} The type of the parameter named {} is different from the one "
"expected.",
logPrefix,
parameterName);
Expand All @@ -67,7 +67,7 @@ bool StdImplementation::getParameterPrivate(const std::string& parameterName, T&
{
if (!parameter.resizeVector(castedParameter.size()))
{
log()->error("{} Unable to resize {} List size: {}. Vector size: {}.",
log()->debug("{} Unable to resize {} List size: {}. Vector size: {}.",
logPrefix,
type_name<T>(),
castedParameter.size(),
Expand All @@ -79,7 +79,7 @@ bool StdImplementation::getParameterPrivate(const std::string& parameterName, T&
parameter.resize(castedParameter.size());
else
{
log()->error("{} The size of the vector does not match with the size of the list. "
log()->debug("{} The size of the vector does not match with the size of the list. "
"List size: {}. Vector size: {}.",
logPrefix,
castedParameter.size(),
Expand Down
2 changes: 1 addition & 1 deletion src/ParametersHandler/src/StdImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool StdImplementation::setGroup(const std::string& name, IParametersHandler::sh
auto downcastedPtr = std::dynamic_pointer_cast<StdImplementation>(newGroup);
if (downcastedPtr == nullptr)
{
BipedalLocomotion::log()->error("[StdImplementation::setGroup] Unable to downcast the "
BipedalLocomotion::log()->debug("[StdImplementation::setGroup] Unable to downcast the "
"pointer to StdImplementation.");
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ bool getElementFromSearchable(const yarp::os::Searchable& config,
yarp::os::Value* value;
if (!config.check(key, value))
{
log()->error("{} Missing field named: {}.", logPrefix, key);
log()->debug("{} Missing field named: {}.", logPrefix, key);
return false;
}

if (!(value->*YARP_UTILITES_GET_CHECKER_NAME(T))())
{
log()->error("{} The value named: {} is not a {}.",
log()->debug("{} The value named: {} is not a {}.",
logPrefix,
key,
YARP_UTILITES_GET_ELEMENT_TYPE(T));
Expand All @@ -104,26 +104,26 @@ bool getVectorFromSearchable(const yarp::os::Searchable& config, const std::stri
yarp::os::Value* value;
if (!config.check(key, value))
{
log()->error("{} Missing field named: {}.", logPrefix, key);
log()->debug("{} Missing field named: {}.", logPrefix, key);
return false;
}

if (value->isNull())
{
log()->error("{} Empty input named: {}.", logPrefix, key);
log()->debug("{} Empty input named: {}.", logPrefix, key);
return false;
}

if (!value->isList())
{
log()->error("{} The value named: {} is not associated to a list.", logPrefix, key);
log()->debug("{} The value named: {} is not associated to a list.", logPrefix, key);
return false;
}

yarp::os::Bottle* inputPtr = value->asList();
if (inputPtr == nullptr)
{
log()->error("{} The list associated to the value named: {} is empty.", logPrefix, key);
log()->debug("{} The list associated to the value named: {} is empty.", logPrefix, key);
return false;
}

Expand All @@ -135,7 +135,7 @@ bool getVectorFromSearchable(const yarp::os::Searchable& config, const std::stri
{
if (!vector.resizeVector(inputPtr->size()))
{
log()->error("{} Unable to resize {}, List size: {}. Vector size: {}.",
log()->debug("{} Unable to resize {}, List size: {}. Vector size: {}.",
logPrefix,
type_name<T>(),
inputPtr->size(),
Expand All @@ -147,7 +147,7 @@ bool getVectorFromSearchable(const yarp::os::Searchable& config, const std::stri
vector.resize(inputPtr->size());
else
{
log()->error("{} The size of the vector does not match with the size of the list. List "
log()->debug("{} The size of the vector does not match with the size of the list. List "
"size {}. Vector size {}.",
logPrefix,
inputPtr->size(),
Expand All @@ -160,7 +160,7 @@ bool getVectorFromSearchable(const yarp::os::Searchable& config, const std::stri
{
if (!(inputPtr->get(i).*YARP_UTILITES_GET_CHECKER_NAME(elementType))())
{
log()->error("{} The element of the list associated to the value named {} is not a {}.",
log()->debug("{} The element of the list associated to the value named {} is not a {}.",
logPrefix,
key,
YARP_UTILITES_GET_ELEMENT_TYPE(elementType));
Expand Down
10 changes: 5 additions & 5 deletions src/YarpUtilities/src/Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,26 @@ bool YarpUtilities::getVectorFromSearchable<std::vector<bool>>(const yarp::os::S
yarp::os::Value* value;
if (!config.check(key, value))
{
log()->error("{} Missing field {}.", logPrefix, key);
log()->debug("{} Missing field {}.", logPrefix, key);
return false;
}

if (value->isNull())
{
log()->error("{} Empty input value named: {}.", logPrefix, key);
log()->debug("{} Empty input value named: {}.", logPrefix, key);
return false;
}

if (!value->isList())
{
log()->error("{} The value named: {} is not associated to a list.", logPrefix, key);
log()->debug("{} The value named: {} is not associated to a list.", logPrefix, key);
return false;
}

yarp::os::Bottle* inputPtr = value->asList();
if (inputPtr == nullptr)
{
log()->error("{} The list associated to the value named: {} is empty.", logPrefix, key);
log()->debug("{} The list associated to the value named: {} is empty.", logPrefix, key);
return false;
}

Expand All @@ -96,7 +96,7 @@ bool YarpUtilities::getVectorFromSearchable<std::vector<bool>>(const yarp::os::S
{
if (!inputPtr->get(i).isBool())
{
log()->error("{} The element of the list associated to the value named {} is not a "
log()->debug("{} The element of the list associated to the value named {} is not a "
"Boolean.",
logPrefix,
key);
Expand Down