-
Notifications
You must be signed in to change notification settings - Fork 531
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
Make planning pipeline respect the allowed_planning_time #2692
Open
TomCC7
wants to merge
10
commits into
moveit:main
Choose a base branch
from
TomCC7:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3930be6
Make planning pipeline respect the allowed_planning_time
TomCC7 e37e314
feat: timeout check set error_code instead of throw
TomCC7 69b6de8
feat: evenly distribute the planning time among remaining planners
TomCC7 06377f7
test: add timeout handling test for planningpipeline
TomCC7 167fb5e
chore, fix: formatting and minor fixes for planning pipeline timeout
TomCC7 99bf09c
fix spelling
TomCC7 cffe188
feat: allowing extra 10ms for response adapter
TomCC7 af3e30e
Merge branch 'main' into main
sjahr f903bd0
Merge branch 'main' into main
sjahr c2a5184
Merge branch 'main' into main
sjahr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
#include <gtest/gtest.h> | ||
|
||
#include <moveit/planning_pipeline/planning_pipeline.h> | ||
#include <moveit/utils/moveit_error_code.h> | ||
#include <moveit/utils/robot_model_test_utils.h> | ||
|
||
namespace | ||
|
@@ -92,6 +93,7 @@ TEST_F(TestPlanningPipeline, HappyPath) | |
// THEN A successful response is created | ||
planning_interface::MotionPlanResponse motion_plan_response; | ||
planning_interface::MotionPlanRequest motion_plan_request; | ||
motion_plan_request.allowed_planning_time = 10; | ||
const auto planning_scene_ptr = std::make_shared<planning_scene::PlanningScene>(robot_model_); | ||
EXPECT_TRUE(pipeline_ptr_->generatePlan(planning_scene_ptr, motion_plan_request, motion_plan_response)); | ||
EXPECT_TRUE(motion_plan_response.error_code); | ||
|
@@ -115,6 +117,32 @@ TEST_F(TestPlanningPipeline, NoPlannerPluginConfigured) | |
std::runtime_error); | ||
} | ||
|
||
TEST_F(TestPlanningPipeline, TestTimeout) | ||
TomCC7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
// construct pipeline | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. didn't know that checker also checks for spelling lol |
||
EXPECT_NO_THROW(pipeline_ptr_ = std::make_shared<planning_pipeline::PlanningPipeline>( | ||
robot_model_, node_, "", PLANNER_PLUGINS, REQUEST_ADAPTERS, RESPONSE_ADAPTERS)); | ||
|
||
planning_interface::MotionPlanResponse motion_plan_response; | ||
planning_interface::MotionPlanRequest motion_plan_request; | ||
const auto planning_scene_ptr = std::make_shared<planning_scene::PlanningScene>(robot_model_); | ||
TomCC7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// timeout by request adapter | ||
TomCC7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
motion_plan_request.allowed_planning_time = 0.1; | ||
EXPECT_FALSE(pipeline_ptr_->generatePlan(planning_scene_ptr, motion_plan_request, motion_plan_response)); | ||
EXPECT_EQ(motion_plan_response.error_code, moveit::core::MoveItErrorCode::TIMED_OUT); | ||
|
||
// timeout by planner | ||
motion_plan_request.allowed_planning_time = 1.0; | ||
EXPECT_FALSE(pipeline_ptr_->generatePlan(planning_scene_ptr, motion_plan_request, motion_plan_response)); | ||
EXPECT_EQ(motion_plan_response.error_code, moveit::core::MoveItErrorCode::TIMED_OUT); | ||
|
||
// timeout by response adapter | ||
motion_plan_request.allowed_planning_time = 2.3; | ||
EXPECT_FALSE(pipeline_ptr_->generatePlan(planning_scene_ptr, motion_plan_request, motion_plan_response)); | ||
EXPECT_EQ(motion_plan_response.error_code, moveit::core::MoveItErrorCode::TIMED_OUT); | ||
} | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
rclcpp::init(argc, argv); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Maybe I'm missing it, but it looks like we will hit a timeout here if the planners use up the allowed planning time. Optimizing planners usually do that, so I think we should either ignore response adapters or use a separate budget
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.
Yeah I think the ultimate solution to this is to give user more control over the timeout. Maybe let them decide timeout of each section (and each planner) separately? But that would require changing the
MotionPlanRequest
message so I'm not sure. What's your suggestion on this? Should we make the PR more complex or just ignore the response adapters for now?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.
Can we ensure for now that a fraction of the time will be reserved for the planners? Something like 100ms in any 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.
But in that case the planner might still use up all the reserved time. Or are you saying that giving the request adapter at least 100ms?
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.
the response adapter should have a reserved time budget which is deducted from the planner's allowed planning time.
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.
hi, I add an extra check to ensure that the response adapter has 10ms left in the latest commit