28#include <warehouse_ros/message_collection.h>
30#include <moveit_msgs/msg/motion_plan_request.hpp>
31#include <moveit_msgs/msg/robot_trajectory.hpp>
32#include <moveit_msgs/srv/get_cartesian_path.hpp>
39namespace trajectory_cache
91 moveit::planning_interface::MoveGroupInterface::Plan,
92 moveit_msgs::msg::RobotTrajectory>
96 static std::vector<std::unique_ptr<FeaturesInterface<moveit_msgs::msg::MotionPlanRequest>>>
101 std::string
getName()
const override;
105 const warehouse_ros::MessageCollection<moveit_msgs::msg::RobotTrajectory>& coll,
106 const moveit_msgs::msg::MotionPlanRequest& key,
109 std::vector<warehouse_ros::MessageWithMetadata<moveit_msgs::msg::RobotTrajectory>::ConstPtr>
111 const warehouse_ros::MessageCollection<moveit_msgs::msg::RobotTrajectory>& coll,
112 const moveit_msgs::msg::MotionPlanRequest& key,
114 double exact_match_precision)
override;
119 const warehouse_ros::MessageWithMetadata<moveit_msgs::msg::RobotTrajectory>::ConstPtr& matching_entry,
120 std::string* reason =
nullptr)
override;
123 const moveit_msgs::msg::MotionPlanRequest& key,
125 std::string* reason =
nullptr)
override;
130 const moveit_msgs::msg::MotionPlanRequest& key,
133 void reset()
override;
136 const std::string name_;
137 std::vector<std::unique_ptr<FeaturesInterface<moveit_msgs::msg::MotionPlanRequest>>> exact_matching_supported_features_;
139 double best_seen_execution_time_;
196 moveit_msgs::srv::GetCartesianPath::Response, moveit_msgs::msg::RobotTrajectory>
200 static std::vector<std::unique_ptr<FeaturesInterface<moveit_msgs::srv::GetCartesianPath::Request>>>
205 std::string
getName()
const override;
209 const warehouse_ros::MessageCollection<moveit_msgs::msg::RobotTrajectory>& coll,
210 const moveit_msgs::srv::GetCartesianPath::Request& key,
211 const moveit_msgs::srv::GetCartesianPath::Response& value)
override;
213 std::vector<warehouse_ros::MessageWithMetadata<moveit_msgs::msg::RobotTrajectory>::ConstPtr>
215 const warehouse_ros::MessageCollection<moveit_msgs::msg::RobotTrajectory>& coll,
216 const moveit_msgs::srv::GetCartesianPath::Request& key,
217 const moveit_msgs::srv::GetCartesianPath::Response& value,
218 double exact_match_precision)
override;
222 const moveit_msgs::srv::GetCartesianPath::Request& key,
const moveit_msgs::srv::GetCartesianPath::Response& value,
223 const warehouse_ros::MessageWithMetadata<moveit_msgs::msg::RobotTrajectory>::ConstPtr& matching_entry,
224 std::string* reason =
nullptr)
override;
227 const moveit_msgs::srv::GetCartesianPath::Request& key,
228 const moveit_msgs::srv::GetCartesianPath::Response& value, std::string* reason =
nullptr)
override;
232 const moveit_msgs::srv::GetCartesianPath::Request& key,
233 const moveit_msgs::srv::GetCartesianPath::Response& value)
override;
235 void reset()
override;
238 const std::string name_;
239 std::vector<std::unique_ptr<FeaturesInterface<moveit_msgs::srv::GetCartesianPath::Request>>>
240 exact_matching_supported_features_;
242 double best_seen_execution_time_;
Abstract template class for injecting logic for determining when to prune and insert a cache entry,...
a wrapper around moveit_msgs::MoveItErrorCodes to make it easier to return an error code message from...
Client class to conveniently use the ROS interfaces provided by the move_group node.
A cache insertion policy that only decides to insert if the motion plan is the one with the shortest ...
std::string getName() const override
Gets the name of the cache insert policy.
moveit::core::MoveItErrorCode appendInsertMetadata(warehouse_ros::Metadata &metadata, const moveit::planning_interface::MoveGroupInterface &move_group, const moveit_msgs::msg::MotionPlanRequest &key, const moveit::planning_interface::MoveGroupInterface::Plan &value) override
Appends the insert metadata with the features supported by the policy.
moveit::core::MoveItErrorCode checkCacheInsertInputs(const moveit::planning_interface::MoveGroupInterface &move_group, const warehouse_ros::MessageCollection< moveit_msgs::msg::RobotTrajectory > &coll, const moveit_msgs::msg::MotionPlanRequest &key, const moveit::planning_interface::MoveGroupInterface::Plan &value) override
Checks inputs to the cache insert call to see if we should abort instead.
static std::vector< std::unique_ptr< FeaturesInterface< moveit_msgs::msg::MotionPlanRequest > > > getSupportedFeatures(double start_tolerance, double goal_tolerance)
Configures and returns a vector of feature extractors that can be used with this policy.
BestSeenExecutionTimePolicy()
void reset() override
Resets the state of the policy.
bool shouldInsert(const moveit::planning_interface::MoveGroupInterface &move_group, const moveit_msgs::msg::MotionPlanRequest &key, const moveit::planning_interface::MoveGroupInterface::Plan &value, std::string *reason=nullptr) override
Returns whether the insertion candidate should be inserted into the cache.
std::vector< warehouse_ros::MessageWithMetadata< moveit_msgs::msg::RobotTrajectory >::ConstPtr > fetchMatchingEntries(const moveit::planning_interface::MoveGroupInterface &move_group, const warehouse_ros::MessageCollection< moveit_msgs::msg::RobotTrajectory > &coll, const moveit_msgs::msg::MotionPlanRequest &key, const moveit::planning_interface::MoveGroupInterface::Plan &value, double exact_match_precision) override
Fetches all "matching" cache entries for comparison for pruning.
bool shouldPruneMatchingEntry(const moveit::planning_interface::MoveGroupInterface &move_group, const moveit_msgs::msg::MotionPlanRequest &key, const moveit::planning_interface::MoveGroupInterface::Plan &value, const warehouse_ros::MessageWithMetadata< moveit_msgs::msg::RobotTrajectory >::ConstPtr &matching_entry, std::string *reason=nullptr) override
A cache insertion policy that only decides to insert if the motion plan is the one with the shortest ...
moveit::core::MoveItErrorCode appendInsertMetadata(warehouse_ros::Metadata &metadata, const moveit::planning_interface::MoveGroupInterface &move_group, const moveit_msgs::srv::GetCartesianPath::Request &key, const moveit_msgs::srv::GetCartesianPath::Response &value) override
Appends the insert metadata with the features supported by the policy.
void reset() override
Resets the state of the policy.
CartesianBestSeenExecutionTimePolicy()
static std::vector< std::unique_ptr< FeaturesInterface< moveit_msgs::srv::GetCartesianPath::Request > > > getSupportedFeatures(double start_tolerance, double goal_tolerance, double min_fraction)
Configures and returns a vector of feature extractors that can be used with this policy.
moveit::core::MoveItErrorCode checkCacheInsertInputs(const moveit::planning_interface::MoveGroupInterface &move_group, const warehouse_ros::MessageCollection< moveit_msgs::msg::RobotTrajectory > &coll, const moveit_msgs::srv::GetCartesianPath::Request &key, const moveit_msgs::srv::GetCartesianPath::Response &value) override
Checks inputs to the cache insert call to see if we should abort instead.
std::vector< warehouse_ros::MessageWithMetadata< moveit_msgs::msg::RobotTrajectory >::ConstPtr > fetchMatchingEntries(const moveit::planning_interface::MoveGroupInterface &move_group, const warehouse_ros::MessageCollection< moveit_msgs::msg::RobotTrajectory > &coll, const moveit_msgs::srv::GetCartesianPath::Request &key, const moveit_msgs::srv::GetCartesianPath::Response &value, double exact_match_precision) override
Fetches all "matching" cache entries for comparison for pruning.
std::string getName() const override
Gets the name of the cache insert policy.
bool shouldInsert(const moveit::planning_interface::MoveGroupInterface &move_group, const moveit_msgs::srv::GetCartesianPath::Request &key, const moveit_msgs::srv::GetCartesianPath::Response &value, std::string *reason=nullptr) override
Returns whether the insertion candidate should be inserted into the cache.
bool shouldPruneMatchingEntry(const moveit::planning_interface::MoveGroupInterface &move_group, const moveit_msgs::srv::GetCartesianPath::Request &key, const moveit_msgs::srv::GetCartesianPath::Response &value, const warehouse_ros::MessageWithMetadata< moveit_msgs::msg::RobotTrajectory >::ConstPtr &matching_entry, std::string *reason=nullptr) override
Abstract template class for extracting features from some FeatureSourceT.
The representation of a motion plan (as ROS messages)