-
Notifications
You must be signed in to change notification settings - Fork 98
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
ParserConfig: save auto inertial values by default #1325
Conversation
Use CDATA block to hold --inertial-stats command string. Signed-off-by: Steve Peters <[email protected]>
Copy the inertial_stats.sdf file replace the user-defined inertial with //inertial/@auto=true and equivalent //collision/density values. Signed-off-by: Steve Peters <[email protected]>
Change default value of ConfigureResolveAutoInertials to SAVE_CALCULATION to match previous API behavior. Signed-off-by: Steve Peters <[email protected]>
Codecov Report
@@ Coverage Diff @@
## sdf14 #1325 +/- ##
==========================================
+ Coverage 87.47% 87.49% +0.01%
==========================================
Files 134 134
Lines 17751 17759 +8
==========================================
+ Hits 15528 15538 +10
+ Misses 2223 2221 -2
|
…not set Signed-off-by: Addisu Z. Taddese <[email protected]>
I added a test in c550e3d that fails because a MOI calculator callback is not set in if (!customCalculator)
{
_errors.push_back(
{sdf::ErrorCode::WARNING,
"Custom moment of inertia calculator for meshes not set via "
"sdf::ParserConfig::RegisterCustomInertiaCalc"});
return std::nullopt;
} but I got another error from Lines 277 to 282 in c550e3d
Do we want it to just use the default inertial if a callback is not set? |
I think we could use the default inertial with a warning that could be upgraded to an error with the right |
Warn and return default inertial values if custom inertia calculator is unset. Signed-off-by: Steve Peters <[email protected]>
updated in d6d8e7e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning the default Inertial instead of a nullopt makes more sense. Now, we only get the error from Mesh.cc
.
🦟 Bug fix
Follow-up to #1299 (comment)
Summary
While reviewing #1299, I suggested adding a parameter to
ParserConfig
so that inertial values could be computed by default, but the calculation could be skipped by setting the appropriate parameter before loading, which is needed bygz-sim
. At least, my intent was to point out that saving auto-inertial values should be the default, but I didn't articulate it explicitly, and the implementation skips by default instead.This changes the default configuration of
ParserConfig
to save auto inertial values instead of skipping. Without this changegz sdf --inertial-stats
doesn't resolve auto-inertial values (confirm by building ab438f3 and observing the failure ofUNIT_gz_TEST
).Minor changes:
test/sdf/inertial_stats.sdf
test/sdf/inertial_stats_auto.sdf
based ontest/sdf/inertial_stats.sdf
with//inertial/@auto=true
and//collision/density
values that yield equivalent inertial valuesChecklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.