Nav2 Navigation Stack - jazzy  jazzy
ROS 2 Navigation Stack
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mppi::NoiseGenerator Class Reference

Generates noise trajectories from optimal trajectory. More...

#include <nav2_mppi_controller/include/nav2_mppi_controller/tools/noise_generator.hpp>

Collaboration diagram for mppi::NoiseGenerator:
Collaboration graph
[legend]

Public Member 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. More...
 
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 More...
 
void reset (mppi::models::OptimizerSettings &settings, bool is_holonomic)
 Reset noise generator with settings and model types. More...
 

Protected Member Functions

void noiseThread ()
 Thread to execute noise generation process.
 
void generateNoisedControls ()
 Generate random controls by gaussian noise with mean in control_sequence_. More...
 

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}
 

Detailed Description

Generates noise trajectories from optimal trajectory.

Definition at line 44 of file noise_generator.hpp.

Member Function Documentation

◆ generateNoisedControls()

void mppi::NoiseGenerator::generateNoisedControls ( )
protected

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

Definition at line 107 of file noise_generator.cpp.

Referenced by initialize(), noiseThread(), and reset().

Here is the caller graph for this function:

◆ initialize()

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

Initialize noise generator with settings and model types.

Parameters
settingsSettings of controller
is_holonomicIf base is holonomic
nameNamespace for configs
param_handlerGet parameters util

Definition at line 26 of file noise_generator.cpp.

References generateNoisedControls(), mppi::ParametersHandler::getParamGetter(), and noiseThread().

Here is the call graph for this function:

◆ reset()

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

Reset noise generator with settings and model types.

Parameters
settingsSettings of controller
is_holonomicIf base is holonomic

Definition at line 76 of file noise_generator.cpp.

References generateNoisedControls().

Here is the call graph for this function:

◆ setNoisedControls()

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

set noised control_sequence to state controls

Returns
noises vx, vy, wz

Definition at line 65 of file noise_generator.cpp.


The documentation for this class was generated from the following files: