Fawkes API  Fawkes Development Version
cmdvel_thread.h
1 /***************************************************************************
2  * cmdvel_thread.h - Translate ROS Twist messages to Navgiator transrot
3  *
4  * Created: Fri Jun 1 13:29:39 CEST 2012
5  * Copyright 2012 Sebastian Reuter
6  ****************************************************************************/
7 
8 /* This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Library General Public License for more details.
17  *
18  * Read the full text in the LICENSE.GPL file in the doc directory.
19  */
20 
21 #ifndef __PLUGINS_ROS_CMDVEL_THREAD_H_
22 #define __PLUGINS_ROS_CMDVEL_THREAD_H_
23 
24 #include <core/threading/thread.h>
25 #include <core/utils/lockptr.h>
26 #include <aspect/logging.h>
27 #include <aspect/configurable.h>
28 #include <aspect/blocked_timing.h>
29 #include <aspect/blackboard.h>
30 #include <plugins/ros/aspect/ros.h>
31 #include <ros/subscriber.h>
32 #include <geometry_msgs/Twist.h>
33 
34 
35 namespace fawkes {
36  class MotorInterface;
37 }
38 
40 : public fawkes::Thread,
41  public fawkes::LoggingAspect,
44  public fawkes::ROSAspect
45 {
46  public:
48 
49  virtual void init();
50  virtual void loop();
51  virtual bool prepare_finalize_user();
52  virtual void finalize();
53 
54  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
55  protected: virtual void run() { Thread::run(); }
56 
57 private:
58  void stop(); //stops all Motors
59  void send_transrot(float vx, float vy, float omega); //sends Controls to the Motors
60  void twist_msg_cb(const geometry_msgs::Twist::ConstPtr &msg);
61 
62  private:
63  fawkes::MotorInterface *motor_if_;
64  ros::Subscriber sub_;
65 };
66 
67 #endif
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: cmdvel_thread.h:55
Thread to translate ROS twist messages to navigator transrot messages.
Definition: cmdvel_thread.h:39
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
MotorInterface Fawkes BlackBoard Interface.