Go to the documentation of this file.00001
00027 #ifndef INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_OBSTACLE_DISTANCE_GRADIENT_H_
00028 #define INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_OBSTACLE_DISTANCE_GRADIENT_H_
00029
00030 #include <stomp_moveit/cost_functions/stomp_cost_function.h>
00031 #include <array>
00032
00033 namespace stomp_moveit
00034 {
00035 namespace cost_functions
00036 {
00044 class ObstacleDistanceGradient : public StompCostFunction
00045 {
00046 public:
00047 ObstacleDistanceGradient();
00048 virtual ~ObstacleDistanceGradient();
00049
00057 virtual bool initialize(moveit::core::RobotModelConstPtr robot_model_ptr, const std::string& group_name,
00058 XmlRpc::XmlRpcValue& config) override;
00059
00065 virtual bool configure(const XmlRpc::XmlRpcValue& config) override;
00066
00067
00076 virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr& planning_scene,
00077 const moveit_msgs::MotionPlanRequest &req,
00078 const stomp_core::StompConfiguration &config,
00079 moveit_msgs::MoveItErrorCodes& error_code) override;
00080
00092 virtual bool computeCosts(const Eigen::MatrixXd& parameters, std::size_t start_timestep, std::size_t num_timesteps,
00093 int iteration_number, int rollout_number, Eigen::VectorXd& costs, bool& validity) override;
00094
00095 virtual std::string getGroupName() const override
00096 {
00097 return group_name_;
00098 }
00099
00100 virtual std::string getName() const override
00101 {
00102 return name_ + "/" + group_name_ ;
00103 }
00104
00105 virtual void done(bool success,int total_iterations,double final_cost,const Eigen::MatrixXd& parameters) override;
00106
00107
00108 protected:
00109
00118 bool checkIntermediateCollisions(const Eigen::VectorXd& start, const Eigen::VectorXd& end,double longest_valid_joint_move);
00119
00120
00121 std::string name_;
00122
00123
00124 std::string group_name_;
00125 moveit::core::RobotModelConstPtr robot_model_ptr_;
00126 moveit::core::RobotStatePtr robot_state_;
00127
00128
00129 std::array<moveit::core::RobotStatePtr,3 > intermediate_coll_states_;
00132
00133 planning_scene::PlanningSceneConstPtr planning_scene_;
00134 moveit_msgs::MotionPlanRequest plan_request_;
00135
00136
00137 collision_detection::CollisionRequest collision_request_;
00138 collision_detection::CollisionResult collision_result_;
00139
00140
00141 double max_distance_;
00142 double longest_valid_joint_move_;
00144 };
00145
00146 }
00147 }
00148
00149 #endif