49 #include <warehouse_ros/database_loader.h>
50 #include <pluginlib/class_loader.hpp>
96 const std::string& robot_description_param =
"robot_description");
101 void initialize(
const std::vector<std::string>& plugin_classes);
110 virtual void clear();
140 std::vector<BenchmarkRequest>& queries);
144 std::vector<StartState>& start_states,
146 std::vector<PathConstraints>& goal_constraints,
147 std::vector<TrajectoryConstraints>& traj_constraints,
148 std::vector<BenchmarkRequest>& queries);
151 bool solved,
double total_time);
156 const std::vector<planning_interface::MotionPlanDetailedResponse>& responses,
157 const std::vector<bool>& solved);
172 const std::string& group_name);
176 const std::map<std::string, std::vector<std::string>>& planners);
179 bool loadPlanningScene(
const std::string& scene_name, moveit_msgs::msg::PlanningScene& scene_msg);
182 bool loadStates(
const std::string& regex, std::vector<StartState>& start_states);
185 bool loadPathConstraints(
const std::string& regex, std::vector<PathConstraints>& constraints);
191 bool loadQueries(
const std::string& regex,
const std::string& scene_name, std::vector<BenchmarkRequest>& queries);
196 std::vector<BenchmarkRequest>& combos);
200 const std::map<std::string, std::vector<std::string>>& planners,
int runs);
bool loadPlanningScene(const std::string &scene_name, moveit_msgs::msg::PlanningScene &scene_msg)
Load the planning scene with the given name from the warehouse.
void computeAveragePathSimilarities(PlannerBenchmarkData &planner_data, const std::vector< planning_interface::MotionPlanDetailedResponse > &responses, const std::vector< bool > &solved)
virtual bool runBenchmarks(const BenchmarkOptions &opts)
bool loadQueries(const std::string ®ex, const std::string &scene_name, std::vector< BenchmarkRequest > &queries)
Load all motion plan requests matching the given regular expression from the warehouse.
std::vector< PlannerRunData > PlannerBenchmarkData
Structure to hold information for a single planner's benchmark data.
virtual bool loadBenchmarkQueryData(const BenchmarkOptions &opts, moveit_msgs::msg::PlanningScene &scene_msg, std::vector< StartState > &start_states, std::vector< PathConstraints > &path_constraints, std::vector< PathConstraints > &goal_constraints, std::vector< TrajectoryConstraints > &traj_constraints, std::vector< BenchmarkRequest > &queries)
Initialize benchmark query data from start states and constraints.
void initialize(const std::vector< std::string > &plugin_classes)
rclcpp::Node::SharedPtr node_
planning_scene::PlanningScenePtr planning_scene_
moveit_warehouse::ConstraintsStorage * cs_
bool computeTrajectoryDistance(const robot_trajectory::RobotTrajectory &traj_first, const robot_trajectory::RobotTrajectory &traj_second, double &result_distance)
void addQueryStartEvent(const QueryStartEventFunction &func)
std::vector< PostRunEventFunction > post_event_fns_
std::vector< QueryCompletionEventFunction > query_end_fns_
moveit_warehouse::RobotStateStorage * rs_
bool plannerConfigurationsExist(const std::map< std::string, std::vector< std::string >> &planners, const std::string &group_name)
Check that the desired planner plugins and algorithms exist for the given group.
std::function< void(const moveit_msgs::msg::MotionPlanRequest &request, PlannerBenchmarkData &benchmark_data)> PlannerCompletionEventFunction
std::function< void(const moveit_msgs::msg::MotionPlanRequest &request, planning_scene::PlanningScenePtr)> QueryCompletionEventFunction
Definition of a query-end benchmark event function. Invoked after a query has finished benchmarking.
moveit_warehouse::PlanningSceneStorage * pss_
BenchmarkOptions options_
bool loadPathConstraints(const std::string ®ex, std::vector< PathConstraints > &constraints)
Load all constraints matching the given regular expression from the warehouse.
void addPreRunEvent(const PreRunEventFunction &func)
planning_scene_monitor::PlanningSceneMonitor * psm_
BenchmarkExecutor(const rclcpp::Node::SharedPtr &node, const std::string &robot_description_param="robot_description")
bool queriesAndPlannersCompatible(const std::vector< BenchmarkRequest > &requests, const std::map< std::string, std::vector< std::string >> &planners)
Check that the given requests can be run on the set of planner plugins and algorithms.
std::vector< PlannerBenchmarkData > benchmark_data_
virtual void collectMetrics(PlannerRunData &metrics, const planning_interface::MotionPlanDetailedResponse &mp_res, bool solved, double total_time)
std::map< std::string, planning_pipeline::PlanningPipelinePtr > planning_pipelines_
std::vector< QueryStartEventFunction > query_start_fns_
moveit_warehouse::TrajectoryConstraintsStorage * tcs_
void addPlannerCompletionEvent(const PlannerCompletionEventFunction &func)
void addPlannerStartEvent(const PlannerStartEventFunction &func)
void addQueryCompletionEvent(const QueryCompletionEventFunction &func)
bool loadStates(const std::string ®ex, std::vector< StartState > &start_states)
Load all states matching the given regular expression from the warehouse.
std::function< void(const moveit_msgs::msg::MotionPlanRequest &request, const planning_interface::MotionPlanDetailedResponse &response, PlannerRunData &run_data)> PostRunEventFunction
Definition of a post-run benchmark event function. Invoked immediately after each planner calls solve...
void runBenchmark(moveit_msgs::msg::MotionPlanRequest request, const std::map< std::string, std::vector< std::string >> &planners, int runs)
Execute the given motion plan request on the set of planners for the set number of runs.
std::function< void(moveit_msgs::msg::MotionPlanRequest &request)> PreRunEventFunction
Definition of a pre-run benchmark event function. Invoked immediately before each planner calls solve...
void createRequestCombinations(const BenchmarkRequest &brequest, const std::vector< StartState > &start_states, const std::vector< PathConstraints > &path_constraints, std::vector< BenchmarkRequest > &combos)
Duplicate the given benchmark request for all combinations of start states and path constraints.
moveit_warehouse::PlanningSceneWorldStorage * psws_
virtual void writeOutput(const BenchmarkRequest &brequest, const std::string &start_time, double benchmark_duration)
warehouse_ros::DatabaseLoader dbloader
std::vector< PlannerStartEventFunction > planner_start_fns_
virtual ~BenchmarkExecutor()
std::vector< PreRunEventFunction > pre_event_fns_
std::function< void(const moveit_msgs::msg::MotionPlanRequest &request, planning_scene::PlanningScenePtr)> QueryStartEventFunction
Definition of a query-start benchmark event function. Invoked before a new query is benchmarked.
virtual bool initializeBenchmarks(const BenchmarkOptions &opts, moveit_msgs::msg::PlanningScene &scene_msg, std::vector< BenchmarkRequest > &queries)
std::function< void(const moveit_msgs::msg::MotionPlanRequest &request, PlannerBenchmarkData &benchmark_data)> PlannerStartEventFunction
bool loadTrajectoryConstraints(const std::string ®ex, std::vector< TrajectoryConstraints > &constraints)
Load all trajectory constraints from the warehouse that match the given regular expression.
void addPostRunEvent(const PostRunEventFunction &func)
std::vector< PlannerCompletionEventFunction > planner_completion_fns_
void shiftConstraintsByOffset(moveit_msgs::msg::Constraints &constraints, const std::vector< double > &offset)
std::map< std::string, std::string > PlannerRunData
Structure to hold information for a single run of a planner.
PlanningSceneMonitor Subscribes to the topic planning_scene.
Maintain a sequence of waypoints and the time durations between these waypoints.
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest
moveit_msgs::msg::MotionPlanRequest request
std::vector< moveit_msgs::msg::Constraints > constraints
moveit_msgs::msg::RobotState state
moveit_msgs::msg::TrajectoryConstraints constraints