Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * navigator_thread.h - Robotino ROS Navigator Thread 00004 * 00005 * Created: Sat June 09 15:13:27 2012 00006 * Copyright 2012 Sebastian Reuter 00007 ****************************************************************************/ 00008 00009 /* This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU Library General Public License for more details. 00018 * 00019 * Read the full text in the LICENSE.GPL file in the doc directory. 00020 */ 00021 00022 #ifndef __ROS_NAVIGATOR_THREAD_H_ 00023 #define __ROS_NAVIGATOR_THREAD_H_ 00024 00025 #include <core/threading/thread.h> 00026 #include <aspect/blocked_timing.h> 00027 #include <aspect/logging.h> 00028 #include <aspect/blackboard.h> 00029 #include <aspect/configurable.h> 00030 00031 #include <interfaces/NavigatorInterface.h> 00032 00033 #include <tf/types.h> 00034 #include <math.h> 00035 #include <ros/ros.h> 00036 #include <move_base_msgs/MoveBaseAction.h> 00037 #include <move_base_msgs/MoveBaseGoal.h> 00038 #include <move_base_msgs/MoveBaseActionGoal.h> 00039 #include <actionlib/client/simple_action_client.h> 00040 00041 namespace fawkes { 00042 class NavigatorInterface; 00043 } 00044 00045 class RosNavigatorThread 00046 : public fawkes::Thread, 00047 public fawkes::BlockedTimingAspect, 00048 public fawkes::LoggingAspect, 00049 public fawkes::BlackBoardAspect, 00050 public fawkes::ConfigurableAspect 00051 { 00052 public: 00053 RosNavigatorThread(); 00054 00055 /* thread */ 00056 virtual void init(); 00057 virtual void finalize(); 00058 virtual void loop(); 00059 00060 private: 00061 void check_status(); 00062 void send_goal(); 00063 00064 private: 00065 typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient; 00066 00067 fawkes::NavigatorInterface *nav_if_; 00068 MoveBaseClient *ac_; 00069 move_base_msgs::MoveBaseGoal goal_; 00070 bool cmd_sent_; 00071 bool connected_history_; 00072 }; 00073 00074 #endif /* __ROS_NAVIGATOR_THREAD_H_ */