0

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 percentage 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 it 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)

    )
    (:functions
            (battery-amount)
            ;(battery-capacity)
    )
    (: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)
    (:objects 
        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 every action move should decrease the amount by 10.

to verify the results I implemented a precondition to the action move which should check if the amount is greater than 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 that 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!

UPDATE

I dug 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:

(:init
(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

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

the fuel used graph does look very different:

fuel_used_02

the graph is now a line that 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 simplified 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...

Bilal
  • 3,191
  • 4
  • 21
  • 49
LeFlob
  • 1
  • 5
  • 1
    I wonder whether the planner could be confused by `fuel-level` being a type, a predicate and a function at the same time. What if you used the requirement `numerical-fluents` and `fuel-level` was just a function, as it should (https://planning.wiki/ref/pddl21/req#numeric-fluents)? – Victor Paléologue Jan 17 '22 at 16:49
  • sadly this changes nothing. BUT i figured out that the planner is not capable of handling numerical-fluents so part of the task is to figure out a workaround that planner constraint because we are told to use specificially that exact planner. There seems to be a way to model the battery with variables, but we didn´t figure it out yet how this should work... – LeFlob Jan 17 '22 at 18:04
  • @LeFlob I suggest defining the battery level as predicates `battery_5_percent`, `battery_10_percent` etc ..., and you can define two simple actions to increase/decrease the battery level. – Bilal Jan 21 '22 at 08:10
  • Yes, i figured that out now and this is the workaround I was looking for, now it works thanks for the answer !! – LeFlob Jan 23 '22 at 15:15

0 Answers0