Skip to content

Commit 2b39d36

Browse files
erez-tomcopybara-github
authored andcommitted
Scale sampling noise by ranges of specific actuators.
PiperOrigin-RevId: 607546084 Change-Id: If98e506747af65cc1ac8b1c2b49b138e137efc19
1 parent f2aadb1 commit 2b39d36

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mjpc/planners/sampling/planner.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,13 @@ void SamplingPlanner::AddNoiseToPolicy(int i) {
267267
int shift = i * (model->nu * kMaxTrajectoryHorizon);
268268

269269
// sample noise
270-
for (int k = 0; k < num_parameters; k++) {
271-
noise[k + shift] = absl::Gaussian<double>(gen_, 0.0, noise_exploration);
270+
for (int t = 0; t < num_spline_points; t++) {
271+
for (int k = 0; k < model->nu; k++) {
272+
double scale = 0.5 * (model->actuator_ctrlrange[2 * k + 1] -
273+
model->actuator_ctrlrange[2 * k]);
274+
noise[shift + t * model->nu + k] =
275+
absl::Gaussian<double>(gen_, 0.0, scale * noise_exploration);
276+
}
272277
}
273278

274279
// add noise

0 commit comments

Comments
 (0)