Class NoiseGenerator

Class Documentation

class NoiseGenerator

Generates noise trajectories from optimal trajectory.

Public Functions

NoiseGenerator() = default

Constructor for mppi::NoiseGenerator.

void initialize(mppi::models::OptimizerSettings &settings, bool is_holonomic, const std::string &name, ParametersHandler *param_handler)

Initialize noise generator with settings and model types.

Parameters:
  • settings – Settings of controller

  • is_holonomic – If base is holonomic

  • name – Namespace for configs

  • param_handler – Get parameters util

void shutdown()

Shutdown noise generator thread.

void generateNextNoises()

Signal to the noise thread the controller is ready to generate a new noised control for the next iteration.

void setNoisedControls(models::State &state, const models::ControlSequence &control_sequence)

set noised control_sequence to state controls

Returns:

noises vx, vy, wz

void reset(mppi::models::OptimizerSettings &settings, bool is_holonomic)

Reset noise generator with settings and model types.

Parameters:
  • settings – Settings of controller

  • is_holonomic – If base is holonomic

Protected Functions

void noiseThread()

Thread to execute noise generation process.

void generateNoisedControls()

Generate random controls by gaussian noise with mean in control_sequence_.

Returns:

tensor of shape [ batch_size_, time_steps_, 2] where 2 stands for v, w

Protected Attributes

xt::xtensor<float, 2> noises_vx_
xt::xtensor<float, 2> noises_vy_
xt::xtensor<float, 2> noises_wz_
mppi::models::OptimizerSettings settings_
bool is_holonomic_
std::thread noise_thread_
std::condition_variable noise_cond_
std::mutex noise_lock_
bool active_ = {false}
bool ready_ = {false}
bool regenerate_noises_ = {false}