-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added support for MPPI Controller to adjust wz_std parameter based on linear speed #5294
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
5ea8873
1332a38
3d042fe
aaeb627
64b810d
b9691c5
74dc704
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,8 @@ | |
getParam(s.sampling_std.vx, "vx_std", 0.2f); | ||
getParam(s.sampling_std.vy, "vy_std", 0.2f); | ||
getParam(s.sampling_std.wz, "wz_std", 0.4f); | ||
getParam(s.advanced_constraints.wz_std_decay_to, "advanced.wz_std_decay_to", 0.0f); | ||
getParam(s.advanced_constraints.wz_std_decay_strength, "advanced.wz_std_decay_strength", -1.0f); | ||
getParam(s.retry_attempt_limit, "retry_attempt_limit", 1); | ||
|
||
s.base_constraints.ax_max = fabs(s.base_constraints.ax_max); | ||
|
@@ -132,9 +134,16 @@ | |
} | ||
} | ||
|
||
void Optimizer::resetAdaptiveStds() | ||
|
||
{ | ||
// reset initial adaptive value to parameterized value | ||
*settings_.sampling_std.wz_std_adaptive = settings_.sampling_std.wz; | ||
} | ||
|
||
void Optimizer::reset(bool reset_dynamic_speed_limits) | ||
{ | ||
state_.reset(settings_.batch_size, settings_.time_steps); | ||
resetAdaptiveStds(); | ||
vahapt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
control_sequence_.reset(settings_.time_steps); | ||
control_history_[0] = {0.0f, 0.0f, 0.0f}; | ||
control_history_[1] = {0.0f, 0.0f, 0.0f}; | ||
|
@@ -151,6 +160,13 @@ | |
noise_generator_.reset(settings_, isHolonomic()); | ||
motion_model_->initialize(settings_.constraints, settings_.model_dt); | ||
|
||
// Validate decay function, print warning message if decay_to is out of bounds | ||
try { | ||
settings_.sampling_std.validateConstraints(settings_.advanced_constraints, false); | ||
} catch (const std::runtime_error & e) { | ||
RCLCPP_WARN_STREAM(logger_, e.what()); | ||
vahapt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
|
||
RCLCPP_INFO(logger_, "Optimizer reset"); | ||
} | ||
|
||
|
@@ -439,6 +455,7 @@ | |
return control_sequence_; | ||
} | ||
|
||
|
||
vahapt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
void Optimizer::updateControlSequence() | ||
{ | ||
const bool is_holo = isHolonomic(); | ||
|
@@ -449,10 +466,11 @@ | |
const float gamma_vx = s.gamma / (s.sampling_std.vx * s.sampling_std.vx); | ||
costs_ += (gamma_vx * (bounded_noises_vx.rowwise() * vx_T).rowwise().sum()).eval(); | ||
|
||
if (s.sampling_std.wz > 0.0f) { | ||
const float & wz_std_adaptive = *s.sampling_std.wz_std_adaptive; | ||
if (wz_std_adaptive > 0.0f) { | ||
auto wz_T = control_sequence_.wz.transpose(); | ||
auto bounded_noises_wz = state_.cwz.rowwise() - wz_T; | ||
const float gamma_wz = s.gamma / (s.sampling_std.wz * s.sampling_std.wz); | ||
const float gamma_wz = s.gamma / (wz_std_adaptive * wz_std_adaptive); | ||
costs_ += (gamma_wz * (bounded_noises_wz.rowwise() * wz_T).rowwise().sum()).eval(); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,7 +331,7 @@ TEST(CriticTests, PathAngleCritic) | |
costmap_ros->on_configure(lstate); | ||
|
||
models::State state; | ||
state.reset(1000, 30); | ||
state.reset(1000, 30); | ||
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. This'll cause linting issues |
||
models::ControlSequence control_sequence; | ||
models::Trajectories generated_trajectories; | ||
generated_trajectories.reset(1000, 30); | ||
|
Uh oh!
There was an error while loading. Please reload this page.