37 #ifndef MOVEIT_ROS_BENCHMARKS_BENCHMARK_EXECUTOR_ 38 #define MOVEIT_ROS_BENCHMARKS_BENCHMARK_EXECUTOR_ 56 #include <boost/function.hpp> 72 typedef boost::function<void(const moveit_msgs::MotionPlanRequest& request, planning_scene::PlanningScenePtr)>
76 typedef boost::function<void(const moveit_msgs::MotionPlanRequest& request, planning_scene::PlanningScenePtr)>
81 typedef boost::function<void(const moveit_msgs::MotionPlanRequest& request, PlannerBenchmarkData& benchmark_data)>
86 typedef boost::function<void(const moveit_msgs::MotionPlanRequest& request, PlannerBenchmarkData& benchmark_data)>
93 typedef boost::function<void(
const moveit_msgs::MotionPlanRequest& request,
95 PlannerRunData& run_data)>
98 BenchmarkExecutor(
const std::string& robot_description_param =
"robot_description");
103 void initialize(
const std::vector<std::string>& plugin_classes);
112 virtual void clear();
142 std::vector<BenchmarkRequest>& queries);
145 bool solved,
double total_time);
153 const std::string& group_name);
157 const std::map<std::string, std::vector<std::string>>& planners);
160 bool loadPlanningScene(
const std::string& scene_name, moveit_msgs::PlanningScene& scene_msg);
163 bool loadStates(
const std::string& regex, std::vector<StartState>& start_states);
166 bool loadPathConstraints(
const std::string& regex, std::vector<PathConstraints>& constraints);
172 bool loadQueries(
const std::string& regex,
const std::string& scene_name, std::vector<BenchmarkRequest>& queries);
176 const std::vector<PathConstraints>& path_constraints,
177 std::vector<BenchmarkRequest>& combos);
181 const std::map<std::string, std::vector<std::string>>& planners,
int runs);
moveit_msgs::TrajectoryConstraints constraints
BenchmarkExecutor(const std::string &robot_description_param="robot_description")
void addPostRunEvent(PostRunEventFunction func)
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_msgs::MotionPlanRequest request
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.
moveit_warehouse::PlanningSceneStorage * pss_
bool loadStates(const std::string ®ex, std::vector< StartState > &start_states)
Load all states matching the given regular expression from the warehouse.
planning_scene::PlanningScenePtr planning_scene_
warehouse_ros::DatabaseLoader dbloader
virtual void writeOutput(const BenchmarkRequest &brequest, const std::string &start_time, double benchmark_duration)
moveit_warehouse::TrajectoryConstraintsStorage * tcs_
void addPreRunEvent(PreRunEventFunction func)
std::vector< PreRunEventFunction > pre_event_fns_
virtual void collectMetrics(PlannerRunData &metrics, const planning_interface::MotionPlanDetailedResponse &mp_res, bool solved, double total_time)
boost::function< void(const moveit_msgs::MotionPlanRequest &request, PlannerBenchmarkData &benchmark_data)> PlannerCompletionEventFunction
BenchmarkOptions options_
std::vector< PlannerStartEventFunction > planner_start_fns_
void addQueryCompletionEvent(QueryCompletionEventFunction func)
virtual bool runBenchmarks(const BenchmarkOptions &opts)
std::shared_ptr< pluginlib::ClassLoader< planning_interface::PlannerManager > > planner_plugin_loader_
moveit_warehouse::ConstraintsStorage * cs_
void runBenchmark(moveit_msgs::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...
boost::function< void(const moveit_msgs::MotionPlanRequest &request, planning_scene::PlanningScenePtr)> QueryCompletionEventFunction
Definition of a query-end benchmark event function. Invoked after a query has finished benchmarking...
std::vector< PlannerCompletionEventFunction > planner_completion_fns_
moveit_msgs::RobotState state
bool loadPathConstraints(const std::string ®ex, std::vector< PathConstraints > &constraints)
Load all constraints matching the given regular expression from the warehouse.
std::map< std::string, std::string > PlannerRunData
Structure to hold information for a single run of a planner.
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.
planning_scene_monitor::PlanningSceneMonitor * psm_
std::vector< QueryCompletionEventFunction > query_end_fns_
void addPlannerCompletionEvent(PlannerCompletionEventFunction func)
bool loadTrajectoryConstraints(const std::string ®ex, std::vector< TrajectoryConstraints > &constraints)
Load all trajectory constraints from the warehouse that match the given regular expression.
boost::function< void(moveit_msgs::MotionPlanRequest &request)> PreRunEventFunction
Definition of a pre-run benchmark event function. Invoked immediately before each planner calls solve...
bool loadPlanningScene(const std::string &scene_name, moveit_msgs::PlanningScene &scene_msg)
Load the planning scene with the given name from the warehouse.
std::vector< QueryStartEventFunction > query_start_fns_
std::vector< moveit_msgs::Constraints > constraints
std::map< std::string, planning_interface::PlannerManagerPtr > planner_interfaces_
moveit_warehouse::PlanningSceneWorldStorage * psws_
void initialize(const std::vector< std::string > &plugin_classes)
virtual ~BenchmarkExecutor()
moveit_warehouse::RobotStateStorage * rs_
void addPlannerStartEvent(PlannerStartEventFunction func)
boost::function< void(const moveit_msgs::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...
std::vector< PlannerRunData > PlannerBenchmarkData
Structure to hold information for a single planner's benchmark data.
std::vector< PlannerBenchmarkData > benchmark_data_
boost::function< void(const moveit_msgs::MotionPlanRequest &request, PlannerBenchmarkData &benchmark_data)> PlannerStartEventFunction
virtual bool initializeBenchmarks(const BenchmarkOptions &opts, moveit_msgs::PlanningScene &scene_msg, std::vector< BenchmarkRequest > &queries)
void addQueryStartEvent(QueryStartEventFunction func)
void shiftConstraintsByOffset(moveit_msgs::Constraints &constraints, const std::vector< double > offset)
boost::function< void(const moveit_msgs::MotionPlanRequest &request, planning_scene::PlanningScenePtr)> QueryStartEventFunction
Definition of a query-start benchmark event function. Invoked before a new query is benchmarked...
std::vector< PostRunEventFunction > post_event_fns_
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.