-
Notifications
You must be signed in to change notification settings - Fork 676
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
feat(autoware_external_cmd_converter): add ext cmd converter tests #9118
feat(autoware_external_cmd_converter): add ext cmd converter tests #9118
Conversation
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9118 +/- ##
==========================================
+ Coverage 28.48% 28.59% +0.10%
==========================================
Files 1306 1307 +1
Lines 101074 101196 +122
Branches 39234 39333 +99
==========================================
+ Hits 28792 28934 +142
+ Misses 69339 69277 -62
- Partials 2943 2985 +42
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. |
std::shared_ptr<ExternalCmdConverterNode> external_cmd_converter_; | ||
}; | ||
|
||
TEST_F(TestExternalCmdConverter, testCheckEmergencyStopTimeout) |
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.
Would you show a brief description of each test case?
EXPECT_DOUBLE_EQ(0.0, test_get_shift_velocity_sign(cmd)); | ||
} | ||
|
||
TEST_F(TestExternalCmdConverter, testCalculateAcc) |
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.
Could you make test cases for boundary conditions? For example, a case with throttle = Inf (large number)
?
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.
@TakaHoribe thanks for your suggestions. I have added descriptions to the tests and functions used to evaluate. I also added combinations of std::numeric_limits::infinity() to the throttle and brake. Could you please check again?
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.
You only check if the output is positive/negative for infinite cases. Are you sure that those outputs are not nan nor other invalid numbers?
This PR looks ok if the above concern is solved.
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
771811c
to
f39fd7a
Compare
if ( | ||
std::isnan(desired_throttle) || std::isnan(desired_brake) || std::isinf(desired_throttle) || | ||
std::isinf(desired_brake)) { | ||
std::cerr << "Input brake or throttle is out of range. returning 0.0 acceleration." | ||
<< std::endl; | ||
return 0.0; | ||
} | ||
|
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.
if ( | |
std::isnan(desired_throttle) || std::isnan(desired_brake) || std::isinf(desired_throttle) || | |
std::isinf(desired_brake)) { | |
std::cerr << "Input brake or throttle is out of range. returning 0.0 acceleration." | |
<< std::endl; | |
return 0.0; | |
} | |
if ( | |
std::isnan(desired_throttle) || std::isnan(desired_brake) || std::isinf(desired_throttle) || | |
std::isinf(desired_brake)) { | |
std::cerr << "Input brake or throttle is out of range. returning 0.0 acceleration." | |
<< std::endl; | |
return 0.0; | |
} | |
@TakaHoribe I noticed there is no proper handling of Nan or infinite values in the external_cmd_converter so I decided to add this check, but I am wondering if returning 0 acceleration is the right answer in this case?
I have also made checks to combinations of infinity and nan inputs and checking the output to not be NaN or inf.
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.
LGTM. Thank you for your nice work!
26f617d
into
autowarefoundation:main
Description
Add tests to increase test coverage of external cmd converter
Related links
Parent Issue:
How was this PR tested?
Notes for reviewers
None.
Interface changes
None.
Effects on system behavior
None.