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 <aspect/blackboard.h>
25 #include <aspect/blocked_timing.h>
26 #include <aspect/configurable.h>
27 #include <aspect/logging.h>
28 #include <core/threading/thread.h>
29 #include <core/utils/lockptr.h>
30 #include <geometry_msgs/Twist.h>
31 #include <plugins/ros/aspect/ros.h>
32 #include <ros/subscriber.h>
33 
34 namespace fawkes {
35 class MotorInterface;
36 }
37 
39  public fawkes::LoggingAspect,
42  public fawkes::ROSAspect
43 {
44 public:
46 
47  virtual void init();
48  virtual void loop();
49  virtual bool prepare_finalize_user();
50  virtual void finalize();
51 
52  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
53 protected:
54  virtual void
55  run()
56  {
57  Thread::run();
58  }
59 
60 private:
61  void stop(); //stops all Motors
62  void send_transrot(float vx, float vy, float omega); //sends Controls to the Motors
63  void twist_msg_cb(const geometry_msgs::Twist::ConstPtr &msg);
64 
65 private:
66  fawkes::MotorInterface *motor_if_;
67  ros::Subscriber sub_;
68 };
69 
70 #endif
ROSCmdVelThread::init
virtual void init()
Initialize the thread.
Definition: cmdvel_thread.cpp:41
ROSCmdVelThread::ROSCmdVelThread
ROSCmdVelThread()
Constructor.
Definition: cmdvel_thread.cpp:36
ROSCmdVelThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: cmdvel_thread.h:55
fawkes::MotorInterface
MotorInterface Fawkes BlackBoard Interface.
Definition: MotorInterface.h:34
ROSCmdVelThread::finalize
virtual void finalize()
Finalize the thread.
Definition: cmdvel_thread.cpp:62
ROSCmdVelThread
Thread to translate ROS twist messages to navigator transrot messages.
Definition: cmdvel_thread.h:43
fawkes::BlackBoardAspect
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
fawkes
Fawkes library namespace.
fawkes::LoggingAspect
Thread aspect to log output.
Definition: logging.h:33
fawkes::ROSAspect
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
ROSCmdVelThread::loop
virtual void loop()
Code to execute in the thread.
Definition: cmdvel_thread.cpp:86
ROSCmdVelThread::prepare_finalize_user
virtual bool prepare_finalize_user()
Prepare finalization user implementation.
Definition: cmdvel_thread.cpp:55
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition: configurable.h:33