tibi_dabo_hideandseek_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_hideandseek_alg_node_h_
00026 #define _tibi_dabo_hideandseek_alg_node_h_
00027 
00028 #include <iri_base_algorithm/iri_base_algorithm.h>
00029 #include "tibi_dabo_hideandseek_alg.h"
00030 
00031 // [publisher subscriber headers]
00032 #include <iri_perception_msgs/peopleTrackingArray.h>
00033 #include <sensor_msgs/Joy.h>
00034 #include <nav_msgs/Odometry.h>
00035 
00036 // [service client headers]
00037 
00038 // [action server client headers]
00039 #include <actionlib/client/simple_action_client.h>
00040 #include <actionlib/client/terminal_state.h>
00041 #include <move_base_msgs/MoveBaseAction.h>
00042 
00047 class TibiDaboHideandseekAlgNode : public algorithm_base::IriBaseAlgorithm<TibiDaboHideandseekAlgorithm>
00048 {
00049   private:
00050     // [publisher attributes]
00051 
00052     // [subscriber attributes]
00053     ros::Subscriber people_subscriber_;
00054     void people_callback(const iri_perception_msgs::peopleTrackingArray::ConstPtr& msg);
00055     CMutex people_mutex_;
00056     ros::Subscriber joy_subscriber_;
00057     void joy_callback(const sensor_msgs::Joy::ConstPtr& msg);
00058     CMutex joy_mutex_;
00059     ros::Subscriber odom_subscriber_;
00060     void odom_callback(const nav_msgs::Odometry::ConstPtr& msg);
00061     CMutex odom_mutex_;
00062 
00063     // [service attributes]
00064 
00065     // [client attributes]
00066 
00067     // [action server attributes]
00068 
00069     // [action client attributes]
00070     actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> move_base_client_;
00071     move_base_msgs::MoveBaseGoal move_base_goal_;
00072     void move_baseMakeActionRequest();
00073     void move_baseDone(const actionlib::SimpleClientGoalState& state,  const move_base_msgs::MoveBaseResultConstPtr& result);
00074     void move_baseActive();
00075     void move_baseFeedback(const move_base_msgs::MoveBaseFeedbackConstPtr& feedback);
00076 
00077     geometry_msgs::PoseStamped basePose;
00078     //geometry_msgs::PoseStamped hiderPose;
00079     std::vector< geometry_msgs::Point > hiderPoses;
00080     geometry_msgs::PoseStamped seekerPose;
00081     geometry_msgs::PoseStamped seekerGoal;
00082     int gameStatus;
00083     int gameIteration;
00084     bool paused;
00085     bool ready2Move;
00086 
00087     int previousId;
00088     std::vector<double> previousXY;
00089 
00090     bool seekerPoseReceived;
00091     bool hiderPoseReceived;
00092     bool moveBaseActive;
00093     std::vector<int> prev_buttons;
00094     tf::TransformListener tf_listener_;
00095 
00096     typedef enum {STATE_PLAYING=0, STATE_WIN_SEEKER=1, STATE_WIN_HIDER=2, STATE_TIE=3, STATE_IDLE=4, STATE_FINISHED=5} states;
00097     static const int NUM_STATES=STATE_FINISHED-STATE_PLAYING+1;
00098 
00099   public:
00106     TibiDaboHideandseekAlgNode(void);
00107 
00114     ~TibiDaboHideandseekAlgNode(void);
00115 
00116   protected:
00129     void mainNodeThread(void);
00130 
00143     void node_config_update(Config &config, uint32_t level);
00144 
00151     void addNodeDiagnostics(void);
00152 
00153     // [diagnostic functions]
00154     
00155     // [test functions]
00156 };
00157 
00158 #endif


tibi_dabo_hideandseek
Author(s): fherrero
autogenerated on Fri Dec 6 2013 22:12:38