Table of Contents

Programming Project nr. 3: Planning

Overview

Using the Problem Solver

Specifying Planning Problem in XML

Actions are specified thus:

 <actions>
    <action name="pickUp">
       <parameters>
          <parameter name="obj" type="Ingredient" />
       </parameters>
       <preconditions>
          <condition>IsClose(obj)</condition>
       </preconditions>
       <postconditions>
          <add>
             <condition>
                Holding(obj)
             </condition>
          </add>
          <delete>
             <condition>IsOnGround(obj)</condition>
          </delete>
       </postconditions>
    </action>
    <action name="putFirstIngredientInPot">
       <parameters>
          <parameter name="obj" type="Ingredient" />
          <parameter name="pot" type="Pot" />
       </parameters>
       <preconditions>
          <condition>IsClose(pot)</condition>
          <condition>Holding(obj)</condition>
          <condition>IsEmpty(pot)</condition>
       </preconditions>
       <postconditions>
          <delete>
             <condition>
                Holding(obj)
             </condition>
             <condition>IsEmpty(pot)</condition>
          </delete>
          <add>
             <condition>InPot(obj)</condition>
             <condition>LastIngredientInPot(obj)</condition>
          </add>
       </postconditions>
    </action>
 </actions>

Each action has some parameters that are used when the action is applied. In order for the action to be applicable its preconditions must be held. When the action is applied it's postconditions are applied, which are put forth as a delete and add lists.

So, in the first problem listed below we can't apply the pickUp action as it's precondition “IsClose(obj)” isn't held. So we would need a new action that can perform this.

The Java Problem Solver

The classes are split up according to their roles:

The Successor class finds all the successor states available from some state s.

The GoalTest class tests a SearchNode to see if it has reached the goal.

The SearchNode class is a node in the search tree. It includes all the information about the states and can create a new SearchNode if an action is applied to it.

BreadthFirstSearch is a simple class that searches the state space in a breadth first manner. Now, this can take a very long time, so if you wan't you can use this class as a base for a new search class.

Execution

In order to execute the plans using the hexapod, we have created some new message types that you can use:

  "RU.AI06.Instruct.Move.To.Location"
  "RU.AI06.Instruct.PickUp.Object"
  "RU.AI06.Instruct.PutInPot.Object"
  "RU.AI06.Instruct.Drop.Object"
  "RU.AI06.Instruct.EmptyPot"

When the hexapod gets these messages it responds by sending back:

  "RU.AI06.Instruct.Move.To.Location.Done"
  "RU.AI06.Instruct.PickUp.Object.Success" 
  "RU.AI06.Instruct.PickUp.Object.Fail" 
  "RU.AI06.Instruct.PutInPot.Object.Success" 
  "RU.AI06.Instruct.PutInPot.Object.Fail" 
  "RU.AI06.Instruct.Drop.Object.Success" 
  "RU.AI06.Instruct.EmptyPot.Success" 

You can see an example of this in usage in the SimpleMoveController class.

Note: The executable that starts panda has changed and now it takes as an argument the location of the goal xml file that describes the goal states. So if your xml file is at C:\verkefni\goal.xml you should start the program as “Test.exe C:\verkefni\goal.xml”

The problems to be solved

Here are three problems that your plan system should be able to solve. The first 2 can be solved by adding some new actions to the action list.

The third one, however, is pretty complex so the breadth-first planner might get into trouble with it and not be able to solve it. So you might have to create your own planner to solve it.(HINT: You can do simple changes to the breadth-first planner so it is better in handling sequences such as “pickUp banana1→ drop banana1 → pickUp banana1” )

Problem 1

 <InitialState>
    <literal>IsOnGround(banana1)</literal>
    <literal>Ingredient(banana1)</literal>
    <literal>IsClose(pot1)</literal>
    <literal>IsEmpty(pot1)</literal>
    <literal>Pot(pot1)</literal>
 </InitialState>
 <goal>
    <condition>Holding(banana1)</condition>
 </goal>

Problem 2

 <InitialState>
    <literal>IsOnGround(banana1)</literal>
    <literal>IsOnGround(plant1)</literal>
    <literal>IsOnGround(wand1)</literal>
    <literal>Ingredient(banana1)</literal>
    <literal>Ingredient(plant1)</literal>
    <literal>Ingredient(wand1)</literal>
    <literal>IsClose(pot1)</literal>
    <literal>IsEmpty(pot1)</literal>
    <literal>Pot(pot1)</literal>
 </InitialState>
 <goal>
    <condition>InPot(banana1)</condition>
    <condition>InPot(plant1)</condition>
    <condition>PutInAfter(banana1, plant1)</condition>
 </goal>

Problem 3

 <InitialState>
    <literal>IsOnGround(banana1)</literal>
    <literal>IsOnGround(banana2)</literal>
    <literal>IsOnGround(plant1)</literal>
    <literal>IsOnGround(wand1)</literal>
    <literal>Ingredient(banana1)</literal>
    <literal>Ingredient(plant1)</literal>
    <literal>Ingredient(wand1)</literal>
    <literal>Ingredient(banana2)</literal> 
    <literal>IsClose(pot1)</literal>
    <literal>IsEmpty(pot1)</literal>
    <literal>Pot(pot1)</literal>
 </InitialState>
 <goal>
    <condition>InPot(banana1)</condition>
    <condition>InPot(plant1)</condition>
    <condition>Holding(banana2)</condition>
    <condition>IsClose(pot1)</condition>
    <condition>PutInAfter(banana1, plant1)</condition>
 </goal>

Using the Newest Hexapod

NEW HEDAPOD VERSION HERE

Get the new version here.

Note: If you got an error involving world.py, this is resolved in the latest version.

Keyboard shortcuts in Hexapod viewer

Messages to and from Hexapod viewer

From

These message contain, in xml format, the information about a perceived object. The Java class Perception can translate itself to and from the xml format and has three variables:

To

New messages allow you to make the Hexapod quickly go to certain places, pick up ingredients, drop ingredients and add them to the pot where the elixir is being made:

You can also send the same messages as before to make the Hexapod move itself but NOTE!!! the content is now the degrees with which the Hexapod is to rotate its limbs.

Also, you can send the message “RU.AI06.Instruct.Change.UpdateTime” which will change the update time with which the Hexapod sends its perceptions.

Any questions, email me( vignirh02@ru.is )

Later, Vignir