Robowflex
v0.1
Making MoveIt Easy
|
#include <benchmarking.h>
Classes | |
struct | Options |
Options for profiling. More... | |
Public Types | |
enum | Metrics { WAYPOINTS = 1 << 0 , CORRECT = 1 << 1 , LENGTH = 1 << 2 , CLEARANCE = 1 << 3 , SMOOTHNESS = 1 << 4 } |
Bitmask options to select what metrics to compute for each run. More... | |
using | ComputeMetricCallback = std::function< PlannerMetric(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request, const PlanData &run)> |
Type for callback function that returns a metric over the results of a planning query. More... | |
using | ProgressPropertyAllocator = std::function< Planner::ProgressProperty(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request)> |
Allocator function that returns a planner progress property function for the current planning request. More... | |
using | ProgressCallback = std::function< void(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request, const PlanData &result)> |
Type for callback function that is called in the planner progress property loop. More... | |
using | ProgressCallbackAllocator = std::function< ProgressCallback(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request)> |
Allocator function that returns a progress property callback function for the current planning request. More... | |
Public Member Functions | |
bool | profilePlan (const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request, const Options &options, PlanData &result) const |
Profiling a single plan using a planner. More... | |
void | addMetricCallback (const std::string &name, const ComputeMetricCallback &metric) |
Add a callback function to compute a metric at the end of planning. More... | |
void | addProgressAllocator (const std::string &name, const ProgressPropertyAllocator &allocator) |
Add a function that allocates a function that returns a planner progress property function. More... | |
void | addProgressCallback (const ProgressCallback &callback) |
Add a function that is called in the planner progress property loop. More... | |
void | addProgressCallbackAllocator (const ProgressCallbackAllocator &allocator) |
Add a function that is called in the planner progress property loop. More... | |
Private Member Functions | |
void | computeBuiltinMetrics (uint32_t options, const SceneConstPtr &scene, PlanData &run) const |
Compute the built-in metrics according to the provided bitmask options. More... | |
void | computeCallbackMetrics (const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request, PlanData &run) const |
Compute the custom user callback metrics. More... | |
Private Attributes | |
std::map< std::string, ComputeMetricCallback > | callbacks_ |
User callback metrics. More... | |
std::map< std::string, ProgressPropertyAllocator > | prog_allocators_ |
User progress properties. More... | |
std::vector< ProgressCallback > | prog_callbacks_ |
User progress callback functions. More... | |
std::vector< ProgressCallbackAllocator > | prog_callback_allocators_ |
Definition at line 203 of file benchmarking.h.
using robowflex::Profiler::ComputeMetricCallback = std::function<PlannerMetric(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request, const PlanData &run)> |
Type for callback function that returns a metric over the results of a planning query.
[in] | planner | The planner being profiled. |
[in] | scene | The scene used for planning. |
[in] | request | The planning request. |
[in] | run | The results of the planning run, including prior computed metrics. |
Definition at line 234 of file benchmarking.h.
using robowflex::Profiler::ProgressCallback = std::function<void(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request, const PlanData &result)> |
Type for callback function that is called in the planner progress property loop.
[in] | planner | The planner being profiled. |
[in] | scene | The scene used for planning. |
[in] | request | The planning request. |
[in] | run | The results of the planning run, including prior computed metrics. |
Definition at line 258 of file benchmarking.h.
using robowflex::Profiler::ProgressCallbackAllocator = std::function<ProgressCallback(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request)> |
Allocator function that returns a progress property callback function for the current planning request.
[in] | planner | The planner being profiled. |
[in] | scene | The scene used for planning. |
[in] | request | The planning request. |
Definition at line 270 of file benchmarking.h.
using robowflex::Profiler::ProgressPropertyAllocator = std::function<Planner::ProgressProperty(const PlannerPtr &planner, const SceneConstPtr &scene, const planning_interface::MotionPlanRequest &request)> |
Allocator function that returns a planner progress property function for the current planning request.
[in] | planner | The planner being profiled. |
[in] | scene | The scene used for planning. |
[in] | request | The planning request. |
Definition at line 247 of file benchmarking.h.
Bitmask options to select what metrics to compute for each run.
Enumerator | |
---|---|
WAYPOINTS | Number of waypoints in path. |
CORRECT | Is the path correct (no collisions?). |
LENGTH | Length of the path. |
CLEARANCE | Clearance of path from obstacles. |
SMOOTHNESS | Smoothness of path. |
Definition at line 208 of file benchmarking.h.
void Profiler::addMetricCallback | ( | const std::string & | name, |
const ComputeMetricCallback & | metric | ||
) |
Add a callback function to compute a metric at the end of planning.
[in] | name | Name of the metric. |
[in] | metric | Function to use for callback. |
Definition at line 245 of file benchmarking.cpp.
void Profiler::addProgressAllocator | ( | const std::string & | name, |
const ProgressPropertyAllocator & | allocator | ||
) |
Add a function that allocates a function that returns a planner progress property function.
[in] | name | Name of the planner progress property. |
[in] | allocator | Allocator function. |
Definition at line 250 of file benchmarking.cpp.
void Profiler::addProgressCallback | ( | const ProgressCallback & | callback | ) |
Add a function that is called in the planner progress property loop.
[in] | callback | Callback function to add. |
Definition at line 255 of file benchmarking.cpp.
void Profiler::addProgressCallbackAllocator | ( | const ProgressCallbackAllocator & | allocator | ) |
Add a function that is called in the planner progress property loop.
[in] | callback | Callback function to add. |
Definition at line 260 of file benchmarking.cpp.
|
private |
Compute the built-in metrics according to the provided bitmask options.
[in] | options | Bitmask of which built-in metrics to compute. |
[in] | scene | Scene used for planning and metric computation. |
[out] | run | Metric results. |
Definition at line 265 of file benchmarking.cpp.
|
private |
Compute the custom user callback metrics.
[in] | planner | Planner used. |
[in] | scene | Scene used for planning. |
[in] | request | Planning request. |
[out] | run | Metric results. |
Definition at line 295 of file benchmarking.cpp.
bool Profiler::profilePlan | ( | const PlannerPtr & | planner, |
const SceneConstPtr & | scene, | ||
const planning_interface::MotionPlanRequest & | request, | ||
const Options & | options, | ||
PlanData & | result | ||
) | const |
Profiling a single plan using a planner.
[in] | planner | Planner to profile. |
[in] | scene | Scene to plan in. |
[in] | request | Planning request to profile. |
[in] | options | The options for profiling. |
[out] | result | The results of profiling. |
Definition at line 137 of file benchmarking.cpp.
|
private |
User callback metrics.
Definition at line 330 of file benchmarking.h.
|
private |
User progress properties.
Definition at line 331 of file benchmarking.h.
|
private |
User progress callback function allocators.
Definition at line 333 of file benchmarking.h.
|
private |
User progress callback functions.
Definition at line 332 of file benchmarking.h.