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

add test to reproduce https://github.com/jsk-ros-pkg/jsk_demos/issues/1286 #88

Merged
merged 3 commits into from
Oct 21, 2022

Conversation

k-okada
Copy link
Member

@k-okada k-okada commented Mar 3, 2021

it is very strange, but if option string is long, it fails on planning

...
3. Running search
This is a unit task.
reading input... [t=0s]
Simplifying transitions... done!
done reading input! [t=0s]
building causal graph...done! [t=0s]
packing state variables...Variables: 7
Bytes per state: 4
done! [t=0s]
done initalizing global data [t=0s]
Peak memory: 4012 KB

Error:
parse error: 
missing ) at: 
list
Usage error occurred.

Exit code: 2

...

[ROSTEST]-----------------------------------------------------------------------

[pddl_planner.rosunit-sample_pddl_downward/sample_pddl_downward][passed]
[pddl_planner.rosunit-sample_pddl_downward_client/test_pddl_planner][passed]
[pddl_planner.rosunit-sample_pddl_downward_client_long_option/test_pddl_planner][FAILURE]
result sequence is 6
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/home/k-okada/catkin_ws/ws_jsk_demos/src/jsk-ros-pkg/jsk_planning/pddl/pddl_planner/demos/sample-pddl/sample-client.py", line 86, in test_pddl_planner
    self.assertEquals(len(result.sequence), 6, "result sequence is 6")
  File "/usr/lib/python2.7/unittest/case.py", line 513, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python2.7/unittest/case.py", line 506, in _baseAssertEqual
    raise self.failureException(msg)
--------------------------------------------------------------------------------

[pddl_planner.rosunit-sample_pddl_ff/sample_pddl_ff][passed]
[pddl_planner.rosunit-sample_pddl_ff_client/test_pddl_planner][passed]
[pddl_planner.rosunit-sample_pddl_ffha/sample_pddl_ffha][passed]
[pddl_planner.rosunit-sample_pddl_ffha_client/test_pddl_planner][passed]

SUMMARY
 * RESULT: FAIL
 * TESTS: 7
 * ERRORS: 0
 * FAILURES: 1

@k-okada
Copy link
Member Author

k-okada commented Mar 3, 2021

and not sure why, use shell=True solves....

diff --git a/pddl/pddl_planner/src/pddl.py b/pddl/pddl_planner/src/pddl.py
index f73b536..1002964 100755
--- a/pddl/pddl_planner/src/pddl.py
+++ b/pddl/pddl_planner/src/pddl.py
@@ -147,7 +147,7 @@ class PDDLPlannerActionServer(object):
         if max_planning_time > 0.0:
             command = ["timeout", str(max_planning_time)] + command
         rospy.loginfo("Command: %s" % " ".join(command))
-        proc = sp.Popen(command, stdout=sp.PIPE, stderr=sp.PIPE)
+        proc = sp.Popen(" ".join(command), stdout=sp.PIPE, stderr=sp.PIPE, shell=True)
         try:
             output, error = str(), str()
             r = rospy.Rate(10.0)

@k-okada k-okada merged commit e238fe0 into jsk-ros-pkg:master Oct 21, 2022
@k-okada k-okada deleted the fix_jsk_demos_1286 branch December 1, 2023 11:56
k-okada added a commit to k-okada/jsk_demos that referenced this pull request Dec 1, 2023
latest pddl_planner have following problem, due to jsk-ros-pkg/jsk_planning#88
```
[INFO] [1701431008.700697]: domain_path => /tmp/domain_m37k2us4
[INFO] [1701431008.701434]: Command: rosrun downward plan /tmp/domain_m37k2us4 /tmp/problem_0c6zg3kz --heuristic "hlm=lmcount(lm_rh
w(reasonable_orders=true,lm_cost_type=2,cost_type=2),pref=true)" --heuristic "hff=ff()" --search ""iterated([lazy_greedy([hff,hlm],
preferred=[hff,hlm])," "lazy_wastar([hff,hlm],preferred=[hff,hlm],w=5)," "lazy_wastar([hff,hlm],preferred=[hff,hlm],w=3)," "lazy_wa
star([hff,hlm],preferred=[hff,hlm],w=2)]," "repeat_last=false)"" --plan-file /tmp/plan_fw1c2_16
[ERROR] [1701431008.805070]: Planner exited with error: Output:

Error:
/bin/sh: 1: Syntax error: "(" unexpected

Exit code: 2
```
k-okada added a commit to k-okada/jsk_planning that referenced this pull request Dec 4, 2023
jsk-ros-pkg#88 changes 'sp.Popen(command' to 'sp.Popen(" ".join(command)', this assumes `planner_option` uses `--search &quat;iterated([lazy_greedy([hff,hlm], preferred=[hff,hlm]), ...)&quat;`
but some launch file uses `--search iterated([lazy_greedy([hff,hlm],preferred=[hff,hlm]), ...)`, without &quat; and spaces, and jsk_planning 0.1.13 did not work this such eample(https://github.com/jsk-ros-pkg/jsk_demos/blob/ab0360b5580e77ca70006ce505497894fe4ac0d2/jsk_2013_04_pr2_610/test/test-demo-plan.test#L10), jsk-ros-pkg/jsk_demos#1286
this fix uses shlex.split() to keep quated substrings and uses Popen(command, stead of Popen(" ".join(command), to input quated argument as one word.
k-okada added a commit to k-okada/jsk_planning that referenced this pull request Dec 5, 2023
jsk-ros-pkg#88 changes 'sp.Popen(command' to 'sp.Popen(" ".join(command)', this assumes `planner_option` uses `--search &quat;iterated([lazy_greedy([hff,hlm], preferred=[hff,hlm]), ...)&quat;`
but some launch file uses `--search iterated([lazy_greedy([hff,hlm],preferred=[hff,hlm]), ...)`, without &quat; and spaces, and jsk_planning 0.1.13 did not work this such eample(https://github.com/jsk-ros-pkg/jsk_demos/blob/ab0360b5580e77ca70006ce505497894fe4ac0d2/jsk_2013_04_pr2_610/test/test-demo-plan.test#L10), jsk-ros-pkg/jsk_demos#1286
this fix uses shlex.split() to keep quated substrings and uses Popen(command, stead of Popen(" ".join(command), to input quated argument as one word.
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

Successfully merging this pull request may close these issues.

1 participant