13 #include <ompl/geometric/planners/est/EST.h>
14 #include <ompl/geometric/planners/kpiece/BKPIECE1.h>
15 #include <ompl/geometric/planners/kpiece/KPIECE1.h>
16 #include <ompl/geometric/planners/kpiece/LBKPIECE1.h>
17 #include <ompl/geometric/planners/prm/PRM.h>
18 #include <ompl/geometric/planners/rrt/RRT.h>
19 #include <ompl/geometric/planners/rrt/RRTConnect.h>
20 #include <ompl/geometric/planners/sbl/SBL.h>
21 #include <ompl/tools/benchmark/Benchmark.h>
22 #include <omplapp/apps/SE3RigidBodyPlanning.h>
23 #include <omplapp/config.h>
25 #include <ompl/base/samplers/BridgeTestValidStateSampler.h>
26 #include <ompl/base/samplers/GaussianValidStateSampler.h>
27 #include <ompl/base/samplers/MaximizeClearanceValidStateSampler.h>
28 #include <ompl/base/samplers/ObstacleBasedValidStateSampler.h>
29 #include <ompl/base/samplers/UniformValidStateSampler.h>
33 double &memory_limit,
int &run_count)
35 benchmark_name = std::string(
"cubicles");
36 std::string robot_fname = std::string(OMPLAPP_RESOURCE_DIR) +
"/3D/cubicles_robot.dae";
37 std::string env_fname = std::string(OMPLAPP_RESOURCE_DIR) +
"/3D/cubicles_env.dae";
38 setup.setRobotMesh(robot_fname);
39 setup.setEnvironmentMesh(env_fname);
45 start->rotation().setIdentity();
51 goal->rotation().setIdentity();
53 setup.setStartAndGoalStates(start, goal);
54 setup.getSpaceInformation()->setStateValidityCheckingResolution(0.01);
57 std::vector<double> cs(3);
61 setup.getStateSpace()->getDefaultProjection()->setCellSizes(cs);
64 memory_limit = 10000.0;
69 double &memory_limit,
int &run_count)
71 benchmark_name = std::string(
"Twistycool");
72 std::string robot_fname = std::string(OMPLAPP_RESOURCE_DIR) +
"/3D/Twistycool_robot.dae";
73 std::string env_fname = std::string(OMPLAPP_RESOURCE_DIR) +
"/3D/Twistycool_env.dae";
74 setup.setRobotMesh(robot_fname);
75 setup.setEnvironmentMesh(env_fname);
81 start->rotation().setIdentity();
87 goal->rotation().setIdentity();
90 bounds.setHigh(0, 350.);
91 bounds.setHigh(1, 250.);
92 bounds.setHigh(2, -150.);
93 bounds.setLow(0, 200.);
94 bounds.setLow(1, 75.);
95 bounds.setLow(2, -450.);
98 setup.setStartAndGoalStates(start, goal);
99 setup.getSpaceInformation()->setStateValidityCheckingResolution(0.01);
101 runtime_limit = 60.0;
102 memory_limit = 10000.0;
106 void preRunEvent(
const base::PlannerPtr & )
114 int main(
int argc,
char **argv)
117 std::string benchmark_name;
118 double runtime_limit, memory_limit;
120 int benchmark_id = argc > 1 ? ((argv[1][0] -
'0') % 2) : 0;
122 if (benchmark_id == 0)
123 benchmark0(benchmark_name, setup, runtime_limit, memory_limit, run_count);
125 benchmark1(benchmark_name, setup, runtime_limit, memory_limit, run_count);
132 b.setPreRunEvent([](
const base::PlannerPtr &planner) { preRunEvent(planner); });
136 b.addPlanner(std::make_shared<geometric::RRTConnect>(setup.getSpaceInformation()));
137 b.addPlanner(std::make_shared<geometric::RRT>(setup.getSpaceInformation()));
138 b.addPlanner(std::make_shared<geometric::BKPIECE1>(setup.getSpaceInformation()));
139 b.addPlanner(std::make_shared<geometric::LBKPIECE1>(setup.getSpaceInformation()));
140 b.addPlanner(std::make_shared<geometric::KPIECE1>(setup.getSpaceInformation()));
141 b.addPlanner(std::make_shared<geometric::SBL>(setup.getSpaceInformation()));
142 b.addPlanner(std::make_shared<geometric::EST>(setup.getSpaceInformation()));
143 b.addPlanner(std::make_shared<geometric::PRM>(setup.getSpaceInformation()));
145 int sampler_id = argc > 2 ? ((argv[2][0] -
'0') % 5) : -1;
147 if (sampler_id == 0 || sampler_id < 0)
150 setup.getSpaceInformation()->setValidStateSamplerAllocator(
152 return std::make_shared<base::UniformValidStateSampler>(si);
154 b.addExperimentParameter(
"sampler_id",
"INTEGER",
"0");
155 b.benchmark(request);
156 b.saveResultsToFile();
159 if (sampler_id == 1 || sampler_id < 0)
162 setup.getSpaceInformation()->setValidStateSamplerAllocator(
164 return std::make_shared<base::GaussianValidStateSampler>(si);
166 b.addExperimentParameter(
"sampler_id",
"INTEGER",
"1");
167 b.benchmark(request);
168 b.saveResultsToFile();
171 if (sampler_id == 2 || sampler_id < 0)
174 setup.getSpaceInformation()->setValidStateSamplerAllocator(
176 return std::make_shared<base::ObstacleBasedValidStateSampler>(si);
178 b.addExperimentParameter(
"sampler_id",
"INTEGER",
"2");
179 b.benchmark(request);
180 b.saveResultsToFile();
183 if (sampler_id == 3 || sampler_id < 0)
186 setup.getSpaceInformation()->setValidStateSamplerAllocator(
188 auto vss = std::make_shared<base::MaximizeClearanceValidStateSampler>(si);
189 vss->setNrImproveAttempts(5);
192 b.addExperimentParameter(
"sampler_id",
"INTEGER",
"3");
193 b.benchmark(request);
194 b.saveResultsToFile();
197 if (sampler_id == 4 || sampler_id < 0)
200 setup.getSpaceInformation()->setValidStateSamplerAllocator(
202 return std::make_shared<base::BridgeTestValidStateSampler>(si);
204 b.addExperimentParameter(
"sampler_id",
"INTEGER",
"4");
205 b.benchmark(request);
206 b.saveResultsToFile();