obstacle_distance_gradient.h
Go to the documentation of this file.
1 
27 #ifndef INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_OBSTACLE_DISTANCE_GRADIENT_H_
28 #define INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_OBSTACLE_DISTANCE_GRADIENT_H_
29 
31 #include <array>
32 
33 namespace stomp_moveit
34 {
35 namespace cost_functions
36 {
45 {
46 public:
48  virtual ~ObstacleDistanceGradient();
49 
57  virtual bool initialize(moveit::core::RobotModelConstPtr robot_model_ptr, const std::string& group_name,
58  XmlRpc::XmlRpcValue& config) override;
59 
65  virtual bool configure(const XmlRpc::XmlRpcValue& config) override;
66 
67 
76  virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr& planning_scene,
77  const moveit_msgs::MotionPlanRequest &req,
78  const stomp_core::StompConfiguration &config,
79  moveit_msgs::MoveItErrorCodes& error_code) override;
80 
92  virtual bool computeCosts(const Eigen::MatrixXd& parameters, std::size_t start_timestep, std::size_t num_timesteps,
93  int iteration_number, int rollout_number, Eigen::VectorXd& costs, bool& validity) override;
94 
95  virtual std::string getGroupName() const override
96  {
97  return group_name_;
98  }
99 
100  virtual std::string getName() const override
101  {
102  return name_ + "/" + group_name_ ;
103  }
104 
105  virtual void done(bool success,int total_iterations,double final_cost,const Eigen::MatrixXd& parameters) override;
106 
107 
108 protected:
109 
118  bool checkIntermediateCollisions(const Eigen::VectorXd& start, const Eigen::VectorXd& end,double longest_valid_joint_move);
119 
120 
121  std::string name_;
122 
123  // robot details
124  std::string group_name_;
125  moveit::core::RobotModelConstPtr robot_model_ptr_;
126  moveit::core::RobotStatePtr robot_state_;
127 
128  // intermediate collision check support
129  std::array<moveit::core::RobotStatePtr,3 > intermediate_coll_states_;
132  // planning context information
133  planning_scene::PlanningSceneConstPtr planning_scene_;
134  moveit_msgs::MotionPlanRequest plan_request_;
135 
136  // distance and collision check
137  collision_detection::CollisionRequest collision_request_;
138  collision_detection::CollisionResult collision_result_;
139 
140  // parameters
141  double max_distance_;
144 };
145 
146 } /* namespace cost_functions */
147 } /* namespace stomp_moveit */
148 
149 #endif /* INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_OBSTACLE_DISTANCE_GRADIENT_H_ */
bool checkIntermediateCollisions(const Eigen::VectorXd &start, const Eigen::VectorXd &end, double longest_valid_joint_move)
Checks for collision between consecutive points by dividing the joint move into sub-moves where the m...
virtual void done(bool success, int total_iterations, double final_cost, const Eigen::MatrixXd &parameters) override
Called by the Stomp Task at the end of the optimization process.
virtual bool configure(const XmlRpc::XmlRpcValue &config) override
Sets internal members of the plugin from the configuration data.
double max_distance_
maximum distance from at which the trajectory will be penalized
This is the base class for all stomp cost functions.
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) override
computes the state costs by calculating the minimum distance between the robot and an obstacle...
std::array< moveit::core::RobotStatePtr, 3 > intermediate_coll_states_
Used in checking collisions between to consecutive poses.
Assigns a cost value to each robot state by evaluating the minimum distance between the robot and the...
double longest_valid_joint_move_
how far can a joint move in between consecutive trajectory points
virtual bool initialize(moveit::core::RobotModelConstPtr robot_model_ptr, const std::string &group_name, XmlRpc::XmlRpcValue &config) override
Initializes and configures the Cost Function. Calls the configure method and passes the &#39;config&#39; valu...
virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr &planning_scene, const moveit_msgs::MotionPlanRequest &req, const stomp_core::StompConfiguration &config, moveit_msgs::MoveItErrorCodes &error_code) override
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