tibi_dabo_haod_alg_node.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author 
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 // 
00019 // IMPORTANT NOTE: This code has been generated through a script from the 
00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness
00021 // of the scripts. ROS topics can be easly add by using those scripts. Please
00022 // refer to the IRI wiki page for more information:
00023 // http://wikiri.upc.es/index.php/Robotics_Lab
00024 
00025 #ifndef _tibi_dabo_haod_alg_node_h_
00026 #define _tibi_dabo_haod_alg_node_h_
00027 
00028 #include <iri_base_algorithm/iri_base_algorithm.h>
00029 #include "tibi_dabo_haod_alg.h"
00030 
00031 // [publisher subscriber headers]
00032 #include <trajectory_msgs/JointTrajectoryPoint.h>
00033 #include <sensor_msgs/Joy.h>
00034 
00035 // [service client headers]
00036 #include <iri_human_assisted_object_detection/haod_learn.h>
00037 #include <iri_human_assisted_object_detection/haod_detect.h>
00038 #include <iri_human_assisted_object_detection/haod_init.h>
00039 
00040 // [action server client headers]
00041 #include <iri_nav_msgs/followTargetAction.h>
00042 #include <iri_action_server/iri_action_server.h>
00043 #include <tibi_dabo_msgs/haodAction.h>
00044 #include <actionlib/client/simple_action_client.h>
00045 #include <actionlib/client/terminal_state.h>
00046 #include <tibi_dabo_msgs/sequenceAction.h>
00047 
00048 typedef enum {haod_idle,haod_hri_intro,haod_init,haod_hri_init,haod_detect,haod_hri_help,haod_user_input,haod_learn,haod_hri_exit} haod_states;
00049 
00050 typedef enum {none,help,valid_det,invalid_det,end,force_end} joy_actions;
00051 
00052 typedef enum {catalan,english,spanish} languages;
00053 
00054 typedef enum {hri_intro=0,hri_init=1,hri_help=2,hri_exit=3} hri_actions;
00055 
00060 class TibiDaboHaodAlgNode : public algorithm_base::IriBaseAlgorithm<TibiDaboHaodAlgorithm>
00061 {
00062   private:
00063     // [publisher attributes]
00064     ros::Publisher target_joints_publisher_;
00065     trajectory_msgs::JointTrajectoryPoint JointTrajectoryPoint_msg_;
00066 
00067     // [subscriber attributes]
00068     ros::Subscriber joy_subscriber_;
00069     void joy_callback(const sensor_msgs::Joy::ConstPtr& msg);
00070     CMutex joy_mutex_;
00071     bool new_joy_msg;
00072     joy_actions joy_action;
00073     languages language;
00074 
00075     // [service attributes]
00076 
00077     // [client attributes]
00078     ros::ServiceClient haod_learn_client_;
00079     iri_human_assisted_object_detection::haod_learn haod_learn_srv_;
00080     ros::ServiceClient haod_detect_client_;
00081     iri_human_assisted_object_detection::haod_detect haod_detect_srv_;
00082     ros::ServiceClient haod_init_client_;
00083     iri_human_assisted_object_detection::haod_init haod_init_srv_;
00084 
00085     // [action server attributes]
00086     IriActionServer<tibi_dabo_msgs::haodAction> haod_server_aserver_;
00087     void haod_serverStartCallback(const tibi_dabo_msgs::haodGoalConstPtr& goal);
00088     void haod_serverStopCallback(void);
00089     bool haod_serverIsFinishedCallback(void);
00090     bool haod_serverHasSucceedCallback(void);
00091     void haod_serverGetResultCallback(tibi_dabo_msgs::haodResultPtr& result);
00092     void haod_serverGetFeedbackCallback(tibi_dabo_msgs::haodFeedbackPtr& feedback);
00093     bool new_haod_action;
00094     bool haod_need_help;
00095     bool stop_haod;
00096     int init_x,init_y;
00097 
00098     // [action client attributes]
00099     actionlib::SimpleActionClient<tibi_dabo_msgs::sequenceAction> hri_client_client_;
00100     tibi_dabo_msgs::sequenceGoal hri_client_goal_;
00101     void hri_clientMakeActionRequest();
00102     void hri_clientDone(const actionlib::SimpleClientGoalState& state,  const tibi_dabo_msgs::sequenceResultConstPtr& result);
00103     void hri_clientActive();
00104     void hri_clientFeedback(const tibi_dabo_msgs::sequenceFeedbackConstPtr& feedback);
00105     bool hri_action_done;
00106 
00107     actionlib::SimpleActionClient<iri_nav_msgs::followTargetAction> follow_target_client_;
00108     iri_nav_msgs::followTargetGoal follow_target_goal_;
00109     void follow_targetMakeActionRequest();
00110     void follow_targetDone(const actionlib::SimpleClientGoalState& state,  const iri_nav_msgs::followTargetResultConstPtr& result);
00111     void follow_targetActive();
00112     void follow_targetFeedback(const iri_nav_msgs::followTargetFeedbackConstPtr& feedback);
00113     bool tracking_head;
00114 
00115   protected:
00116     void execute_hri_action(hri_actions action);
00117 
00118   public:
00125     TibiDaboHaodAlgNode(void);
00126 
00133     ~TibiDaboHaodAlgNode(void);
00134 
00135   protected:
00148     void mainNodeThread(void);
00149 
00162     void node_config_update(Config &config, uint32_t level);
00163 
00170     void addNodeDiagnostics(void);
00171 
00172     // [diagnostic functions]
00173     
00174     // [test functions]
00175 };
00176 
00177 #endif


tibi_dabo_haod
Author(s): Sergi Hernandez Juan
autogenerated on Fri Dec 6 2013 23:42:07