Finish the new page with the hatp commands
Add an anchor to the ros param section
|Deletions are marked like this.||Additions are marked like this.|
|Line 112:||Line 112:|
HATP: Basic usage
This page present a basic set of commands to use HATP, for extended use of HATP please refer to the component's page (links here)
1. General Information
1.1. General argument
The are two arguments that are implemented for all the modules: --help and --version. When either argument is used the module answers and leave
1.1.1. '--help' argument
For each module it will give a detailed list of its arguments and ROS parameters (if you don't know ROD parameter please see here).
> $ rosrun hatponboard hatponboard --help Usage: Parameters for hatp(onboard), the core of HATP /hatp/verbosity: [0,1,2,3] Selects the level of verbosity (can be set on command line with _verbosity:=...)
1.1.2. '--version' argument
Tells you the current version of the module, useful when reporting an issue.
N.B. hatponboard gives a slightly different output since it also gives the version of the underlying library hatponbaord-lib:
> $ rosrun hatponboard hatponboard --version /home/rlalleme/ros/indigo/devel/lib/hatponboard/hatponboard - version v2.0.0 hatponboard-lib - version v3.4.0
2. Start HATP
There are several ways of starting HATP depending on your need. The first solution is to start everything altogether, the second solution allows you to run the core separately from the GUIs, useful when working over network. Finally the last solution is to start each module by hand.
If you did not compile a domain first, please see the next section to know how to do it.
2.1. Start everything at once
To start all HATP modules at once simply call:
roslaunch hatp hatp.launch
If you want to change some of the parameters (hatpconsole mode, and so on), you can give the values as arguments of the script:
roslaunch hatp hatp.launch hatpconsole_mode:=minimal
If you want to keep those parameter, then create a new launch file and give the argument using the <arg> tag:
<launch> <!-- Call HATP with parameters --> <include file="$(find hatp)/hatp.launch"> <arg name="hatpconsole_mode" value="minimal" /> </include> </launch>
2.2. Start the core, and GUI separately
The core of HATP is actually composed of two modules: hatponboard and a database to provide the initial state. To start it use the appropriate launch file:
roslaunch hatp hatp-core.launch
Then you can launch the other modules:
rosrun hatpconsole hatpconsole rosrun hatptester hatptester
2.3. Start each module independently
2.3.1. Start the database
To start the core with the two modules as separate entities, first start the database:
rosrun hatponboard hatponboard-database
The database actually has two modes: domain and toaster. In domain mode, the initial state is retrieved from the domain file, while in toaster mode it is retrieve from toaster. In Toaster mode there are several parameters to set (database name, agent to retrieve). See the --help option for more details.
Reminder on ROS parameters
With ROS parameter server: call rosparam set <absolute_param_name> <value>
Private param: when you call a module rosrun <package> <module> _<relative_param_name>:=<value>
For instance for the database with rosparam:
rosparam set /hatponboard_database/mode toaster
With private parameter:
rosrun hatponboard hatponboard-database _mode:=toaster
Both methods have the same result.
2.3.2. Start the planner
To start hatponboard, simply call:
rosrun hatponboard hatponboard
It has only one parameter, the verbosity of the messages it produces while planning. The higher the number, between 0 and 3, the more details HATP gives while planning.
Whne HATP hass started it will wait for a planning request, you must call the service /hatp/planner to start it. Another way is to use the hatptester module that is designed to make it easy to send requests.
2.3.3. The other modules
You will find more details on each module on their dedicated page:
HATP/hatpconsole - Plan viewer
HATP/hatptester - Plan-request sender
HATP/doc - The documentation on domain modeling
3. Compile a domain
In order to compile a domain to be able to use it with HATP here are the steps.
3.1. Parse the domain
First start the parser, if no argument is given it will start an interactive prompt to select it:
rosrun hatponboard_lib hatpparser
Here is an example of interaction:
Please choose a domain file in the following list: 1 ArcasProject/arcas1.dom 2 ArcasProject/arcas2.dom 3 ArcasProject/arcas3.dom 4 ArcasProject/arcas4.back.dom 5 ArcasProject/arcas4.dom 6 ArcasProject/arcas5.back.dom 7 ArcasProject/arcas5.dom 8 ArcasProject/arcas6.back.dom 9 ArcasProject/arcas6.dom 10 ArcasProject/arcas7.dom 11 Assembly/assembly.dom 12 BeliefTest/bmTest.dom 13 bmtest/domain.dom 14 CleanTheTable/clean1.dom 15 CleanTheTable/clean2.dom 16 CleanTOM/Clean.dom 17 CleanWithBelief/cleanBM.dom 18 DWR-shop2/dwr.dom 19 DWR/dwr-2.dom 20 DWR/dwr.dom 21 ILGTP/get_object_cost.dom 22 ILGTP/paint_cube.dom 23 ILGTP/place_reachable.dom 24 ILGTP/table-3-objects.dom 25 ILGTP/table-3-virtualPlace.dom 26 ILGTP/tray_forbid.dom 27 LibraryPR2/lib.dom 28 LibraryPR2/lib2.dom 29 mikeDomain/domain.dom 30 RoboErgosum/RoboErgosum.dom 31 RoboErgosum/RoboErgosumIcra.dom 32 RoboErgosum/RoboErgosumNavigationFree.dom 33 Saphari/assembleBrackets.dom 34 Saphari/assembleBrackets.simplified.dom 35 Saphari/assembleBrackets.video.dom 36 Saphari/soldering-iron.dom 37 Saphari/soldering-iron.ugly.dom 38 Stack/stack.dom 39 Stack/stack_lock.dom 40 Tests/test.dom 41 Tests/test2.dom 42 Tests/testAllVar.dom 43 Tests/testAllVarBM.dom 44 UncoverTheToy/uncover.dom 45 USTurnTaking/StackUS.dom (to add a new line, add the .dom file in the <catkin_ws>/src/hatp/hatponboard/domains folder) Choice: 20 You chose : "DWR/dwr.dom" Please choose a cost file in the following list: 1 ArcasProject/arcas.cost 2 Assembly/assembly.cost 3 BeliefTest/bmTest.cost 4 bmtest/costs.cost 5 CleanTheTable/clean.cost 6 CleanTOM/Clean.cost 7 CleanWithBelief/cleanBM.cost 8 DWR-shop2/dwr.cost 9 DWR/dwr.cost 10 ILGTP/ilgtp.cost 11 LibraryPR2/lib.cost 12 mikeDomain/costs.cost 13 RoboErgosum/RoboErgosum.cost 14 Saphari/assembleBrackets.cost 15 Saphari/functions.cost 16 Stack/stack.cost 17 Tests/test.cost 18 UncoverTheToy/uncover.cost 19 USTurnTaking/StackUS.cost (to add a new line, add the .cost file in the <catkin_ws>/src/hatp/hatponboard/domains folder) Choice: 9 You chose : "DWR/dwr.cost" ************** START HATP DOMAIN EXEC ************** Domain: "dwr.dom" Cost: "dwr.cost" Preprocessors step done. Fact database initialization done. HTN description done. File for fact database initialization written. Files for HTN tasks written. Files for Belief Management written. File for HTN initialization written. File for social rules written. File for social rule base initialization written. User functions for costs copied. SUCCESS Output written to: <catkin_ws>/src/hatp/hatponboard/generated *************** END HATP DOMAIN EXEC ***************
All the possible file are automatically detected as long as there are in the domain folder AND the have the right extension: either .dom or .cost.
3.2. Compile the domain
When the domain has been parsed, you need to recompile hatponboard.
cd <catkin_ws> catkin_make hatponboard
Now HATP is ready to start, see the previous section to start HATP.