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
34namespace fawkes {
35class MotorInterface;
36}
37
43{
44public:
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() */
53protected:
54 virtual void
56 {
57 Thread::run();
58 }
59
60private:
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
65private:
66 fawkes::MotorInterface *motor_if_;
67 ros::Subscriber sub_;
68};
69
70#endif
Thread to translate ROS twist messages to navigator transrot messages.
Definition: cmdvel_thread.h:43
ROSCmdVelThread()
Constructor.
virtual void loop()
Code to execute in the thread.
virtual bool prepare_finalize_user()
Prepare finalization user implementation.
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: cmdvel_thread.h:55
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
MotorInterface Fawkes BlackBoard Interface.
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.