Robowflex  v0.1
Making MoveIt Easy
ur5_benchmark.cpp
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
9 
10 using namespace robowflex;
11 
12 /* \file ur5_benchmark.cpp
13  * A basic script that demonstrates benchmarking with the UR5 robot.
14  * Benchmarking output is saved in the OMPL format. See
15  * https://ompl.kavrakilab.org/benchmark.html for more information on the
16  * benchmark data format and how to use. http://plannerarena.org/ can be used to
17  * visualize results.
18  */
19 
20 int main(int argc, char **argv)
21 {
22  // Startup ROS
23  ROS ros(argc, argv);
24 
25  // Create the default UR5 robot.
26  auto ur5 = std::make_shared<UR5Robot>();
27  ur5->initialize();
28 
29  // Create an empty scene.
30  auto scene = std::make_shared<Scene>(ur5);
31 
32  // Create the default planner for the UR5.
33  auto planner = std::make_shared<OMPL::UR5OMPLPipelinePlanner>(ur5);
34  planner->initialize();
35 
36  // Create a motion planning request with a joint position goal.
37  MotionRequestBuilderPtr joint_request(new MotionRequestBuilder(planner, "manipulator"));
38  joint_request->setStartConfiguration({0.0677, -0.8235, 0.9860, -0.1624, 0.0678, 0.0});
39  joint_request->setGoalConfiguration({-0.39, -0.69, -2.12, 2.82, -0.39, 0});
40 
41  // Create a motion planning request with a pose goal.
42  MotionRequestBuilderPtr pose_request(new MotionRequestBuilder(planner, "manipulator"));
43  pose_request->setStartConfiguration({0.0677, -0.8235, 0.9860, -0.1624, 0.0678, 0.0});
44 
45  RobotPose pose = RobotPose::Identity();
46  pose.translate(Eigen::Vector3d{-0.268, -0.826, 1.313});
47  Eigen::Quaterniond orn{0, 0, 1, 0};
48 
49  pose_request->setGoalRegion("ee_link", "world", // links
50  pose, Geometry::makeSphere(0.1), // position
51  orn, {0.01, 0.01, 0.01} // orientation
52  );
53 
54  Profiler::Options options;
55  Experiment experiment("ur5_demo", // Name of experiment
56  options, // Options for internal profiler
57  5.0, // Timeout allowed for ALL queries
58  50); // Number of trials
59 
60  experiment.addQuery("joint", scene, planner, joint_request);
61  experiment.addQuery("pose", scene, planner, pose_request);
62 
63  auto dataset = experiment.benchmark(4);
64 
65  OMPLPlanDataSetOutputter output("robowflex_ur5_demo");
66  output.dump(*dataset);
67 
68  return 0;
69 }
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.
static GeometryPtr makeSphere(double radius)
Create a sphere.
Definition: geometry.cpp:43
A shared pointer wrapper for robowflex::MotionRequestBuilder.
A helper class to build motion planning requests for a robowflex::Planner.
Definition: builder.h:34
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_.
RAII-pattern for starting up ROS.
Definition: util.h:52
Main namespace. Contains all library classes and functions.
Definition: scene.cpp:25
std::decay< decltype(std::declval< moveit::core::Transforms >().getTransform("")) >::type RobotPose
A pose (point in SE(3)) used in various functions. Defined from what MoveIt! uses.
Definition: adapter.h:24
Functions for loading and animating scenes in Blender.
Options for profiling.
Definition: benchmarking.h:220
int main(int argc, char **argv)