stomp_optimization_task.h
Go to the documentation of this file.
1 
26 #ifndef INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_STOMP_OPTIMIZATION_TASK_H_
27 #define INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_STOMP_OPTIMIZATION_TASK_H_
28 
29 #include <memory>
30 #include <moveit_msgs/MotionPlanRequest.h>
32 #include <stomp_core/task.h>
34 #include <XmlRpcValue.h>
35 #include <pluginlib/class_loader.h>
39 
40 
41 namespace stomp_moveit
42 {
43 
45 typedef std::shared_ptr<CostFunctionLoader> CostFuctionLoaderPtr;
47 typedef std::shared_ptr<NoisyFilterLoader> NoisyFilterLoaderPtr;
49 typedef std::shared_ptr<UpdateFilterLoader> UpdateFilterLoaderPtr;
51 typedef std::shared_ptr<NoiseGeneratorLoader> NoiseGeneratorLoaderPtr;
52 
53 
63 {
64 public:
71  StompOptimizationTask(moveit::core::RobotModelConstPtr robot_model_ptr, std::string group_name,
72  const XmlRpc::XmlRpcValue& config);
73  virtual ~StompOptimizationTask();
74 
83  virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr& planning_scene,
84  const moveit_msgs::MotionPlanRequest &req,
85  const stomp_core::StompConfiguration &config,
86  moveit_msgs::MoveItErrorCodes& error_code);
87 
99  virtual bool generateNoisyParameters(const Eigen::MatrixXd& parameters,
100  std::size_t start_timestep,
101  std::size_t num_timesteps,
102  int iteration_number,
103  int rollout_number,
104  Eigen::MatrixXd& parameters_noise,
105  Eigen::MatrixXd& noise) override;
106 
118  virtual bool computeNoisyCosts(const Eigen::MatrixXd& parameters,
119  std::size_t start_timestep,
120  std::size_t num_timesteps,
121  int iteration_number,
122  int rollout_number,
123  Eigen::VectorXd& costs,
124  bool& validity) override;
125 
136  virtual bool computeCosts(const Eigen::MatrixXd& parameters,
137  std::size_t start_timestep,
138  std::size_t num_timesteps,
139  int iteration_number,
140  Eigen::VectorXd& costs,
141  bool& validity) override;
142 
155  virtual bool filterNoisyParameters(std::size_t start_timestep,
156  std::size_t num_timesteps,
157  int iteration_number,
158  int rollout_number,
159  Eigen::MatrixXd& parameters,
160  bool& filtered) override;
161 
173  virtual bool filterParameterUpdates(std::size_t start_timestep,
174  std::size_t num_timesteps,
175  int iteration_number,
176  const Eigen::MatrixXd& parameters,
177  Eigen::MatrixXd& updates) override;
178 
187  virtual void postIteration(std::size_t start_timestep,
188  std::size_t num_timesteps,int iteration_number,double cost,const Eigen::MatrixXd& parameters);
189 
198  virtual void done(bool success,int total_iterations,double final_cost,const Eigen::MatrixXd& parameters) override;
199 
200 protected:
201 
202  // robot environment
203  std::string group_name_;
204  moveit::core::RobotModelConstPtr robot_model_ptr_;
205  planning_scene::PlanningSceneConstPtr planning_scene_ptr_;
206 
208  CostFuctionLoaderPtr cost_function_loader_;
209  NoisyFilterLoaderPtr noisy_filter_loader_;
210  UpdateFilterLoaderPtr update_filter_loader_;
211  NoiseGeneratorLoaderPtr noise_generator_loader_;
212 
214  std::vector<cost_functions::StompCostFunctionPtr> cost_functions_;
215  std::vector<noisy_filters::StompNoisyFilterPtr> noisy_filters_;
216  std::vector<update_filters::StompUpdateFilterPtr> update_filters_;
217  std::vector<noise_generators::StompNoiseGeneratorPtr> noise_generators_;
218 };
219 
220 
221 } /* namespace stomp_moveit */
222 
223 #endif /* INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_STOMP_OPTIMIZATION_TASK_H_ */
virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr &planning_scene, const moveit_msgs::MotionPlanRequest &req, const stomp_core::StompConfiguration &config, moveit_msgs::MoveItErrorCodes &error_code)
Passes the planning details down to each loaded plugin.
This is the base class for all stomp noisy generators.
StompOptimizationTask(moveit::core::RobotModelConstPtr robot_model_ptr, std::string group_name, const XmlRpc::XmlRpcValue &config)
Constructor.
virtual bool filterNoisyParameters(std::size_t start_timestep, std::size_t num_timesteps, int iteration_number, int rollout_number, Eigen::MatrixXd &parameters, bool &filtered) override
Filters the given noisy parameters which is applied after noisy trajectory generation. It could be used for clipping of joint limits or projecting into the null space of the Jacobian. It accomplishes this by calling the loaded Noisy Filter plugins.
virtual bool computeCosts(const Eigen::MatrixXd &parameters, std::size_t start_timestep, std::size_t num_timesteps, int iteration_number, Eigen::VectorXd &costs, bool &validity) override
computes the state costs as a function of the optimized parameters for each time step. It does this by calling the loaded Cost Function plugins
This is the base class for all stomp filters.
virtual bool computeNoisyCosts(const Eigen::MatrixXd &parameters, std::size_t start_timestep, std::size_t num_timesteps, int iteration_number, int rollout_number, Eigen::VectorXd &costs, bool &validity) override
computes the state costs as a function of the noisy parameters for each time step. It does this by calling the loaded Cost Function plugins
planning_scene::PlanningSceneConstPtr planning_scene_ptr_
This is the base class for all stomp cost functions.
virtual bool generateNoisyParameters(const Eigen::MatrixXd &parameters, std::size_t start_timestep, std::size_t num_timesteps, int iteration_number, int rollout_number, Eigen::MatrixXd &parameters_noise, Eigen::MatrixXd &noise) override
Generates a noisy trajectory from the parameters by calling the active Noise Generator plugin...
virtual void done(bool success, int total_iterations, double final_cost, const Eigen::MatrixXd &parameters) override
Called by Stomp at the end of the optimization process.
Loads and manages the STOMP plugins during the planning process.
virtual bool filterParameterUpdates(std::size_t start_timestep, std::size_t num_timesteps, int iteration_number, const Eigen::MatrixXd &parameters, Eigen::MatrixXd &updates) override
Filters the given parameters which is applied after calculating the update. It could be used for clip...
virtual void postIteration(std::size_t start_timestep, std::size_t num_timesteps, int iteration_number, double cost, const Eigen::MatrixXd &parameters)
Called by STOMP at the end of each iteration.
This is the base class for all stomp update filters.


stomp_moveit
Author(s): Jorge Nicho
autogenerated on Fri May 8 2020 03:35:47