-
Couldn't load subscription status.
- Fork 1.6k
add open loop option for MPPI #5617
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
284fd95
add open loop option for MPPI
chanhhoang99 47d13ce
Change parameter description.
chanhhoang99 4f124d3
Storing last command velocity
chanhhoang99 e9094cc
trailing white space removal
chanhhoang99 5dfaa0b
code style fix
chanhhoang99 e15847d
fix code style divergence
chanhhoang99 b95acf3
update unit test open_loop option for optimizer
chanhhoang99 f368a56
fix ament uncrusify
chanhhoang99 ca66895
refactor
chanhhoang99 44aab33
fix build error
chanhhoang99 b176731
add unit test for initial last_command_vel value
chanhhoang99 7540843
code coverage fix
chanhhoang99 5193717
move open loop option to prepare() function
chanhhoang99 7309867
Refactor unit test for optimizer mppi open loop option
chanhhoang99 22182c5
fix unit test build fail
chanhhoang99 124b6e2
linitng
chanhhoang99 2a8b10f
fix build error
chanhhoang99 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -99,6 +99,7 @@ void Optimizer::getParams() | |||||||||
| getParam(s.sampling_std.vy, "vy_std", 0.2f); | ||||||||||
| getParam(s.sampling_std.wz, "wz_std", 0.4f); | ||||||||||
| getParam(s.retry_attempt_limit, "retry_attempt_limit", 1); | ||||||||||
| getParam(s.open_loop, "open_loop", false); | ||||||||||
|
|
||||||||||
| s.base_constraints.ax_max = fabs(s.base_constraints.ax_max); | ||||||||||
| if (s.base_constraints.ax_min > 0.0) { | ||||||||||
|
|
@@ -158,6 +159,10 @@ void Optimizer::reset(bool reset_dynamic_speed_limits) | |||||||||
| control_history_[2] = {0.0f, 0.0f, 0.0f}; | ||||||||||
| control_history_[3] = {0.0f, 0.0f, 0.0f}; | ||||||||||
|
|
||||||||||
| if (settings_.open_loop) { | ||||||||||
| last_command_vel_ = geometry_msgs::msg::Twist(); | ||||||||||
| } | ||||||||||
|
Comment on lines
+162
to
+164
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.
Suggested change
|
||||||||||
|
|
||||||||||
| if (reset_dynamic_speed_limits) { | ||||||||||
| settings_.constraints = settings_.base_constraints; | ||||||||||
| } | ||||||||||
|
|
@@ -213,6 +218,8 @@ std::tuple<geometry_msgs::msg::TwistStamped, Eigen::ArrayXXf> Optimizer::evalCon | |||||||||
| utils::savitskyGolayFilter(control_sequence_, control_history_, settings_); | ||||||||||
| auto control = getControlFromSequenceAsTwist(plan.header.stamp); | ||||||||||
|
|
||||||||||
| last_command_vel_ = control.twist; | ||||||||||
|
|
||||||||||
| if (settings_.shift_control_sequence) { | ||||||||||
| shiftControlSequence(); | ||||||||||
| } | ||||||||||
|
|
@@ -256,7 +263,7 @@ void Optimizer::prepare( | |||||||||
| nav2_core::GoalChecker * goal_checker) | ||||||||||
| { | ||||||||||
| state_.pose = robot_pose; | ||||||||||
| state_.speed = robot_speed; | ||||||||||
| state_.speed = settings_.open_loop ? last_command_vel_ : robot_speed; | ||||||||||
| state_.local_path_length = nav2_util::geometry_utils::calculate_path_length(plan); | ||||||||||
| path_ = utils::toTensor(plan); | ||||||||||
| costs_.setZero(); | ||||||||||
|
|
@@ -347,8 +354,7 @@ void Optimizer::updateStateVelocities( | |||||||||
| propagateStateVelocitiesFromInitials(state); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| void Optimizer::updateInitialStateVelocities( | ||||||||||
| models::State & state) const | ||||||||||
| void Optimizer::updateInitialStateVelocities(models::State & state) const | ||||||||||
| { | ||||||||||
| state.vx.col(0) = static_cast<float>(state.speed.linear.x); | ||||||||||
| state.wz.col(0) = static_cast<float>(state.speed.angular.z); | ||||||||||
|
|
||||||||||
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.