Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
00032 #include <trajectory_msgs/JointTrajectoryPoint.h>
00033 #include <sensor_msgs/Joy.h>
00034
00035
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
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
00064 ros::Publisher target_joints_publisher_;
00065 trajectory_msgs::JointTrajectoryPoint JointTrajectoryPoint_msg_;
00066
00067
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
00076
00077
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
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
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
00173
00174
00175 };
00176
00177 #endif