From: Mark M. <mm...@ri...> - 2019-12-27 03:21:45
|
Hi Hadar, You can use a post-run event to save a path after each run of planner: ofstream myfile; b.addPlanner(std::make_shared<control::RRT>(setup.getSpaceInformation())); b.addPlanner(std::make_shared<control::KPIECE1>(setup.getSpaceInformation())); b.setPostRunEvent( [](const ompl::base::PlannerPtr &planner, ompl::tools::Benchmark::RunProperties &properties) { auto solution = planner->getProblemDefinition()->getSolutionPath(); // insert code here to save path to file ... }); b.benchmark(request); ... Best, Mark > On Dec 25, 2019, at 2:01 AM, hadar sinvani <had...@gm...> wrote: > > Hi, > I'm interested in saving all the solution paths. > I managed to do this very easily when running ompl benchmark with my config file but I couldnt find how to do so when writing a benchmark code. > > writing this: > ofstream myfile; > b.addPlanner(std::make_shared<control::RRT>(setup.getSpaceInformation())); > b.addPlanner(std::make_shared<control::KPIECE1>(setup.getSpaceInformation())); > b.benchmark(request); > myfile.open ("mypathB.txt", ios::out | ios::app | ios::binary); > setup.getSolutionPath().asGeometric().printAsMatrix(myfile); > myfile.close(); > b.saveResultsToFile(); > > saved only the only one path instead of the two that was found. In addition, when analyzing the log file, I didnt find any saved path. > > I would appreciate your help. > Best, Hadar. > > _______________________________________________ > ompl-users mailing list > omp...@li... > https://lists.sourceforge.net/lists/listinfo/ompl-users |