Fawkes API  Fawkes Development Version
navigator_thread.h
1 
2 /***************************************************************************
3  * navigator_thread.h - Robotino ROS Navigator Thread
4  *
5  * Created: Sat June 09 15:13:27 2012
6  * Copyright 2012 Sebastian Reuter
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __ROS_NAVIGATOR_THREAD_H_
23 #define __ROS_NAVIGATOR_THREAD_H_
24 
25 #include <core/threading/thread.h>
26 #include <aspect/blocked_timing.h>
27 #include <aspect/logging.h>
28 #include <aspect/blackboard.h>
29 #include <aspect/configurable.h>
30 
31 #include <interfaces/NavigatorInterface.h>
32 
33 #include <tf/types.h>
34 #include <math.h>
35 #include <ros/ros.h>
36 #include <move_base_msgs/MoveBaseAction.h>
37 #include <move_base_msgs/MoveBaseGoal.h>
38 #include <move_base_msgs/MoveBaseActionGoal.h>
39 #include <actionlib/client/simple_action_client.h>
40 
41 namespace fawkes {
42  class NavigatorInterface;
43 }
44 
46 : public fawkes::Thread,
48  public fawkes::LoggingAspect,
51 {
52  public:
54 
55  virtual void init();
56  virtual void finalize();
57  virtual void loop();
58 
59  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
60  protected: virtual void run() { Thread::run(); }
61 
62  private:
63  void check_status();
64  void send_goal();
65  void stop_goals();
66 
67  private:
68  typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;
69 
71  MoveBaseClient *ac_;
72  move_base_msgs::MoveBaseGoal goal_;
73  bool cmd_sent_;
74  bool connected_history_;
75 };
76 
77 #endif /* __ROS_NAVIGATOR_THREAD_H_ */
virtual void finalize()
Finalize the thread.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Fawkes library namespace.
RosNavigatorThread()
Contructor.
Send Fawkes locomotion commands off to ROS.
Thread class encapsulation of pthreads.
Definition: thread.h:42
virtual void run()
Stub to see name in backtrace for easier debugging.
Thread aspect to use blocked timing.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
NavigatorInterface Fawkes BlackBoard Interface.