Fawkes API Fawkes Development Version
position_3d_thread.h
1/***************************************************************************
2 * position_3d_thread.h - Publish 3D Position to ROS
3 *
4 * Created: Wed Jul 16 17:04:42 2014
5 * Copyright 2014 Till Hofmann
6 *
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 _PLUGINS_ROS_POSITION_3D_THREAD_H_
23#define _PLUGINS_ROS_POSITION_3D_THREAD_H_
24
25// TODO check includes
26#include <aspect/blackboard.h>
27#include <aspect/blocked_timing.h>
28#include <aspect/configurable.h>
29#include <aspect/logging.h>
30#include <blackboard/interface_listener.h>
31#include <blackboard/interface_observer.h>
32#include <core/threading/mutex.h>
33#include <core/threading/thread.h>
34#include <interfaces/Position3DInterface.h>
35#include <plugins/ros/aspect/ros.h>
36
37#include <list>
38
39// from ROS
40#include <ros/node_handle.h>
41
46 public fawkes::ROSAspect,
49{
50public:
52 virtual ~RosPosition3DThread();
53
54 virtual void init();
55 virtual void finalize();
56
57 virtual void bb_interface_created(const char *type, const char *id) noexcept;
58 virtual void bb_interface_writer_removed(fawkes::Interface *interface,
59 fawkes::Uuid instance_serial) noexcept;
60 virtual void bb_interface_reader_removed(fawkes::Interface *interface,
61 fawkes::Uuid instance_serial) noexcept;
62 virtual void bb_interface_data_refreshed(fawkes::Interface *interface) noexcept;
63
64private:
65 void conditional_close(fawkes::Interface *interface) noexcept;
66
67private:
68 ros::Publisher ros_pub_;
69 std::list<fawkes::Position3DInterface *> ifs_;
70 std::string cfg_ros_topic_;
71};
72
73#endif
Thread to publish Position3Ds to ROS.
virtual ~RosPosition3DThread()
Destructor.
virtual void init()
Initialize the thread.
virtual void bb_interface_data_refreshed(fawkes::Interface *interface) noexcept
BlackBoard data refreshed notification.
virtual void finalize()
Finalize the thread.
virtual void bb_interface_reader_removed(fawkes::Interface *interface, fawkes::Uuid instance_serial) noexcept
A reading instance has been closed for a watched interface.
virtual void bb_interface_writer_removed(fawkes::Interface *interface, fawkes::Uuid instance_serial) noexcept
A writing instance has been closed for a watched interface.
RosPosition3DThread()
Constructor.
virtual void bb_interface_created(const char *type, const char *id) noexcept
BlackBoard interface created notification.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
BlackBoard interface listener.
BlackBoard interface observer.
Thread aspect to access configuration data.
Definition: configurable.h:33
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
Thread aspect to log output.
Definition: logging.h:33
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Thread class encapsulation of pthreads.
Definition: thread.h:46
A convenience class for universally unique identifiers (UUIDs).
Definition: uuid.h:29