stomp_cost_function.h
Go to the documentation of this file.
1 
26 #ifndef INDUSTRIAL_MOVEIT_STOMP_CORE_INCLUDE_STOMP_CORE_STOMP_COST_FUNCTION_H_
27 #define INDUSTRIAL_MOVEIT_STOMP_CORE_INCLUDE_STOMP_CORE_STOMP_COST_FUNCTION_H_
28 
29 #include <string>
30 #include <XmlRpc.h>
31 #include <stomp_core/utils.h>
32 #include <moveit_msgs/GetMotionPlan.h>
36 
37 namespace stomp_moveit
38 {
39 
40 namespace cost_functions
41 {
42 
43 class StompCostFunction;
44 typedef std::shared_ptr<StompCostFunction> StompCostFunctionPtr;
45 
54 {
55 public:
57  cost_weight_(1.0)
58  {
59 
60  }
61 
62  virtual ~StompCostFunction(){}
63 
71  virtual bool initialize(moveit::core::RobotModelConstPtr robot_model_ptr,
72  const std::string& group_name,XmlRpc::XmlRpcValue& config) = 0;
73 
79  virtual bool configure(const XmlRpc::XmlRpcValue& config) = 0;
80 
89  virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr& planning_scene,
90  const moveit_msgs::MotionPlanRequest &req,
91  const stomp_core::StompConfiguration &config,
92  moveit_msgs::MoveItErrorCodes& error_code) = 0;
93 
94 
106  virtual bool computeCosts(const Eigen::MatrixXd& parameters,
107  std::size_t start_timestep,
108  std::size_t num_timesteps,
109  int iteration_number,
110  int rollout_number,
111  Eigen::VectorXd& costs,
112  bool& validity) = 0 ;
113 
122  virtual void postIteration(std::size_t start_timestep,
123  std::size_t num_timesteps,int iteration_number,double cost,const Eigen::MatrixXd& parameters){}
124 
133  virtual void done(bool success,int total_iterations,double final_cost,const Eigen::MatrixXd& parameters){}
134 
135 
136  virtual std::string getGroupName() const
137  {
138  return "Not Implemented";
139  }
140 
141  virtual double getWeight() const
142  {
143  return cost_weight_;
144  }
145 
146  virtual std::string getName() const
147  {
148  return "Not Implemented";
149  }
150 
156  virtual int getOptimizedIndex() const
157  {
158  return -1;
159  }
160 
161 
162 protected:
163 
164  double cost_weight_;
165 
166 };
167 
168 
169 } /* namespace cost_functions */
170 } /* namespace stomp */
171 
172 #endif /* INDUSTRIAL_MOVEIT_STOMP_CORE_INCLUDE_STOMP_CORE_STOMP_COST_FUNCTION_H_ */
virtual bool initialize(moveit::core::RobotModelConstPtr robot_model_ptr, const std::string &group_name, XmlRpc::XmlRpcValue &config)=0
Initializes and configures the Cost Function.
virtual int getOptimizedIndex() const
The index returned by this method will be passed by the Task to the corresponding plugin method as th...
virtual bool configure(const XmlRpc::XmlRpcValue &config)=0
Sets internal members of the plugin from the configuration data.
virtual bool computeCosts(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)=0
computes the state costs as a function of the parameters for each time step.
virtual void done(bool success, int total_iterations, double final_cost, const Eigen::MatrixXd &parameters)
Called by the Stomp Task at the end of the optimization process.
Assigns a cost value to each robot state by evaluating the minimum distance between the robot and the...
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.
virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr &planning_scene, const moveit_msgs::MotionPlanRequest &req, const stomp_core::StompConfiguration &config, moveit_msgs::MoveItErrorCodes &error_code)=0
Stores the planning details which will be used during the costs calculations.


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