45 #include <eigen3/Eigen/Core>
46 #include <moveit_msgs/msg/robot_trajectory.hpp>
47 #include <pluginlib/class_list_macros.hpp>
48 #include <rclcpp/logger.hpp>
49 #include <rclcpp/logging.hpp>
50 #include <rclcpp/node.hpp>
51 #include <rclcpp/parameter_value.hpp>
56 static rclcpp::Logger LOGGER = rclcpp::get_logger(
"chomp_planner");
65 void initialize(
const rclcpp::Node::SharedPtr& node,
const std::string& )
override
70 RCLCPP_DEBUG(LOGGER,
"Param planning_time_limit was not set. Using default value: %f",
73 if (!node->get_parameter(
"chomp.max_iterations", params_.
max_iterations_))
76 RCLCPP_DEBUG(LOGGER,
"Param max_iterations was not set. Using default value: %d", params_.
max_iterations_);
81 RCLCPP_DEBUG(LOGGER,
"Param max_iterations_after_collision_free was not set. Using default value: %d",
87 RCLCPP_DEBUG(LOGGER,
"Param smoothness_cost_weight was not set. Using default value: %f",
93 RCLCPP_DEBUG(LOGGER,
"Param obstacle_cost_weight was not set. Using default value: %f",
96 if (!node->get_parameter(
"chomp.learning_rate", params_.
learning_rate_))
99 RCLCPP_DEBUG(LOGGER,
"Param learning_rate was not set. Using default value: %f", params_.
learning_rate_);
104 RCLCPP_DEBUG(LOGGER,
"Param smoothness_cost_velocity was not set. Using default value: %f",
110 RCLCPP_DEBUG(LOGGER,
"Param smoothness_cost_acceleration was not set. Using default value: %f",
116 RCLCPP_DEBUG(LOGGER,
"Param smoothness_cost_jerk_ was not set. Using default value: %f",
119 if (!node->get_parameter(
"chomp.ridge_factor", params_.
ridge_factor_))
122 RCLCPP_DEBUG(LOGGER,
"Param ridge_factor_ was not set. Using default value: %f", params_.
ridge_factor_);
127 RCLCPP_DEBUG(LOGGER,
"Param use_pseudo_inverse_ was not set. Using default value: %d",
133 RCLCPP_DEBUG(LOGGER,
"Param pseudo_inverse_ridge_factor was not set. Using default value: %f",
139 RCLCPP_DEBUG(LOGGER,
"Param joint_update_limit was not set. Using default value: %f", params_.
joint_update_limit_);
141 if (!node->get_parameter(
"chomp.collision_clearance", params_.
min_clearance_))
144 RCLCPP_DEBUG(LOGGER,
"Param collision_clearance was not set. Using default value: %f", params_.
min_clearance_);
149 RCLCPP_DEBUG(LOGGER,
"Param collision_threshold_ was not set. Using default value: %f",
155 RCLCPP_DEBUG(LOGGER,
"Param use_stochastic_descent was not set. Using default value: %d",
160 if (node->get_parameter(
"chomp.trajectory_initialization_method", method) &&
164 "Attempted to set trajectory_initialization_method to invalid value '%s'. Using default "
172 return "CHOMP Optimizer";
177 std::vector<std::size_t>& )
const override
179 RCLCPP_DEBUG(LOGGER,
"CHOMP: adaptAndPlan ...");
183 if (!planner(ps, req, res))
187 collision_detection::CollisionDetectorAllocatorPtr hybrid_cd(
192 RCLCPP_DEBUG(LOGGER,
"Configuring Planning Scene for CHOMP ...");
201 if (planning_success)
208 return planning_success;
PLUGINLIB_EXPORT_CLASS(cached_ik_kinematics_plugin::CachedIKKinematicsPlugin< kdl_kinematics_plugin::KDLKinematicsPlugin >, kinematics::KinematicsBase)
double collision_threshold_
double planning_time_limit_
std::string trajectory_initialization_method_
double smoothness_cost_weight_
double smoothness_cost_jerk_
double smoothness_cost_acceleration_
bool use_stochastic_descent_
double pseudo_inverse_ridge_factor_
double smoothness_cost_velocity_
int max_iterations_after_collision_free_
double joint_update_limit_
bool setTrajectoryInitializationMethod(std::string method)
double obstacle_cost_weight_
bool solve(const planning_scene::PlanningSceneConstPtr &planning_scene, const planning_interface::MotionPlanRequest &req, const ChompParameters ¶ms, planning_interface::MotionPlanDetailedResponse &res) const
std::string getDescription() const override
Get a short string that identifies the planning request adapter.
bool adaptAndPlan(const PlannerFn &planner, const planning_scene::PlanningSceneConstPtr &ps, const planning_interface::MotionPlanRequest &req, planning_interface::MotionPlanResponse &res, std::vector< std::size_t > &) const override
Adapt the planning request if needed, call the planner function planner and update the planning respo...
void initialize(const rclcpp::Node::SharedPtr &node, const std::string &) override
Initialize parameters using the passed Node and parameter namespace. If no initialization is needed,...
static CollisionDetectorAllocatorPtr create()
std::function< bool(const planning_scene::PlanningSceneConstPtr &, const planning_interface::MotionPlanRequest &, planning_interface::MotionPlanResponse &)> PlannerFn
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest
Generic interface to adapting motion planning requests.
This namespace includes the central class for representing planning contexts.
moveit_msgs::msg::MoveItErrorCodes error_code_
std::vector< robot_trajectory::RobotTrajectoryPtr > trajectory_
std::vector< double > processing_time_
robot_trajectory::RobotTrajectoryPtr trajectory_
moveit_msgs::msg::MoveItErrorCodes error_code_