37 #include "KinematicChain.h"
39 int main(
int argc,
char **argv)
43 std::cout <<
"Usage:\n" << argv[0] <<
" <num_links>\n";
47 auto numLinks = std::stoul(argv[1]);
48 Environment env = createHornEnvironment(numLinks,
log((
double)numLinks) / (
double)numLinks);
49 auto chain(std::make_shared<KinematicChainSpace>(numLinks, 1. / (
double)numLinks, &env));
52 ss.setStateValidityChecker(std::make_shared<KinematicChainValidityChecker>(ss.getSpaceInformation()));
55 std::vector<double> startVec(numLinks, boost::math::constants::pi<double>() / (
double)numLinks);
56 std::vector<double> goalVec(numLinks, 0);
59 goalVec[0] = boost::math::constants::pi<double>() - .001;
61 chain->copyFromReals(start.get(), startVec);
62 chain->copyFromReals(goal.get(), goalVec);
63 ss.setStartAndGoalStates(start, goal);
70 ss.setPlanner(std::make_shared<ompl::geometric::STRIDE>(ss.getSpaceInformation()));
74 ss.simplifySolution();
76 std::ofstream pathfile(boost::str(boost::format(
"kinematic_path_%i.dat") % numLinks).c_str());
77 ss.getSolutionPath().printAsMatrix(pathfile);
82 double runtime_limit = 60, memory_limit = 1024;
86 b.addExperimentParameter(
"num_links",
"INTEGER", std::to_string(numLinks));
88 b.addPlanner(std::make_shared<ompl::geometric::STRIDE>(ss.getSpaceInformation()));
89 b.addPlanner(std::make_shared<ompl::geometric::EST>(ss.getSpaceInformation()));
90 b.addPlanner(std::make_shared<ompl::geometric::KPIECE1>(ss.getSpaceInformation()));
91 b.addPlanner(std::make_shared<ompl::geometric::RRT>(ss.getSpaceInformation()));
92 b.addPlanner(std::make_shared<ompl::geometric::PRM>(ss.getSpaceInformation()));
94 b.saveResultsToFile(boost::str(boost::format(
"kinematic_%i.log") % numLinks).c_str());