====== Programming Project nr. 3: Planning ======
===== Overview =====
* **Goal:** Use classic planning to make your hexapod brew a powerful elixir by bringing the right ingredients to a pot and adding them in the right order.
* **Approach:** You set up a planning problem, using a simple XML data file to describe the initial state, possible actions (with pre- and postconditions) and a goal state. You solve the problem using a search-based problem solver in Java that reads your XML data. Once a solution has been found, you test it by sending the action sequence to your hexapod and see it succeed with the brewing.
* **Materials:** You start with a simple problem solver in Java and a skeleton of the XML data files. You can get the files needed {{public:t-622-arti-07-1:hexapod_planning_release.zip|here}}.
* **Hand in:** A short report detailing how you solved the harder problems and some run data( nodes looked at, plan make time, computer used). Zip up your data files and java source files and submit via MySchool.
* **Deadline:** Hand in before 23:59 on Sunday the 11th of March!
===== Using the Problem Solver =====
==== Specifying Planning Problem in XML ====
Actions are specified thus:
IsClose(obj)
Holding(obj)
IsOnGround(obj)
IsClose(pot)
Holding(obj)
IsEmpty(pot)
Holding(obj)
IsEmpty(pot)
InPot(obj)
LastIngredientInPot(obj)
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 ===
IsOnGround(banana1)
Ingredient(banana1)
IsClose(pot1)
IsEmpty(pot1)
Pot(pot1)
Holding(banana1)
=== Problem 2 ===
IsOnGround(banana1)
IsOnGround(plant1)
IsOnGround(wand1)
Ingredient(banana1)
Ingredient(plant1)
Ingredient(wand1)
IsClose(pot1)
IsEmpty(pot1)
Pot(pot1)
InPot(banana1)
InPot(plant1)
PutInAfter(banana1, plant1)
=== Problem 3 ===
IsOnGround(banana1)
IsOnGround(banana2)
IsOnGround(plant1)
IsOnGround(wand1)
Ingredient(banana1)
Ingredient(plant1)
Ingredient(wand1)
Ingredient(banana2)
IsClose(pot1)
IsEmpty(pot1)
Pot(pot1)
InPot(banana1)
InPot(plant1)
Holding(banana2)
IsClose(pot1)
PutInAfter(banana1, plant1)
===== Using the Newest Hexapod =====
==== NEW HEDAPOD VERSION HERE ====
Get the new version {{public:t-622-arti-07-1:hexapod_planning_release.zip|here}}.
**Note:** If you got an error involving world.py, this is resolved in the latest version.
==== Keyboard shortcuts in Hexapod viewer ====
* move camera with a-s-d-f and the up and down arrow keys.
* Move Hexapod with u-h-j-k
* M: Enable control camera with mouse
==== Messages to and from Hexapod viewer =====
=== From ===
* "RU.AI06.Perception.Sight.Object"
* "RU.AI06.Perception.Touch.Object"
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:
* type of perception
* type of object
* Location to object RELATIVE to the Hexapod
=== 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:
* "RU...."
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