Robowflex  v0.1
Making MoveIt Easy
fetch_ompl_scenes_benchmark.cpp
Go to the documentation of this file.
1 /* Author: Constantinos Chamzas, Zachary Kingston */
2 
11 #include <robowflex_library/util.h>
12 
14 
15 using namespace robowflex;
16 
17 static const std::string GROUP = "arm_with_torso";
18 
19 int main(int argc, char **argv)
20 {
21  // Startup ROS
22  ROS ros(argc, argv);
23 
24  // Create the default Fetch robot.
25  auto fetch = std::make_shared<FetchRobot>();
26 
27  // Do not add the virtual joint since the real robot does not have one.
28  fetch->initialize(false);
29 
30  // Setup a benchmarking request for the joint and pose motion plan requests.
31  Profiler::Options options;
33  Experiment experiment("fetch_scenes", options, 30.0, 2);
34 
35  const std::size_t start = 1;
36  const std::size_t end = 10;
37  for (std::size_t i = start; i <= end; i++)
38  {
39  const auto &scene_file =
40  log::format("package://robowflex_library/yaml/fetch_scenes/scene_vicon%1$04d.yaml", i);
41  const auto &request_file =
42  log::format("package://robowflex_library/yaml/fetch_scenes/request%1$04d.yaml", i);
43 
44  // Create an empty Scene.
45  auto scene = std::make_shared<Scene>(fetch);
46  if (not scene->fromYAMLFile(scene_file))
47  {
48  RBX_ERROR("Failed to read file: %s for scene", scene_file);
49  continue;
50  }
51 
52  // Create the default planner for the Fetch.
53  auto planner = std::make_shared<OMPL::FetchOMPLPipelinePlanner>(fetch);
54  planner->initialize();
55 
56  // Create an empty motion planning request.
57  auto request = std::make_shared<robowflex::MotionRequestBuilder>(planner, GROUP);
58  if (not request->fromYAMLFile(request_file))
59  {
60  RBX_ERROR("Failed to read file: %s for request", request_file);
61  continue;
62  }
63 
64  request->setConfig("PRMstar");
65 
66  // Add request
67  experiment.addQuery(log::format("scene%1$04d", i), scene, planner, request);
68  }
69 
70  auto dataset = experiment.benchmark(1);
71 
72  OMPLPlanDataSetOutputter output("robowflex_fetch_scenes_ompl");
73  output.dump(*dataset);
74 
75  return 0;
76 }
A helper class for benchmarking that controls running multiple queries.
Definition: benchmarking.h:349
PlanDataSetPtr benchmark(std::size_t n_threads=1) const
Run benchmarking on this experiment. Note that, for some planners, multiple threads cannot be used wi...
void addQuery(const std::string &planner_name, const SceneConstPtr &scene, const PlannerPtr &planner, const planning_interface::MotionPlanRequest &request)
Add a query to the experiment for profiling.
Benchmark outputter that saves results into OMPL benchmarking log files. If ompl_benchmark_statistics...
Definition: benchmarking.h:572
void dump(const PlanDataSet &results) override
Dumps results into a OMPL benchmarking log file in prefix_ named after the request name_.
@ WAYPOINTS
Number of waypoints in path.
Definition: benchmarking.h:210
@ CORRECT
Is the path correct (no collisions?).
Definition: benchmarking.h:211
@ LENGTH
Length of the path.
Definition: benchmarking.h:212
RAII-pattern for starting up ROS.
Definition: util.h:52
int main(int argc, char **argv)
static const std::string GROUP
#define RBX_ERROR(fmt,...)
Output a error logging message.
Definition: log.h:102
std::string format(const std::string &fmt, Args &&... args)
Recursion base case, return string form of formatted arguments.
Definition: log.h:60
Main namespace. Contains all library classes and functions.
Definition: scene.cpp:25
Functions for loading and animating scenes in Blender.
Options for profiling.
Definition: benchmarking.h:220
uint32_t metrics
Bitmask of which metrics to compute after planning.
Definition: benchmarking.h:221