iwakishi.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * PROJECT: Iwaki for ROS
00003  *
00004  * FILE: iwakisi.h
00005  *
00006  * ABSTRACT: an header file for the Iwakisi ROS wrapper around Iwaki library.
00007  *
00008  * Iwakisi: a ROS wrapper around Iwaki interaction manager library.
00009  * Copyright (C) 2012-2013 Maxim Makatchev.
00010  *
00011  * This program is free software: you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation, either version 3 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023  *
00024  * */
00025 
00026 #ifndef IWAKISI_H
00027 #define IWAKISI_H
00028 
00029 #include "iwaki.h"
00030 #include <iostream>
00031 #include <deque>
00032 
00033 
00034 /* if uncommented, the action is considered completed right
00035  * after it is dispatched. When using true executive modules,
00036  * comment this define out.
00037  * */
00038 #define NO_EXEC
00039 
00040 #define TICK_BB_VAR "tick"
00041 #define TICK_FORMAT "int"
00042 
00043 #define OUTPUT_IM_STRING "output_im_string"
00044 #define OUTPUT_IM_FORMAT "{int, string}"
00045 #define INVITE_IM_STRING "invite_im_string"
00046 #define INVITE_IM_FORMAT "{int, string}"
00047 
00048 #define ACTION_DISPATCH_BB_VAR "action_dispatch"
00049 #define ACTION_STATUS_BB_VAR "action_status"
00050 
00051 #define ACTION_TIMING_BB_VAR "action_timing"
00052 #define ACTION_TIMING_RESPONSE_BB_VAR "action_timing_response"
00053 #define ACTION_TIMING_RESPONSE_FORMAT "{int, float}"
00054 
00055 
00056 #define BB_USER_RECORD "user_record"
00057 #define BB_USER_RECORD_TYPE User
00058 #define MAX_UI_MSGS 100
00059 #define MAX_LOGFILE_SIZE 100000000
00060 #define MAX_ELEMENT_AGE 1000
00061 #define MAX_UI_TICK_ID 100000
00062 
00063 #define ABORT_ACTION_NAME "abort_action"
00064 
00065 enum UICommand {uiQuit, uiNone};
00066 enum VerbosityLevel {Brief, Verbose, WithBodyElements};
00067 
00071 class TextUI{
00072   public:
00073         // default constructor
00074     TextUI(): verbosity(Brief), msgPaneHeight(5), minTreeHeight(3), tick_id(0) { }
00075 
00076   public:
00077     UICommand update(InteractionManager &im, int ch);
00078     void init();
00079     void close();
00080     void printPlanTree(PlanTree &tr, const int &tree_height);
00081     void printHeader();
00082     void printMessages(const int &msg_height);
00083     void printKeyboardBuffer();
00084     void push_msg(const string &msg);
00085     void processBodyElementDescriptions();
00086     void setBodyElementDescriptions(Node &aNode);
00087     void updateBodyElementDescriptions(Node &aNode);
00088     void updateBodyElementDescription(Node &aNode, int element_id);
00089     string makeFutureActionDescription(BodyElement &element);
00090     string makePastActionDescription(BodyElement &element);
00091     string makeActionDescription(BodyElement &element, int active_element, int element_id);
00092     std::map<string, int> getAtomSubtypeCounts(Conjunction &gBindings);
00093     void printGlobals(Conjunction &gBindings);
00094   public:
00095     VerbosityLevel verbosity;
00096     int msgPaneHeight;
00097     int minTreeHeight;
00098     std::list< string > messages;
00099     int tick_id;
00100     string keyboardBuffer;
00101 };
00102 
00103 
00104 /* action executor's function: in this case, a sound generator */
00105 bool executeAction(Action &an_action);
00106 void hndAction(Action &an_action, ActionStatus &astat);
00107 
00108 /* Action completion status handler */
00109 void hndActionCompletionStatus(ActionStatus &astat);
00110 
00111 #endif // GIM_H


iwaki
Author(s): Maxim Makatchev, Reid Simmons
autogenerated on Thu Aug 27 2015 13:34:44