Skip to content

Commit

Permalink
Scale sampling noise by ranges of specific actuators.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 607546084
Change-Id: If98e506747af65cc1ac8b1c2b49b138e137efc19
  • Loading branch information
erez-tom authored and copybara-github committed Feb 16, 2024
1 parent f2aadb1 commit 2b39d36
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mjpc/planners/sampling/planner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,13 @@ void SamplingPlanner::AddNoiseToPolicy(int i) {
int shift = i * (model->nu * kMaxTrajectoryHorizon);

// sample noise
for (int k = 0; k < num_parameters; k++) {
noise[k + shift] = absl::Gaussian<double>(gen_, 0.0, noise_exploration);
for (int t = 0; t < num_spline_points; t++) {
for (int k = 0; k < model->nu; k++) {
double scale = 0.5 * (model->actuator_ctrlrange[2 * k + 1] -
model->actuator_ctrlrange[2 * k]);
noise[shift + t * model->nu + k] =
absl::Gaussian<double>(gen_, 0.0, scale * noise_exploration);
}
}

// add noise
Expand Down

0 comments on commit 2b39d36

Please sign in to comment.