fmrico / popf

The POPF planner from KCL planning group with some modifications to make it work with "modern" compilers...
GNU General Public License v2.0
17 stars 9 forks source link

Use popf as library #4

Closed fmrico closed 4 years ago

fmrico commented 4 years ago

Hi @marc-hanheide

This PR is for using popf as a library. Probably this PR can not be accepted as is, but it can push forward this development. We can refine this PR with your comments.

These changes are for ROS2. Maybe it should be in another branch.

Until now, it only could be used through the executable popf. The goal of this PR is using popf as a library too. Now, I can do:

std::ifstream domain_ifs("/home/fmrico/ros/ros2/planning_ws/domain_simple.pddl");
std::string domain_str((std::istreambuf_iterator<char>(domain_ifs)), std::istreambuf_iterator<char>());

std::ifstream problem_ifs("/home/fmrico/ros/ros2/planning_ws/problem_simple_1.pddl"); 
std::string problem_str((std::istreambuf_iterator<char>(problem_ifs)), std::istreambuf_iterator<char>());

Popf planner_();
auto plan = planner_.solve(domain_str, problem_str);

if (!plan.empty()) {
  for (const auto & action : plan) {
    std::cout << "------> " << action.time << ": " <<
    action.action << "[" << action.duration << "]" << std::endl;
  }
} else {
  std::cerr << "Plan unsolvable" << std::endl;
} 

Best

Signed-off-by: Francisco Martin Rico fmrico@gmail.com

marc-hanheide commented 4 years ago

@fmrico thanks for this. I have to admit I haven't been actively using or maintaining this in ages. Maybe it would be best if I tranfer the "maintainership" to you? Happy to transfer ownership of this repository to you (and then fork back if needed)?

fmrico commented 4 years ago

Hi @marc-hanheide,

When you proposed transfer repo, my early opinion would be more convenient than the maintainer was someone who works on planning.

I use planning in my robot systems, but I don't develop planning algorithms.

After thinking about it these days, I believe there are good reasons to accept your invitation. I want popf to be the reference in my planning system. If the community starts using my system, planning experts may be attracted to contribute to popf. I could give it a push to be included as a package in the ROS2 distribution. That would solve my dependence on it.

Summarizing, I would be happy to receive ownership of this repository if you consider it still positive.

Best

marc-hanheide commented 4 years ago

Ok, cool. I think it's best if you take ownership in this case. But I can do the transfer at the moment (just tried) because:

The target account must not have a repository with the same name, or a fork in the same network.

So, you'd have to remove your fork temporarily. Hence, I'll first accept your PR now and then you'll have to remove the fork. After that, ping me and I'll do the transfer.

fmrico commented 4 years ago

Hi @marc-hanheide ,

I have just removed my fork

marc-hanheide commented 4 years ago

I have requested the transfer now. You should have an email.