Fawkes API
Fawkes Development Version
gazsim_timesource_thread.h
1
/***************************************************************************
2
* gazsim_timesource_plugin.cpp - Plugin sets the fawkes time
3
* to the simulation time
4
*
5
* Created: Sat Sep 21 20:56:38 2013
6
* Copyright 2013 Frederik Zwilling
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#ifndef _PLUGINS_GAZSIMTIMESOURCE_THREAD_H__
24
#define _PLUGINS_GAZSIMTIMESOURCE_THREAD_H__
25
26
#include "../msgs/SimTime.pb.h"
27
#include "gazsim_timesource_source.h"
28
29
#include <aspect/blocked_timing.h>
30
#include <aspect/clock.h>
31
#include <aspect/configurable.h>
32
#include <aspect/logging.h>
33
#include <core/threading/thread.h>
34
#include <google/protobuf/message.h>
35
#include <plugins/gazebo/aspect/gazebo.h>
36
37
#include <boost/asio.hpp>
38
#include <gazebo/physics/physics.hh>
39
40
typedef
const
boost::shared_ptr<gazsim_msgs::SimTime const> ConstSimTimePtr;
41
42
class
GazsimTimesourceThread
:
public
fawkes::Thread
,
43
public
fawkes::ClockAspect
,
44
public
fawkes::BlockedTimingAspect
,
45
public
fawkes::ConfigurableAspect
,
46
public
fawkes::LoggingAspect
,
47
public
fawkes::GazeboAspect
48
{
49
public
:
50
GazsimTimesourceThread
();
51
~
GazsimTimesourceThread
();
52
53
virtual
void
init
();
54
virtual
void
loop
();
55
virtual
void
finalize
();
56
57
private
:
58
//Timesource to give the fawkes clock
59
fawkes::GazsimTimesource
*time_source_;
60
61
//subscriber to get time msgs from
62
gazebo::transport::SubscriberPtr time_sync_sub_;
63
64
//handler
65
void
on_time_sync_msg(ConstSimTimePtr &msg);
66
};
67
68
#endif
fawkes::GazeboAspect
Definition:
gazebo.h:40
fawkes::GazsimTimesource
Definition:
gazsim_timesource_source.h:39
GazsimTimesourceThread::finalize
virtual void finalize()
Finalize the thread.
Definition:
gazsim_timesource_thread.cpp:59
fawkes::BlockedTimingAspect
Definition:
blocked_timing.h:54
GazsimTimesourceThread::init
virtual void init()
Initialize the thread.
Definition:
gazsim_timesource_thread.cpp:42
GazsimTimesourceThread
Definition:
gazsim_timesource_thread.h:41
fawkes::LoggingAspect
Definition:
logging.h:36
fawkes::Thread
Definition:
thread.h:44
GazsimTimesourceThread::loop
virtual void loop()
Code to execute in the thread.
Definition:
gazsim_timesource_thread.cpp:67
fawkes::ConfigurableAspect
Definition:
configurable.h:36
fawkes::ClockAspect
Definition:
clock.h:38
src
plugins
gazebo
gazsim-timesource
gazsim_timesource_thread.h
Generated by
1.8.16