add_ruckig_traj_smoothing.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2021, PickNik Robotics
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * * Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *******************************************************************************/
33 
34 /* Author: Jack Center, Wyatt Rees, Andy Zelenak */
35 
39 
41 {
42 using namespace trajectory_processing;
43 
44 const std::string LOGGER = "moveit_ros.add_traj_smoothing";
45 
47 class AddRuckigTrajectorySmoothing : public planning_request_adapter::PlanningRequestAdapter
48 {
49 public:
50  AddRuckigTrajectorySmoothing() : planning_request_adapter::PlanningRequestAdapter()
51  {
52  }
53 
54  void initialize(const ros::NodeHandle& /*node_handle*/) override
55  {
56  }
57 
58  std::string getDescription() const override
59  {
60  return "Add Ruckig trajectory smoothing.";
61  }
62 
63  bool adaptAndPlan(const PlannerFn& planner, const planning_scene::PlanningSceneConstPtr& planning_scene,
65  std::vector<std::size_t>& /*added_path_index*/) const override
66  {
67  bool result = planner(planning_scene, req, res);
68  if (result && res.trajectory_)
69  {
70  if (!smoother_.applySmoothing(*res.trajectory_, req.max_velocity_scaling_factor,
71  req.max_acceleration_scaling_factor))
72  {
73  ROS_WARN_NAMED(LOGGER, " Trajectory smoothing for the solution path failed.");
74  result = false;
75  }
76  }
77 
78  return result;
79  }
80 
81 private:
82  RuckigSmoothing smoother_;
83 };
84 
85 } // namespace default_planner_request_adapters
86 
initialize
bool initialize(MeshCollisionTraversalNode< BV > &node, BVHModel< BV > &model1, Transform3< typename BV::S > &tf1, BVHModel< BV > &model2, Transform3< typename BV::S > &tf2, const CollisionRequest< typename BV::S > &request, CollisionResult< typename BV::S > &result, bool use_refit, bool refit_bottomup)
planning_interface::MotionPlanResponse
planning_request_adapter.h
default_planner_request_adapters::LOGGER
const std::string LOGGER
Definition: add_ruckig_traj_smoothing.cpp:75
trajectory_processing::RuckigSmoothing
planning_request_adapter::PlanningRequestAdapter
planning_interface::MotionPlanResponse::trajectory_
robot_trajectory::RobotTrajectoryPtr trajectory_
trajectory_processing
class_loader.hpp
planning_interface::MotionPlanRequest
moveit_msgs::MotionPlanRequest MotionPlanRequest
ruckig_traj_smoothing.h
default_planner_request_adapters::AddRuckigTrajectorySmoothing
This adapter uses the time-optimal trajectory generation method.
Definition: add_ruckig_traj_smoothing.cpp:78
default_planner_request_adapters
Definition: add_iterative_spline_parameterization.cpp:43
planning_request_adapter
ROS_WARN_NAMED
#define ROS_WARN_NAMED(name,...)
CLASS_LOADER_REGISTER_CLASS
CLASS_LOADER_REGISTER_CLASS(default_planner_request_adapters::AddIterativeSplineParameterization, planning_request_adapter::PlanningRequestAdapter)
planning_scene
ros::NodeHandle


planning
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Sat Apr 27 2024 02:26:03