I am a beginner in PDDL and currently want to build a Project, that allows a rover to autonomously act on mars. Basically the rover should have a battery. Eg. rover can increase the amount by charging at a waypoint (+10 per action) and the percantage will be decreased a -> b (-15). It should be modeled rather simple so there has to be no decrease over time, i just want to define in the init sth. like: when he travels from a to b amount decreased by 10, from b to c by -10 and from a to c -25... this is my domain file currently:

(define (domain rover)

(:requirements :fluents)

(:types     LOCATION - Obj
            ROVER - Obj)

(:constants )

(:predicates    (path           ?r - ROVER  ?l1 ?l2 - LOCATION)
                (at             ?r - ROVER  ?l - LOCATION)



(:action move
      :parameters (?r - ROVER    ?from - LOCATION    ?to - LOCATION)
      :precondition (and (at ?r ?from) (path ?r ?from ?to) (> (battery-amount) 90)) 
      :effect (and (at ?r ?to) (not (at ?r ?from))
                (decrease (battery-amount) 10)

) this is the Problem:

(define (problem      roverprob1)
(:domain    rover)
    r0              - ROVER
    l0 l1 l2 l3 l4   - LOCATION)
(:init  (at r0 l1) (= (battery-amount) 100)
        (path r0 l3 l0) (path r0 l0 l3) (path r0 l3 l1) 
        (path r0 l1 l3) (path r0 l1 l2) (path r0 l2 l1)
        (path r0 l3 l4) (path r0 l4 l3)
    (:goal  (and (at r0 l4)))    

My idea was that my battery-amount should be a function in the domain Its initial value is set in Problem with 100 and to start with evry action move should decrease the amount by 10.

to varify the results i implemented a precondition to the action move which should check if the amount is greater to 90.

My rover has to move in two steps in order to get to Location l4. so he should not be able to make it to l4. Interestingly enough the Editor still finds a way to solve the problem. It is the same solution which i would get without the battery amount. It seems to me, that he does not update the value and I have no Idea why ^^

thank you in advance for any help or suggestions!


I digged further into the problem and got myself the Pddl expansion for VSCode. You can view the current state here: current state If I take a look at the visual output that vs code provides i noticed the following:

(at r0 l1)
(= (fuel-level r0) 90)...)

when the rover has enough energy to drive along the path, the graph for the fuel level shows the following: fuel_used_01

but when i change the init value, so the rover should not be able to get to the goal waypoint

(at r0 l1)
(= (fuel-level r0) 50)...)

the fuel used graph does look very different: fuel_used_02

the graph is now a line which seems to be at 0 the whole time. So i am thinking, that the planer knows that the fuel is not enough and therefore treats it as 0 but the precondition does not trigger. I would expect an output like: Goal can be simplyfied to false or sth. like that.

I need this precondition to be working because eventually i want the rover to recharge its battery when he determines that he cant make a path with his fuel level...

New contributor
LeFlob is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Browse other questions tagged or ask your own question.