Robowflex  v0.1
Making MoveIt Easy
robowflex_library/include/robowflex_library/planning.h
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
3 #ifndef ROBOWFLEX_PLANNER_
4 #define ROBOWFLEX_PLANNER_
5 
6 #include <moveit/planning_pipeline/planning_pipeline.h>
7 
10 #include <robowflex_library/pool.h>
14 
15 namespace robowflex
16 {
17  /** \cond IGNORE */
18  ROBOWFLEX_CLASS_FORWARD(Geometry);
19  /** \endcond */
20 
21  /** \cond IGNORE */
22  ROBOWFLEX_CLASS_FORWARD(Planner);
23  /** \endcond */
24 
25  /** \class robowflex::PlannerPtr
26  \brief A shared pointer wrapper for robowflex::Planner. */
27 
28  /** \class robowflex::PlannerConstPtr
29  \brief A const shared pointer wrapper for robowflex::Planner. */
30 
31  /** \brief An abstract interface to a motion planning algorithm.
32  */
33  class Planner
34  {
35  public:
36  /** \brief A function that returns the value of a planner property over the course of a run.
37  */
39 
40  /** \brief Constructor.
41  * Takes in a \a robot description and an optional namespace \a name.
42  * If \a name is specified, planner parameters are namespaced under the namespace of \a robot.
43  * \param[in] robot The robot to plan for.
44  * \param[in] name Optional namespace for planner.
45  */
46  Planner(const RobotPtr &robot, const std::string &name = "");
47 
48  // non-copyable
49  Planner(Planner const &) = delete;
50  void operator=(Planner const &) = delete;
51 
52  /** \brief Plan a motion given a \a request and a \a scene.
53  * A virtual method that must be implemented by any robowflex::Planner.
54  * \param[in] scene A planning scene for the same \a robot_ to compute the plan in.
55  * \param[in] request The motion planning request to solve.
56  * \return The motion planning response generated by the planner.
57  */
60 
61  /** \brief Return all planner configurations offered by this planner.
62  * Any of the configurations returned can be set as the planner for a motion planning query sent to
63  * plan().
64  * \return A vector of strings of planner configuration names.
65  */
67 
68  /** \brief Retrieve the planner progress property map for this planner given a specific request.
69  * \param[in] scene A planning scene for the same \a robot_ to compute the plan in.
70  * \param[in] request Request to get progress properties for.
71  * \return The map of progress properties.
72  */
74  const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) const;
75 
76  /** \brief Return the robot for this planner.
77  * \return Get the robot associated with the planner.
78  */
79  const RobotPtr getRobot() const;
80 
81  /** \brief Get the name of the planner.
82  * \return The planner's name.
83  */
84  const std::string &getName() const;
85 
86  /** \brief This function is called before benchmarking.
87  * \param[in] scene Scene to plan for.
88  * \param[in] request Planning request.
89  */
90  virtual void preRun(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request);
91 
92  protected:
93  RobotPtr robot_; ///< The robot to plan for.
94  IO::Handler handler_; ///< The parameter handler for the planner.
95  const std::string name_; ///< Namespace for the planner.
96  };
97 
98  /** \brief A thread pool of planners \a P to service requests in a multi-threaded environment
99  * simultaneously.
100  */
101  class PoolPlanner : public Planner
102  {
103  public:
104  /** \brief Constructor.
105  * Takes in a \a robot description and an optional namespace \a name.
106  * If \a name is specified, planner parameters are namespaced under the namespace of \a robot.
107  * \param[in] robot The robot to plan for.
108  * \param[in] n The number of threads to use. By default uses maximum available on the machine.
109  * \param[in] name Optional namespace for planner.
110  */
111  PoolPlanner(const RobotPtr &robot, unsigned int n = std::thread::hardware_concurrency(),
112  const std::string &name = "");
113 
114  // non-copyable
115  PoolPlanner(PoolPlanner const &) = delete;
116  void operator=(PoolPlanner const &) = delete;
117 
118  /** \brief Initialize the planner pool.
119  * Forwards template arguments \a Args to the initializer of the templated planner \a P. Assumes that
120  * the constructor of the planner takes \a robot_ and \a name_.
121  * \param[in] args Arguments to initializer of planner \a P.
122  * \tparam P The robowflex::Planner to pool.
123  * \tparam Args Argument types to initializer of planner \a P.
124  * \return True on success, false on failure.
125  */
126  template <typename P, typename... Args>
127  bool initialize(Args &&... args)
128  {
129  for (unsigned int i = 0; i < pool_.getThreadCount(); ++i)
130  {
131  auto planner = std::make_shared<P>(robot_, name_);
132 
133  if (!planner->initialize(std::forward<Args>(args)...))
134  return false;
135 
136  planners_.emplace(std::move(planner));
137  }
138 
139  return true;
140  }
141 
142  /** \brief Submit a motion planning request job to the queue.
143  * \param[in] scene Planning scene to plane for.
144  * \param[in] request Motion plan request to service.
145  * \return Job that will service the planning request. This job can be canceled.
146  */
149 
150  /** \brief Plan a motion given a \a request and a \a scene.
151  * Forwards the planning request onto the thread pool to be executed. Blocks until complete and
152  * returns result.
153  * \param[in] scene A planning scene for the same \a robot_ to compute the plan in.
154  * \param[in] request The motion planning request to solve.
155  * \return The motion planning response generated by the planner.
156  */
158  plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override;
159 
161 
162  private:
163  Pool pool_; ///< Thread pool
164 
165  std::queue<PlannerPtr> planners_; ///< Motion planners
166  std::mutex mutex_; ///< Planner mutex
167  std::condition_variable cv_; ///< Planner condition variable
168  };
169 
170  /** \cond IGNORE */
172  /** \endcond */
173 
174  /** \class robowflex::SimpleCartesianPlannerPtr
175  \brief A shared pointer wrapper for robowflex::SimpleCartesianPlanner. */
176 
177  /** \class robowflex::SimpleCartesianPlannerConstPtr
178  \brief A const shared pointer wrapper for robowflex::SimpleCartesianPlanner. */
179 
180  /** \brief A simple motion planner that uses interpolation of the end-effector in Cartesian space to find
181  * a path. Valid configurations are found using IK. This planner is not complete and typically only works
182  * for small movements of the end-effector.
183  */
185  {
186  public:
187  /** \brief Constructor.
188  */
189  SimpleCartesianPlanner(const RobotPtr &robot, const std::string &name = "");
190 
191  // non-copyable
193  void operator=(SimpleCartesianPlanner const &) = delete;
194 
195  /** \brief Plan a Cartesian motion (interpolation) given a \a request and a \a scene from a \a start
196  * configuration. The scene, attempts, and timeout are used from \a request.
197  * \param[in] start Starting state.
198  * \param[in] request The desired end-effector pose.
199  * \return The motion planning response generated by the planner.
200  */
201  planning_interface::MotionPlanResponse plan(const robot_state::RobotState &start,
202  const Robot::IKQuery &request);
203 
204  /** \brief Plan a motion given a \a request and a \a scene.
205  * \param[in] scene A planning scene for the same \a robot_ to compute the plan in.
206  * \param[in] request The motion planning request to solve.
207  * \return The motion planning response generated by the planner.
208  */
210  plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override;
211 
212  /** \brief Set the maximum step size allowed by the planner between output waypoints.
213  * \param[in] position The new step size for the position of the end-effector.
214  * \param[in] rotation The new step size for the rotation of the end-effector.
215  */
216  void setMaxStep(double position, double rotation);
217 
218  /** \brief Set the maximum difference in joint configurations allowed by the planner between output
219  * waypoints.
220  * \param[in] prismatic The new threshold for movement of prismatic joints.
221  * \param[in] revolute The new threshold for movement of revolute joints.
222  */
223  void setJumpThreshold(double prismatic, double revolute);
224 
226 
227  private:
228  double max_step_pos_{constants::cart_pos_step_size}; ///< Max EE step size for position in meters.
229  double max_step_rot_{constants::cart_rot_step_size}; ///< Max EE step size for rotation in radians.
230  double jump_threshold_pri_{constants::cart_pos_jump_tol}; ///< Max jump for prismatic joints in
231  ///< meters.
232  double jump_threshold_rev_{constants::cart_rot_jump_tol}; ///< Max jump for revolute joints in
233  ///< radians.
234  };
235 
236  /** \cond IGNORE */
237  ROBOWFLEX_CLASS_FORWARD(PipelinePlanner);
238  /** \endcond */
239 
240  /** \class robowflex::PipelinePlannerPtr
241  \brief A shared pointer wrapper for robowflex::PipelinePlanner. */
242 
243  /** \class robowflex::PipelinePlannerConstPtr
244  \brief A const shared pointer wrapper for robowflex::PipelinePlanner. */
245 
246  /** \brief A motion planner that uses the \a MoveIt! planning pipeline to load a planner plugin.
247  */
248  class PipelinePlanner : public Planner
249  {
250  public:
251  /** \brief Constructor.
252  */
253  PipelinePlanner(const RobotPtr &robot, const std::string &name = "");
254 
255  // non-copyable
256  PipelinePlanner(PipelinePlanner const &) = delete;
257  void operator=(PipelinePlanner const &) = delete;
258 
259  /** \brief Plan a motion given a \a request and a \a scene.
260  * Uses the planning pipeline's generatePlan() method, which goes through planning adapters.
261  * \param[in] scene A planning scene for the same \a robot_ to compute the plan in.
262  * \param[in] request The motion planning request to solve.
263  * \return The motion planning response generated by the planner.
264  */
266  plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override;
267 
268  /** \brief Retrieve planning context and dynamically cast to desired type from planning pipeline.
269  * \param[in] scene A planning scene for the same \a robot_ to compute the plan in.
270  * \param[in] request The motion planning request to solve.
271  * \tparam T Type of underlying planning context.
272  * \return The casted context for the motion planning request. On failure, nullptr.
273  */
274  template <typename T>
276  const planning_interface::MotionPlanRequest &request) const
277  {
278  if (not pipeline_)
279  return nullptr;
280 
281  auto pc = pipeline_->getPlannerManager()->getPlanningContext(scene->getSceneConst(), request);
282  return std::dynamic_pointer_cast<T>(pc);
283  }
284 
285  protected:
286  planning_pipeline::PlanningPipelinePtr pipeline_; ///< Loaded planning pipeline plugin.
287  };
288 
289  /** \brief OMPL specific planners and features.
290  */
291  namespace OMPL
292  {
293  /** \brief Loads an OMPL configuration YAML file onto the parameter server.
294  */
295  bool loadOMPLConfig(IO::Handler &handler, const std::string &config_file,
296  std::vector<std::string> &configs);
297 
298  /** \brief Settings descriptor for settings provided by the default \a MoveIt! OMPL planning pipeline.
299  */
300  class Settings
301  {
302  public:
303  /** \brief Constructor.
304  * Initialized here so an empty class can be used as default arguments in a function.
305  */
306  Settings();
307 
308  int max_goal_samples; ///< Maximum number of successful goal samples to keep.
309  int max_goal_sampling_attempts; ///< Maximum number of attempts to sample a goal.
310  int max_planning_threads; ///< Maximum number of threads used to service a request.
311  double max_solution_segment_length; ///< Maximum solution segment length.
312  int max_state_sampling_attempts; ///< Maximum number of attempts to sample a new state.
313  int minimum_waypoint_count; ///< Minimum number of waypoints in output path.
314  bool simplify_solutions; ///< Whether or not planner should simplify solutions.
315  bool hybridize_solutions; ///< Whether or not planner should hybridize solutions.
316  bool interpolate_solutions; ///< Whether or not planner should interpolate solutions.
317  bool use_constraints_approximations; ///< Absolute silliness.
318  bool display_random_valid_states; ///< N/A, defunct.
320  double maximum_waypoint_distance; ///< Maximum distance between waypoints in path.
321 
322  /** \brief Sets member variables on the parameter server using \a handler.
323  */
324  void setParam(IO::Handler &handler) const;
325  };
326 
327  /** \cond IGNORE */
329  /** \endcond */
330 
331  /** \class robowflex::OMPL::OMPLPipelinePlannerPtr
332  \brief A shared pointer wrapper for robowflex::OMPL::OMPLPipelinePlanner. */
333 
334  /** \class robowflex::OMPL::OMPLPipelinePlannerConstPtr
335  \brief A const shared pointer wrapper for robowflex::OMPL::OMPLPipelinePlanner. */
336 
337  /** \brief A robowflex::PipelinePlanner that uses the \a MoveIt! default OMPL planning pipeline.
338  */
340  {
341  public:
342  OMPLPipelinePlanner(const RobotPtr &robot, const std::string &name = "");
343 
344  // non-copyable
346  void operator=(OMPLPipelinePlanner const &) = delete;
347 
348  /** \brief Initialize planning pipeline.
349  * Loads OMPL planning plugin \a plugin with the planning adapters \a adapters. Parameters are
350  * set on the parameter server from \a settings and planning configurations are loaded from the
351  * YAML file \a config_file.
352  * \param[in] config_file A YAML file containing OMPL planner configurations.
353  * \param[in] settings Settings to set on the parameter server.
354  * \param[in] plugin Planning plugin to load.
355  * \param[in] adapters Planning adapters to load.
356  * \return True upon success, false on failure.
357  */
358  bool initialize(const std::string &config_file = "", const Settings &settings = Settings(),
359  const std::string &plugin = DEFAULT_PLUGIN,
360  const std::vector<std::string> &adapters = DEFAULT_ADAPTERS);
361 
363 
364  protected:
365  static const std::string DEFAULT_PLUGIN; ///< The default OMPL plugin.
366  static const std::vector<std::string> DEFAULT_ADAPTERS; ///< The default planning adapters.
367 
368  private:
369  std::vector<std::string> configs_; ///< Planning configurations loaded from \a config_file in
370  ///< initialize()
371  };
372  } // namespace OMPL
373 
374  namespace opt
375  {
376  /** \brief Loads configuration YAML file onto the parameter server.
377  */
378  bool loadConfig(IO::Handler &handler, const std::string &config_file);
379 
380  /** \brief Settings descriptor for settings provided by the default \a MoveIt! CHOMP planning
381  * pipeline.
382  */
384  {
385  public:
386  /** \brief Constructor.
387  * Initialized here so an empty class can be used as default arguments in a function.
388  */
389  CHOMPSettings();
390 
391  double planning_time_limit; ///< Maximum time the optimizer can take to find a solution.
392  int max_iterations; ///< Maximum number of iterations the planner can take while optimization.
393  int max_iterations_after_collision_free; ///< Maximum number of iterations the planner will take
394  ///< after having found a collision-free path.
395  double smoothness_cost_weight; ///< Weight given to the smoothnes cost in optimization problem.
396  double obstacle_cost_weight; ///< Weight given to the obstacle cost in optimization problem.
397  double learning_rate; ///< Learning rate for gradient descent.
398  bool animate_path; ///< Whether to create an animated path.
399  bool add_randomness; ///< Whether to add randomness.
400  double smoothness_cost_velocity; ///< Variable associated with the cost in velocity.
401  double smoothness_cost_acceleration; ///< Variable associtated with the cost in acceleration.
402  double smoothness_cost_jerk; ///< Variable associated with the cost in jerk.
403  double hmc_discretization; ///< Discretization level for the Hamiltonian MonteCarlo.
404  double hmc_stochasticity; ///< Stochasticity level of Hamitonian MonteCarlo.
405  double hmc_annealing_factor; ///< Annealing factor in Hamiltonian MonteCarlo.
406  bool use_hamiltonian_monte_carlo; ///< Whether to use hamiltonian monte carlo or not.
407  double ridge_factor; ///< Amount of noise added to the diagonal of the quadratic cost matrix.
408  ///< Needs to be grater than zero to allow CHOMP to avoid obstacles.
409  bool use_pseudo_inverse; ///< Whether to use pseudo-inverse computations or not.
410  double pseudo_inverse_ridge_factor; ///< ridge factor when pseudo-inverse is on.
411  bool animate_endeffector; ///< Whether to animate the end effector or not.
412  std::string animate_endeffector_segment; ///< Name of end effector segment to animate
413  double joint_update_limit; ///< Update limit for the robot joints
414  double collision_clearence; ///< Minimum distance to the obstacles that the robot needs to stay
415  ///< away from.
416  double collision_threshold; ///< Cost threshold for collision detection.
417  double random_jump_amount; ///< Amount of random jump.
418  bool use_stochastic_descent; ///< Whether to use SGD or not.
419  bool enable_failure_recovery; ///< If enabled, CHOMP can tweak the parameters hoping to find a
420  ///< solution if one is not found using the default parameters.
421  int max_recovery_attempts; ///< Maximum number of times that CHOMP tweaks parameters.
422  std::string trajectory_initialization_method; ///< Type of initial trajectory for CHOMP. Possible
423  ///< values are quintic-spline, linear, cubic or
424  ///< fillTrajectory.
425  double start_state_max_bounds_error; ///< Maximum bound errors for the initial state.
426 
427  /** \brief Sets member variables on the parameter server using \a handler.
428  */
429  void setParam(IO::Handler &handler) const;
430  };
431 
432  /** \cond IGNORE */
434  /** \endcond */
435 
436  /** \class robowflex::CHOMP::CHOMPPipelinePlannerPtr
437  \brief A shared pointer wrapper for robowflex::CHOMP::CHOMPPipelinePlanner. */
438 
439  /** \class robowflex::CHOMP::CHOMPPipelinePlannerConstPtr
440  \brief A const shared pointer wrapper for robowflex::CHOMP::CHOMPPipelinePlanner. */
441 
442  /** \brief A robowflex::PipelinePlanner that uses the \a MoveIt! CHOMP planning pipeline.
443  */
445  {
446  public:
447  CHOMPPipelinePlanner(const RobotPtr &robot, const std::string &name = "");
448 
449  // non-copyable
451  void operator=(CHOMPPipelinePlanner const &) = delete;
452 
453  /** \brief Initialize planning pipeline.
454  * Loads CHOMP planning plugin \a plugin with the planning adapters \a adapters. Parameters are
455  * set on the parameter server from \a config_file.
456  * \param[in] config_file A YAML file containing CHOMP configuration.
457  * \param[in] plugin Planning plugin to load.
458  * \param[in] adapters Planning adapters to load.
459  * \return True upon success, false on failure.
460  */
461  bool initialize(const std::string &config_file, const std::string &plugin = DEFAULT_PLUGIN,
462  const std::vector<std::string> &adapters = DEFAULT_ADAPTERS);
463 
464  /** \brief Initialize planning pipeline.
465  * Loads CHOMP planning plugin \a plugin with the planning adapters \a adapters. Parameters are
466  * set on the parameter server from \a settings.
467  * \param[in] settings Planner settings.
468  * \param[in] plugin Planning plugin to load.
469  * \param[in] adapters Planning adapters to load.
470  * \return True upon success, false on failure.
471  */
472  bool initialize(const CHOMPSettings &settings = CHOMPSettings(),
473  const std::string &plugin = DEFAULT_PLUGIN,
474  const std::vector<std::string> &adapters = DEFAULT_ADAPTERS);
475 
477 
478  protected:
479  /** \brief Finalize the initialization process after parameters are set.
480  * \param[in] plugin Planning plugin to load.
481  * \param[in] adapters Planning adapters to load.
482  * \return True upon success, false on failure.
483  */
484  bool finishInitialize(const std::string &plugin, const std::vector<std::string> &adapters);
485 
486  static const std::string DEFAULT_PLUGIN; ///< The default CHOMP plugin.
487  static const std::vector<std::string> DEFAULT_ADAPTERS; ///< The default planning adapters.
488 
489  private:
490  std::vector<std::string> configs_; ///< Planning configurations loaded from \a config_file.
491  };
492 
493  /** \cond IGNORE */
495  /** \endcond */
496 
497  /** \class robowflex::opt::TrajOptPipelinePlannerPtr
498  \brief A shared pointer wrapper for robowflex::opt::TrajOptPipelinePlanner. */
499 
500  /** \class robowflex::opt::TrajOptPipelinePlannerConstPtr
501  \brief A const shared pointer wrapper for robowflex::opt::TrajOptPipelinePlanner. */
502 
503  /** \brief A robowflex::PipelinePlanner that uses the \a MoveIt! TrajOpt planning pipeline.
504  */
506  {
507  public:
508  TrajOptPipelinePlanner(const RobotPtr &robot, const std::string &name = "");
509 
510  // non-copyable
512  void operator=(TrajOptPipelinePlanner const &) = delete;
513 
514  /** \brief Initialize planning pipeline.
515  * Loads TrajOpt planning plugin \a plugin with the planning adapters \a adapters. Parameters are
516  * set on the parameter server from \a settings and planning configurations are loaded from the
517  * YAML file \a config_file.
518  * \param[in] config_file A YAML file containing TrajOpt configuration.
519  * \param[in] plugin Planning plugin to load.
520  * \param[in] adapters Planning adapters to load.
521  * \return True upon success, false on failure.
522  */
523  bool initialize(const std::string &config_file = "", const std::string &plugin = DEFAULT_PLUGIN,
524  const std::vector<std::string> &adapters = DEFAULT_ADAPTERS);
525 
526  protected:
527  static const std::string DEFAULT_PLUGIN; ///< The default TrajOpt plugin.
528  static const std::vector<std::string> DEFAULT_ADAPTERS; ///< The default planning adapters.
529  };
530  } // namespace opt
531 } // namespace robowflex
532 
533 #endif
#define ROBOWFLEX_CLASS_FORWARD(C)
Macro that forward declares a class and defines two shared ptrs types:
Definition: class_forward.h:16
ROS parameter server handler to handle namespacing and automatic parameter deletion.
Definition: handler.h:19
A robowflex::PipelinePlanner that uses the MoveIt! default OMPL planning pipeline.
OMPLPipelinePlanner(const RobotPtr &robot, const std::string &name="")
void operator=(OMPLPipelinePlanner const &)=delete
static const std::string DEFAULT_PLUGIN
The default OMPL plugin.
static const std::vector< std::string > DEFAULT_ADAPTERS
The default planning adapters.
std::vector< std::string > getPlannerConfigs() const override
Return all planner configurations offered by this planner. Any of the configurations returned can be ...
bool initialize(const std::string &config_file="", const Settings &settings=Settings(), const std::string &plugin=DEFAULT_PLUGIN, const std::vector< std::string > &adapters=DEFAULT_ADAPTERS)
Initialize planning pipeline. Loads OMPL planning plugin plugin with the planning adapters adapters....
OMPLPipelinePlanner(OMPLPipelinePlanner const &)=delete
Settings descriptor for settings provided by the default MoveIt! OMPL planning pipeline.
void setParam(IO::Handler &handler) const
Sets member variables on the parameter server using handler.
int minimum_waypoint_count
Minimum number of waypoints in output path.
int max_goal_samples
Maximum number of successful goal samples to keep.
int max_state_sampling_attempts
Maximum number of attempts to sample a new state.
int max_planning_threads
Maximum number of threads used to service a request.
bool interpolate_solutions
Whether or not planner should interpolate solutions.
bool hybridize_solutions
Whether or not planner should hybridize solutions.
double max_solution_segment_length
Maximum solution segment length.
double maximum_waypoint_distance
Maximum distance between waypoints in path.
Settings()
Constructor. Initialized here so an empty class can be used as default arguments in a function.
bool simplify_solutions
Whether or not planner should simplify solutions.
int max_goal_sampling_attempts
Maximum number of attempts to sample a goal.
A motion planner that uses the MoveIt! planning pipeline to load a planner plugin.
PipelinePlanner(const RobotPtr &robot, const std::string &name="")
Constructor.
PipelinePlanner(PipelinePlanner const &)=delete
planning_pipeline::PlanningPipelinePtr pipeline_
Loaded planning pipeline plugin.
std::shared_ptr< T > extractPlanningContext(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) const
Retrieve planning context and dynamically cast to desired type from planning pipeline.
void operator=(PipelinePlanner const &)=delete
planning_interface::MotionPlanResponse plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override
Plan a motion given a request and a scene. Uses the planning pipeline's generatePlan() method,...
An abstract interface to a motion planning algorithm.
const RobotPtr getRobot() const
Return the robot for this planner.
virtual std::vector< std::string > getPlannerConfigs() const =0
Return all planner configurations offered by this planner. Any of the configurations returned can be ...
Planner(Planner const &)=delete
void operator=(Planner const &)=delete
const std::string & getName() const
Get the name of the planner.
const std::string name_
Namespace for the planner.
IO::Handler handler_
The parameter handler for the planner.
virtual planning_interface::MotionPlanResponse plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request)=0
Plan a motion given a request and a scene. A virtual method that must be implemented by any robowflex...
virtual void preRun(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request)
This function is called before benchmarking.
virtual std::map< std::string, ProgressProperty > getProgressProperties(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) const
Retrieve the planner progress property map for this planner given a specific request.
Planner(const RobotPtr &robot, const std::string &name="")
Constructor. Takes in a robot description and an optional namespace name. If name is specified,...
A thread pool of planners P to service requests in a multi-threaded environment simultaneously.
std::shared_ptr< Pool::Job< planning_interface::MotionPlanResponse > > submit(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request)
Submit a motion planning request job to the queue.
PoolPlanner(PoolPlanner const &)=delete
planning_interface::MotionPlanResponse plan(const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request) override
Plan a motion given a request and a scene. Forwards the planning request onto the thread pool to be e...
void operator=(PoolPlanner const &)=delete
std::condition_variable cv_
Planner condition variable.
std::queue< PlannerPtr > planners_
Motion planners.
bool initialize(Args &&... args)
Initialize the planner pool. Forwards template arguments Args to the initializer of the templated pla...
std::vector< std::string > getPlannerConfigs() const override
Return all planner configurations offered by this planner. Any of the configurations returned can be ...
PoolPlanner(const RobotPtr &robot, unsigned int n=std::thread::hardware_concurrency(), const std::string &name="")
Constructor. Takes in a robot description and an optional namespace name. If name is specified,...
A thread pool that can execute arbitrary functions asynchronously. Functions with arguments to be exe...
Definition: pool.h:95
unsigned int getThreadCount() const
Get the number of threads.
Definition: pool.cpp:40
A shared pointer wrapper for robowflex::Robot.
A const shared pointer wrapper for robowflex::Scene.
A simple motion planner that uses interpolation of the end-effector in Cartesian space to find a path...
planning_interface::MotionPlanResponse plan(const robot_state::RobotState &start, const Robot::IKQuery &request)
Plan a Cartesian motion (interpolation) given a request and a scene from a start configuration....
SimpleCartesianPlanner(SimpleCartesianPlanner const &)=delete
void setJumpThreshold(double prismatic, double revolute)
Set the maximum difference in joint configurations allowed by the planner between output waypoints.
SimpleCartesianPlanner(const RobotPtr &robot, const std::string &name="")
Constructor.
std::vector< std::string > getPlannerConfigs() const override
Return all planner configurations offered by this planner. Any of the configurations returned can be ...
double max_step_rot_
Max EE step size for rotation in radians.
double max_step_pos_
Max EE step size for position in meters.
void setMaxStep(double position, double rotation)
Set the maximum step size allowed by the planner between output waypoints.
void operator=(SimpleCartesianPlanner const &)=delete
A robowflex::PipelinePlanner that uses the MoveIt! CHOMP planning pipeline.
static const std::string DEFAULT_PLUGIN
The default CHOMP plugin.
CHOMPPipelinePlanner(const RobotPtr &robot, const std::string &name="")
bool initialize(const std::string &config_file, const std::string &plugin=DEFAULT_PLUGIN, const std::vector< std::string > &adapters=DEFAULT_ADAPTERS)
Initialize planning pipeline. Loads CHOMP planning plugin plugin with the planning adapters adapters....
static const std::vector< std::string > DEFAULT_ADAPTERS
The default planning adapters.
CHOMPPipelinePlanner(CHOMPPipelinePlanner const &)=delete
std::vector< std::string > getPlannerConfigs() const override
Return all planner configurations offered by this planner. Any of the configurations returned can be ...
bool finishInitialize(const std::string &plugin, const std::vector< std::string > &adapters)
Finalize the initialization process after parameters are set.
std::vector< std::string > configs_
Planning configurations loaded from config_file.
void operator=(CHOMPPipelinePlanner const &)=delete
Settings descriptor for settings provided by the default MoveIt! CHOMP planning pipeline.
double hmc_discretization
Discretization level for the Hamiltonian MonteCarlo.
double pseudo_inverse_ridge_factor
ridge factor when pseudo-inverse is on.
double obstacle_cost_weight
Weight given to the obstacle cost in optimization problem.
double planning_time_limit
Maximum time the optimizer can take to find a solution.
void setParam(IO::Handler &handler) const
Sets member variables on the parameter server using handler.
bool use_pseudo_inverse
Whether to use pseudo-inverse computations or not.
double smoothness_cost_jerk
Variable associated with the cost in jerk.
double smoothness_cost_acceleration
Variable associtated with the cost in acceleration.
int max_iterations
Maximum number of iterations the planner can take while optimization.
int max_recovery_attempts
Maximum number of times that CHOMP tweaks parameters.
double smoothness_cost_weight
Weight given to the smoothnes cost in optimization problem.
CHOMPSettings()
Constructor. Initialized here so an empty class can be used as default arguments in a function.
double hmc_annealing_factor
Annealing factor in Hamiltonian MonteCarlo.
double smoothness_cost_velocity
Variable associated with the cost in velocity.
double hmc_stochasticity
Stochasticity level of Hamitonian MonteCarlo.
double start_state_max_bounds_error
Maximum bound errors for the initial state.
std::string animate_endeffector_segment
Name of end effector segment to animate.
bool animate_endeffector
Whether to animate the end effector or not.
double collision_threshold
Cost threshold for collision detection.
bool use_hamiltonian_monte_carlo
Whether to use hamiltonian monte carlo or not.
A robowflex::PipelinePlanner that uses the MoveIt! TrajOpt planning pipeline.
TrajOptPipelinePlanner(const RobotPtr &robot, const std::string &name="")
bool initialize(const std::string &config_file="", const std::string &plugin=DEFAULT_PLUGIN, const std::vector< std::string > &adapters=DEFAULT_ADAPTERS)
Initialize planning pipeline. Loads TrajOpt planning plugin plugin with the planning adapters adapter...
static const std::vector< std::string > DEFAULT_ADAPTERS
The default planning adapters.
void operator=(TrajOptPipelinePlanner const &)=delete
static const std::string DEFAULT_PLUGIN
The default TrajOpt plugin.
TrajOptPipelinePlanner(TrajOptPipelinePlanner const &)=delete
T hardware_concurrency(T... args)
T move(T... args)
moveit_msgs::MotionPlanRequest MotionPlanRequest
Functions for loading and animating robots in Blender.
bool loadOMPLConfig(IO::Handler &handler, const std::string &config_file, std::vector< std::string > &configs)
Loads an OMPL configuration YAML file onto the parameter server.
static const double cart_pos_jump_tol
Definition: constants.h:33
static const double cart_pos_step_size
Definition: constants.h:31
static const double cart_rot_jump_tol
Definition: constants.h:32
static const double cart_rot_step_size
Definition: constants.h:30
bool loadConfig(IO::Handler &handler, const std::string &config_file)
Loads configuration YAML file onto the parameter server.
Main namespace. Contains all library classes and functions.
Definition: scene.cpp:25
Functions for loading and animating scenes in Blender.
Robot IK Query options. IK queries in Robowflex consist of: a) A position specified by some geometric...