%% Copyright 2014 Keith Clark, Peter Robinson %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at %% %% http://www.apache.org/licenses/LICENSE-2.0 %% %% Unless required by applicable law or agreed to in writing, software %% distributed under the License is distributed on an "AS IS" BASIS, %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. %% A simple TR program to experiment with logging and the TR shell %% We assume that if the program receives a dead_centre percept %% it will also receive a centre percept dir::= left | right | centre | dead_centre percept see : (num, dir), holding : () durative move : (num), turn : (dir) discrete grab : (), release : () %% We interpret holding true and see(0, centre) not true to mean that %% the grippers are closed but not actually holding an object get_object : () ~> get_object { holding & see(0, centre) ~> () not holding & see(0, centre) ~> grab wait 10^2 not holding ~> get_to true ~> release wait 10^2 } get_to : () ~> get_to { see(0, centre) ~> () see(0, Dir) ~> turn(Dir) see(_, centre) ~> move(6) see(_, Dir) while see(_, centre) until see(_, dead_centre) ~> move(4) , turn(Dir) true ~> turn(left) for 10 ; move(4) for 10 } %% For experimenting with this program using robot_shell %% first start the robot shell in one terminal as follows %% robot_shell.py shell %% In another terminal run the qulog interpreter %% qulog %% and in the interpreter %% consult tr_eg. %% teleor. %% go. %% Now enter percepts in the robot shell go : () ~>> go ~>> start_agent collector shell@localhost all ; start_task collector get_object