26 #ifndef INDUSTRIAL_MOVEIT_STOMP_CORE_INCLUDE_STOMP_CORE_STOMP_H_ 27 #define INDUSTRIAL_MOVEIT_STOMP_CORE_INCLUDE_STOMP_CORE_STOMP_H_ 30 #include <stomp_core/utils.h> 55 bool solve(
const std::vector<double>& first,
const std::vector<double>& last,
56 Eigen::MatrixXd& parameters_optimized);
65 bool solve(
const Eigen::VectorXd& first,
const Eigen::VectorXd& last,
66 Eigen::MatrixXd& parameters_optimized);
74 bool solve(
const Eigen::MatrixXd& initial_parameters,
75 Eigen::MatrixXd& parameters_optimized);
std::shared_ptr< Task > TaskPtr
Eigen::MatrixXd finite_diff_matrix_A_padded_
The finite difference matrix including padding.
Eigen::MatrixXd control_cost_matrix_R_padded_
The control cost matrix including padding.
bool resetVariables()
Reset all internal variables.
int num_active_rollouts_
Number of active rollouts.
Stomp(const StompConfiguration &config, TaskPtr task)
Stomp Constructor.
std::atomic< bool > proceed_
Used to determine if the optimization has been cancelled.
bool runSingleIteration()
Run a single iteration of the stomp algorithm.
int num_timesteps_padded_
The number of timesteps to pad the optimization with: timesteps + 2*(FINITE_DIFF_RULE_LENGTH - 1) ...
bool cancel()
Cancel optimization in progress. (Thread-Safe) This method is thead-safe.
int start_index_padded_
The index corresponding to the start of the non-paded section in the padded arrays.
bool generateNoisyRollouts()
Generate a set of noisy rollouts.
StompConfiguration config_
Configuration parameters.
unsigned int current_iteration_
Current iteration for the optimization.
std::vector< Rollout > noisy_rollouts_
Holds the noisy rollouts.
void setConfig(const StompConfiguration &config)
Sets the configuration and resets all internal variables.
bool computeOptimizedCost()
Computes the optimized trajectory cost [Control Cost + State Cost] If the current cost is not less th...
TaskPtr task_
The task to be optimized.
bool computeRolloutsStateCosts()
Computes the cost at every timestep for each noisy rollout.
Eigen::VectorXd parameters_state_costs_
A vector [timesteps] of the parameters state costs.
bool computeRolloutsControlCosts()
Compute the control cost for each noisy rollout. This is the sum of the acceleration squared...
double parameters_total_cost_
Total cost of the optimized parameters.
Eigen::MatrixXd control_cost_matrix_R_
A matrix [timesteps][timesteps], Referred to as 'R = A x A_transpose' in the literature.
double current_lowest_cost_
Hold the lowest cost of the optimized parameters.
bool filterNoisyRollouts()
Applies the optimization task's filter methods to the noisy trajectories.
Eigen::MatrixXd inv_control_cost_matrix_R_
A matrix [timesteps][timesteps], R^-1 ' matrix.
bool computeProbabilities()
Computes the probability from the state cost at every timestep for each noisy rollout.
bool computeInitialTrajectory(const std::vector< double > &first, const std::vector< double > &last)
Computes an inital guess at a solution given a start and end state.
The data structure used to store STOMP configuration parameters.
bool solve(const std::vector< double > &first, const std::vector< double > &last, Eigen::MatrixXd ¶meters_optimized)
Find the optimal solution provided a start and end goal.
Eigen::MatrixXd parameters_optimized_
A matrix [dimensions][timesteps] of the optimized parameters.
bool parameters_valid_prev_
whether or not the optimized parameters from the previous iteration are valid
This defines the stomp task.
bool clear()
Resets all internal variables.
bool updateParameters()
Computes update from probabilities using convex combination.
bool computeNoisyRolloutsCosts()
Computes the total cost for each of the noisy rollouts.
bool parameters_valid_
whether or not the optimized parameters are valid
Eigen::MatrixXd parameters_control_costs_
A matrix [dimensions][timesteps] of the parameters control costs.
Eigen::MatrixXd parameters_updates_
A matrix [dimensions][timesteps] of the parameter updates.
std::vector< Rollout > reused_rollouts_
Used for reordering arrays based on cost.