1

I'm implementing a charging action in PDDL2.1 that is based off a function (charge_level). The function value for (charge_level) works and updates ~10Hz.

I want to create an action called charge which continues until the charge_level reaches a threshold. That is

 (:durative-action charge
    :duration ( CONTINUE UNTIL (> (charge_level) HIGH_THRES)))
    :condition (and
        (at start ( < (charge_level) LOW_THRES)))
    :effect (and
    )
 ))

How might I implement this? I was trying to assign the ?duration variable to charge_level and set :duration (> ?duration HIGH_THRES) but it wouldn't plan successfully.

Thanks in advance!

mger
  • 61
  • 7

1 Answers1

0

The answer depends on two aspects of your solution:

  • capability of the planner you are using
  • level of abstraction you select for your planning model and for your execution/control

For the first aspect: if your domain also models the discharging effect in other actions, and if your planner supports continuous effects, you could model the action in a similar way to this boil action:

(:durative-action boil-water
    :parameters ()
    :duration (>= ?duration 0)
    :condition (and
        (at start (and
            (not (boiling))
        ))
        (over all (and
            (<= (water-temperature) 100)
        ))
    )
    :effect (and
        (at start (and
            (boiling)
        ))
        (at end (and
            (not (boiling))
        ))
        (increase (water-temperature) (* #t 1.0))
    )
)

You can fin the full example is here. The continuous effect (increase (water-temperature) (* #t 1.0)) is what defines how quickly is the temperature changing in time. With that, the planner can reason about how long the action should take. That is why the duration is defined without any upper bound :duration (>= ?duration 0). This is assuming there is another action in the domain or goal in the problem, which require the water-temperature to be of certain numeric value. Otherwise the planner has no reason to add the action to the plan.

Another approach is to use process (and event) as defined in PDDL+.

And regarding the second aspect: if your domain does not really need to reason about the value of the charge_level, you should delegate that to your plan execution infrastructure. In practice, it is much simpler to evaluate a boolean predicate fully_charged based on the condition (> (charge_level) HIGH_THRES)) outside the planner as part of your state inference.

Jan Dolejsi
  • 1,389
  • 13
  • 25
  • 1
    This makes sense, thank you. I wish there was a better way of defining the feedback `(increase (water-temperature) (* #t 1.0))` because if this changes somewhere else in the source/sensing interface, then it could mess up this action. – mger Sep 14 '20 at 12:35
  • You can surely replace `1.0` in the continuous increase by a PDDL function. This is still only the planning *model* of the real life. As long as the rate of change is not changing over time, this effect is linear and several planners will be able to handle that. The fact that it changes during plan execution does not necessarily invalidate the plan. – Jan Dolejsi Sep 14 '20 at 12:40
  • 1
    Furthermore, if there is no other action that is changing the rate of change, and the rate of charging in your domain is constant (and thus the numeric effect is linear), you can calculate the duration directly in the `(:duration )` declaration. – Jan Dolejsi Sep 14 '20 at 12:44