Fawkes API  Fawkes Development Version
fawkes::GazsimTimesource Class Reference

This time-source provides the simulation time from Gazebo in Fawkes. More...

#include <gazsim_timesource_source.h>

Inheritance diagram for fawkes::GazsimTimesource:

Public Member Functions

 GazsimTimesource (Clock *clock)
 Constructor. More...
 
 ~GazsimTimesource ()
 Destructor. More...
 
virtual void get_time (timeval *tv) const
 The Simulation time is estimated by looking at the timeinterval to the last received msg and the last real time factor. More...
 
virtual timeval conv_to_realtime (const timeval *tv) const
 Convert a time given w.r.t. More...
 
virtual timeval conv_native_to_exttime (const timeval *tv) const
 Convert a native time to the external time. More...
 
void on_time_sync_msg (ConstSimTimePtr &msg)
 store data from gazebo time message More...
 
- Public Member Functions inherited from fawkes::TimeSource
virtual ~TimeSource ()
 Destructor. More...
 

Detailed Description

This time-source provides the simulation time from Gazebo in Fawkes.

Author
Frederik Zwilling

Definition at line 41 of file gazsim_timesource_source.h.

Constructor & Destructor Documentation

◆ GazsimTimesource()

GazsimTimesource::GazsimTimesource ( Clock clock)

Constructor.

Parameters
clockpointer to fawkes clock

Definition at line 31 of file gazsim_timesource_source.cpp.

References fawkes::Clock::get_systime().

Referenced by GazsimTimesourceThread::init().

◆ ~GazsimTimesource()

GazsimTimesource::~GazsimTimesource ( )

Destructor.

Definition at line 41 of file gazsim_timesource_source.cpp.

Member Function Documentation

◆ conv_native_to_exttime()

timeval GazsimTimesource::conv_native_to_exttime ( const timeval *  tv) const
virtual

Convert a native time to the external time.

When communicating with another instance which provides times in some timeformat native to the underlying time source (e.g. received from a simulation) it must be converted to a Fawkes time.

Parameters
tvtime in external time source native format
Returns
time in Fawkes comparable to other times generated using the external timesource.

Implements fawkes::TimeSource.

Definition at line 86 of file gazsim_timesource_source.cpp.

◆ conv_to_realtime()

timeval GazsimTimesource::conv_to_realtime ( const timeval *  tv) const
virtual

Convert a time given w.r.t.

this time sources into system time.

Parameters
tvthe time to convert
Returns
the converted time

Implements fawkes::TimeSource.

Definition at line 71 of file gazsim_timesource_source.cpp.

◆ get_time()

void GazsimTimesource::get_time ( timeval *  tv) const
virtual

The Simulation time is estimated by looking at the timeinterval to the last received msg and the last real time factor.

With this method, I want to reduce the number of send messages from Gazebo

Parameters
tvtimeinterval

Implements fawkes::TimeSource.

Definition at line 52 of file gazsim_timesource_source.cpp.

Referenced by on_time_sync_msg().

◆ on_time_sync_msg()

void GazsimTimesource::on_time_sync_msg ( ConstSimTimePtr &  msg)

store data from gazebo time message

Parameters
msgmessage

Definition at line 104 of file gazsim_timesource_source.cpp.

References fawkes::Clock::get_systime(), and get_time().


The documentation for this class was generated from the following files: