Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues runing TFD with plansys2 #7

Open
RicardoM17 opened this issue Aug 2, 2021 · 11 comments
Open

Issues runing TFD with plansys2 #7

RicardoM17 opened this issue Aug 2, 2021 · 11 comments

Comments

@RicardoM17
Copy link

Hi @fmrico

I'm having some issues getting TFD to work with plansys2, for example with the BT example explained here.

I cloned this repository alonside the popf folder, i.e. inside ROS2 Planning System repo, contrary to what is indicated in the Build and Install instructions on the webpage as it seems that is what is supposed to be done and it gives an error otherwise but I'm not 100% sure. I also need to checkout this branch in order to compile it (which it does so sucessfully) #6

I then edited the PlannerNode.cpp file to load the TFD instead of POPF but without any luck, as when I call the get plan via the plansys2 terminal I get quite a few errors regarding missing files. It compiles and the solver is loaded sucessfully at start but not when I use the get plan.

I believe I installed TFD correctly but steps 1 and 2 of the README don't work in a first try so I installed it on a different folder. There are also some error messages but it finishes the process.

@fmrico Can you please provide me with the instructions on how to integrate TFD with plansys2 and if I am doing something incorrectly? I can then try to find the time to update the docs and/or code on that regard and it would be helpful for my end as well.

For the record I'm using Ubuntu 20.04 LTS with ROS2 Galactic.

@fmrico
Copy link
Contributor

fmrico commented Aug 3, 2021

Hi @RicardoM17

  1. Install TFD and set TFD_HOME to ${wherever_it_is}/tfd-src-0.4/downward
  2. Include the plugin in the workspace
  3. Set TFD to be the planner changing plansys2_bring_up/params/plansys2_params.yaml:
planner:
  ros__parameters:
    plan_solver_plugins: ["TFD"]
    POPF:
      plugin: "plansys2/POPFPlanSolver"
    TFD:
      plugin: "plansys2/TFDPlanSolver"

Let me know if this works for you. I have just checked it on my computer.

Best

@RicardoM17
Copy link
Author

RicardoM17 commented Aug 3, 2021

Hi @RicardoM17

1. Install TFD and set TFD_HOME to `${wherever_it_is}/tfd-src-0.4/downward`

2. Include the [plugin](https://github.com/intelligentRoboticsLabs/plansys2_tfd_plan_solver) in the workspace

3. Set TFD to be the planner changing `plansys2_bring_up/params/plansys2_params.yaml`:
planner:
  ros__parameters:
    plan_solver_plugins: ["TFD"]
    POPF:
      plugin: "plansys2/POPFPlanSolver"
    TFD:
      plugin: "plansys2/TFDPlanSolver"

Let me know if this works for you. I have just checked it on my computer.

Best

Thanks @fmrico !

That .yaml change is better than what I was doing. I hacked the PlannerNode.cpp like I said but this makes more sense.

It seems that I have everything setup correctly but I believe I have some issue with the Python version, as when I get plan on the terminal I get

[plansys2_node-1]   File "/home/ricardom/Downloads/tfd-src-0.4/downward/translate/translate.py", line 167
[plansys2_node-1]     print "Atom not in dictionary: ", fact.dump()
[plansys2_node-1]           ^
[plansys2_node-1] SyntaxError: invalid syntax

I already tried changing all the print statements in that file but it keeps getting other errors.

I'll try to debug it in the meantime but if you have the right command or a more specific idea of what this might be let me know :)

Edit: Changing the system default Python version to 2.7 worked, but if you have a better way I'm all ears :)

@fmrico
Copy link
Contributor

fmrico commented Aug 22, 2021

Hi @RicardoM17

I have the same line, and it is working with Python 3.8.10 😕

@RicardoM17
Copy link
Author

Hi @RicardoM17

I have the same line, and it is working with Python 3.8.10 confused

which line are you reffering to?

@fmrico
Copy link
Contributor

fmrico commented Aug 26, 2021

which line are you reffering to?

This:
print "Atom not in dictionary:

@edhage
Copy link

edhage commented Dec 10, 2021

got the same issue with 3.8.10, translate does not run

@roveri-marco
Copy link
Contributor

One possible workaround is to install python27 and be sure TFD uses that version of python.
Alternatively, one cal install singularity and use the singularity image that you can find at https://github.com/roveri-marco/tfd within the releases. Singularity image is a lightweight version of Docker that provides a behavior like a command.

@fmrico
Copy link
Contributor

fmrico commented Feb 27, 2022

One possible workaround is to install python27 and be sure TFD uses that version of python.

I don' like this fix 🤔 , but maybe is the more realistic. Maybe we should fix TFD in its repo

@roveri-marco
Copy link
Contributor

I don't like it either. I've tried to convert TFD to Python3 but so far I've failed. I might retry now that I've more time.

@roveri-marco
Copy link
Contributor

@fmrico @edhage @RicardoM17
I finally managed to port TFD to python3. The code is currently in branch porting_python3_2ndattemp of https://github.com/roveri-marco/tfd. Soon I'll merge to master, but if you can do some tests it will be appreciated.

@fmrico
Copy link
Contributor

fmrico commented Mar 8, 2022

Excellent!! I hope to have time to test this soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants