Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Parse ode_quiet physics parameter from SDFormat #3194

Merged
merged 2 commits into from
Mar 24, 2022

Conversation

scpeters
Copy link
Member

The ODE world-step solver has a tendency to spam the console with LCP Internal Error messages (try loading test/worlds/world_step.world with --verbose to see for yourself). We added an ode_quiet parameter to the SetParam and GetParam APIs for ODEPhysics in bitbucket pull request 2512 (merged in dacd915), but at that time it was only accessible from the C++ API.

I had thought that the gazebo::physics::PresetManager might be able to aid in parsing this parameter if it was added to a <physics> block, but when I tried that in e7ce527, it gives an error message:

[Err] [ODEPhysics.cc:1577] SetParam(ode_quiet) std::any_cast error: bad any cast
[Wrn] [PresetManager.cc:82] Couldn't set parameter [ode_quiet] in physics engine

I have now realized that this is because while SetParam tries to cast to a bool, libsdformat is treating its value as a string, which is the default behavior when parsing elements that are not part of the SDFormat spec. With this in mind, I've added logic in f75611d to try parsing the ode_quiet value as a string if it fails to cast to a bool, and then use an sdf::Param object to convert the string to a bool using code from libsdformat's Param_TEST.cc as an example.

This parameter should quiet the console spam of
"LCP Internal Error" messages caused by this solver.
Add test expectations to confirm that it is set.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Since the ode_quiet element is not part of the SDFormat
spec, it may be encoded as a string in the PresetManager.
So try parsing it as a string using an sdf::Param object.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Copy link

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scpeters the changes here look okay to me! Thanks for tracking this down 🙇🏼‍♂️

@scpeters scpeters merged commit 9747cc1 into gazebosim:gazebo11 Mar 24, 2022
@scpeters scpeters deleted the ode_quiet_string_cast branch March 24, 2022 07:28
scpeters added a commit to scpeters/dave that referenced this pull request Mar 24, 2022
Once gazebosim/gazebo-classic#3194 is released, this will silence the
LCP Internal Error console messages.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Yadunund pushed a commit to Field-Robotics-Lab/dave that referenced this pull request Mar 24, 2022
* Use world solver in ocean waves world

This reduces noise in the force-torque sensor readings.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>

* Add ode_quiet parameter to <physics/>

Once gazebosim/gazebo-classic#3194 is released, this will silence the
LCP Internal Error console messages.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants