Fawkes API Fawkes Development Version
gazsim_laser_thread.h
1/***************************************************************************
2 * gazsim_laser_thread.h - Thread simulate the Hokuyo in Gazebo
3 *
4 * Created: Thu Aug 08 15:47:12 2013
5 * Copyright 2013 Frederik Zwilling
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_GAZSIM_LASER_THREAD_H_
22#define _PLUGINS_GAZSIM_LASER_THREAD_H_
23
24#include <aspect/blackboard.h>
25#include <aspect/blocked_timing.h>
26#include <aspect/clock.h>
27#include <aspect/configurable.h>
28#include <aspect/logging.h>
29#include <core/threading/thread.h>
30#include <plugins/gazebo/aspect/gazebo.h>
31
32//from Gazebo
33#include <gazebo/msgs/MessageTypes.hh>
34#include <gazebo/transport/TransportTypes.hh>
35#include <gazebo/transport/transport.hh>
36
37namespace fawkes {
38class Laser360Interface;
39class Time;
40} // namespace fawkes
41
49{
50public:
52
53 virtual void init();
54 virtual void loop();
55 virtual void finalize();
56
57private:
58 ///Subscriber to receive laser data from gazebo
59 gazebo::transport::SubscriberPtr laser_sub_;
60 std::string laser_topic_;
61
62 ///provided interface
64
65 ///storage for laser data
66 float * laser_data_;
67 fawkes::Time *laser_time_;
68
69 ///is there new information to write in the interface?
70 bool new_data_;
71
72 ///handler function for incoming laser data messages
73 void on_laser_data_msg(ConstLaserScanStampedPtr &msg);
74
75 ///maximal range of the laser sensor
76 float max_range_;
77
78 std::string interface_id_;
79 std::string frame_id_;
80};
81
82#endif
Thread simulates the Hokuyo in Gazebo.
LaserSimThread()
Constructor.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to get access to a Gazebo node handle.
Definition: gazebo.h:37
Laser360Interface Fawkes BlackBoard Interface.
Thread aspect to log output.
Definition: logging.h:33
Thread class encapsulation of pthreads.
Definition: thread.h:46
A class for handling time.
Definition: time.h:93
Fawkes library namespace.