Fawkes API Fawkes Development Version
joint_thread.h
1
2/***************************************************************************
3 * joint_thread.h - Thread to publish JointStates to ROS
4 *
5 * Created: Wed Sep 25 18:27:26 2013
6 * Copyright 2013 Till Hofmann
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_JOINT_THREAD_H_
23#define _PLUGINS_ROS_JOINT_THREAD_H_
24
25// TODO check includes
26#include <aspect/blackboard.h>
27#include <aspect/blocked_timing.h>
28#include <aspect/logging.h>
29#include <blackboard/interface_listener.h>
30#include <blackboard/interface_observer.h>
31#include <core/threading/mutex.h>
32#include <core/threading/thread.h>
33#include <interfaces/JointInterface.h>
34#include <plugins/ros/aspect/ros.h>
35
36#include <list>
37
38// from ROS
39#include <ros/node_handle.h>
40
44 public fawkes::ROSAspect,
47{
48public:
50 virtual ~RosJointThread();
51
52 virtual void init();
53 virtual void finalize();
54
55 virtual void bb_interface_created(const char *type, const char *id) noexcept;
56 virtual void bb_interface_writer_removed(fawkes::Interface *interface,
57 fawkes::Uuid instance_serial) noexcept;
58 virtual void bb_interface_reader_removed(fawkes::Interface *interface,
59 fawkes::Uuid instance_serial) noexcept;
60 virtual void bb_interface_data_refreshed(fawkes::Interface *interface) noexcept;
61
62private:
63 void conditional_close(fawkes::Interface *interface) noexcept;
64
65private:
66 ros::Publisher ros_pub_;
67 std::list<fawkes::JointInterface *> ifs_;
68};
69
70#endif
Thread to publish JointStates to ROS.
Definition: joint_thread.h:47
virtual void bb_interface_created(const char *type, const char *id) noexcept
BlackBoard interface created notification.
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual void bb_interface_writer_removed(fawkes::Interface *interface, fawkes::Uuid instance_serial) noexcept
A writing instance has been closed for a watched interface.
virtual void bb_interface_data_refreshed(fawkes::Interface *interface) noexcept
BlackBoard data refreshed notification.
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 ~RosJointThread()
Destructor.
RosJointThread()
Constructor.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
BlackBoard interface listener.
BlackBoard interface observer.
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