Skip to content

Commit

Permalink
25% speed up of goal critic; 1% speed up from vy striding when not in…
Browse files Browse the repository at this point in the history
… use
  • Loading branch information
SteveMacenski committed Sep 21, 2023
1 parent 91b688d commit 1b13476
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nav2_mppi_controller/src/critics/goal_critic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void GoalCritic::score(CriticData & data)
xt::pow(traj_x - goal_x, 2) +
xt::pow(traj_y - goal_y, 2));

data.costs += xt::pow(xt::mean(dists, {1}) * weight_, power_);
data.costs += xt::pow(xt::mean(dists, {1}, immediate) * weight_, power_);
}

} // namespace mppi::critics
Expand Down
4 changes: 3 additions & 1 deletion nav2_mppi_controller/src/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,10 @@ void Optimizer::updateControlSequence()
auto && softmaxes_extened = xt::eval(xt::view(softmaxes, xt::all(), xt::newaxis()));

xt::noalias(control_sequence_.vx) = xt::sum(state_.cvx * softmaxes_extened, 0, immediate);
xt::noalias(control_sequence_.vy) = xt::sum(state_.cvy * softmaxes_extened, 0, immediate);
xt::noalias(control_sequence_.wz) = xt::sum(state_.cwz * softmaxes_extened, 0, immediate);
if (isHolonomic()) {
xt::noalias(control_sequence_.vy) = xt::sum(state_.cvy * softmaxes_extened, 0, immediate);
}

applyControlSequenceConstraints();
}
Expand Down

0 comments on commit 1b13476

Please sign in to comment.