-
Notifications
You must be signed in to change notification settings - Fork 650
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(raw_vehicle_cmd_converter): validate map at first before run time #2152
feat(raw_vehicle_cmd_converter): validate map at first before run time #2152
Conversation
Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp>
Codecov ReportBase: 10.76% // Head: 10.82% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2152 +/- ##
==========================================
+ Coverage 10.76% 10.82% +0.05%
==========================================
Files 1186 1186
Lines 84826 84965 +139
Branches 19889 19978 +89
==========================================
+ Hits 9133 9195 +62
- Misses 66008 66041 +33
- Partials 9685 9729 +44
*This pull request uses carry forward flags. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp>
Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp>
} | ||
} | ||
} | ||
if (is_invalid) { |
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.
Note: add output where is invalid in map
0, 1.0, 11.0, 21.0 | ||
0.5, 2.0, 22.0, 42.0 | ||
1.0, 3.0, 33.0, 46.0 | ||
default,0.0, 5.0, 10.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.
Note: use more realistic params for test because it's hard to tell if case "calcThrottle" should use accel map or brake map for single unit test
const auto data_path = | ||
ament_index_cpp::get_package_share_directory("raw_vehicle_cmd_converter") + "/data/default/"; | ||
// for invalid path | ||
EXPECT_TRUE(accel_map.readAccelMapFromCSV(data_path + "accel_map.csv")); |
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.
Note: add test with existing accel / brake / steer map for unit test
@@ -100,10 +142,10 @@ std::vector<double> CSVLoader::getColumnIndex(const Table & table) | |||
double CSVLoader::clampValue( | |||
const double val, const std::vector<double> & ranges, const std::string & name) | |||
{ | |||
const double max_value = ranges.back(); | |||
const double min_value = ranges.front(); | |||
const double max_value = *std::max_element(ranges.begin(), ranges.end()); |
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.
Note: max = vec.back() min = vec.front() is common for current map format but I want this change for safe
min ----> max
min
|
max
@@ -148,25 +144,17 @@ double RawVehicleCommandConverterNode::calculateSteer( | |||
double dt = (current_time - prev_time_steer_calculation_).seconds(); | |||
if (std::abs(dt) > 1.0) { | |||
RCLCPP_WARN_EXPRESSION(get_logger(), is_debugging_, "ignore old topic"); | |||
dt = 0.0; | |||
dt = 0.1; // set ordinaray delta time instead |
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.
Note: add ordinary dt for delay case
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!
Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
This reverts commit 0350724.
autowarefoundation#2152) * feat(raw_vehicle_cmd_converter): validate map at first before run time Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> * chore: remove debug * fix: clamp method and add more unit tests Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> * feat: add more realistic params Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> * chore: revert to simple map Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * Revert "chore: revert to simple map" This reverts commit 0350724. Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
autowarefoundation#2152) * feat(raw_vehicle_cmd_converter): validate map at first before run time Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> * chore: remove debug * fix: clamp method and add more unit tests Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> * feat: add more realistic params Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> * chore: revert to simple map Signed-off-by: tanaka3 <ttatcoder@outlook.jp> * Revert "chore: revert to simple map" This reverts commit 0350724. Signed-off-by: taikitanaka3 <taiki.tanaka@tier4.jp> Signed-off-by: tanaka3 <ttatcoder@outlook.jp> Signed-off-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
Signed-off-by: taikitanaka3 taiki.tanaka@tier4.jp
resolve: #2151
Description
Related links
Tests performed
checked external cmd converter runs successful with psim
Notes for reviewers
see if unit tests are successful
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.