Go to the documentation of this file.
18 #ifndef STATE_ESTIMATION_NODES__MEASUREMENT_TIME_KEEPER_HPP_
19 #define STATE_ESTIMATION_NODES__MEASUREMENT_TIME_KEEPER_HPP_
59 : m_time_last_measurement_received{time_of_event}, m_last_measurement_timestamp{timestamp}
61 m_last_temporal_update = convert_to_measurement_time(time_of_event);
71 return m_time_last_measurement_received.
is_valid() && m_last_temporal_update.
is_valid();
83 template<
typename MeasurementT>
86 const MeasurementT & measurement)
88 m_time_last_measurement_received = time_of_event;
89 m_last_measurement_timestamp = measurement.get_acquisition_time();
102 return convert_to_measurement_time(time_point) - m_last_temporal_update;
114 return time_point - m_last_temporal_update;
123 const MeasurementBasedTime::duration & time_since_last_update) noexcept
125 m_last_temporal_update += time_since_last_update;
135 return std::max(m_last_measurement_timestamp, m_last_temporal_update);
148 const GlobalTime & global_time)
const noexcept
150 return m_last_measurement_timestamp + (global_time - m_time_last_measurement_received);
154 GlobalTime m_time_last_measurement_received{};
166 #endif // STATE_ESTIMATION_NODES__MEASUREMENT_TIME_KEEPER_HPP_
Time< TimeReferenceFrame::kMeasurement > MeasurementBasedTime
Utility typedef to define time based on a measurement clock.
Definition: time.hpp:138
This file includes common type definition.
MeasurementBasedTime::duration time_since_last_temporal_update(const MeasurementBasedTime &time_point) const noexcept
Get the time since the last temporal update.
Definition: measurement_time_keeper.hpp:111
bool bool8_t
Definition: types.hpp:33
common::types::bool8_t is_initialized() const noexcept
Determines if initialized with proper timestamps.
Definition: measurement_time_keeper.hpp:69
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
This is a time storage class that keeps the time with respect to the clock that timestamped the last ...
Definition: measurement_time_keeper.hpp:41
Time< TimeReferenceFrame::kGlobal > GlobalTime
Utility typedef to define time based on some global clock.
Definition: time.hpp:140
MeasurementBasedTime::duration time_since_last_temporal_update(const GlobalTime &time_point) const noexcept
Get the time since the last temporal update in measurement clock frame.
Definition: measurement_time_keeper.hpp:99
void increment_last_temporal_update_time(const MeasurementBasedTime::duration &time_since_last_update) noexcept
Increment the time of last temporal update by a given amount.
Definition: measurement_time_keeper.hpp:122
void update_with_measurement(const GlobalTime &time_of_event, const MeasurementT &measurement)
Update when a new measurement is received. This changes the base of calculation of the local time.
Definition: measurement_time_keeper.hpp:84
common::types::bool8_t is_valid() const noexcept
Determines if the stored time_point is valid.
Definition: time.hpp:67
MeasurementBasedTimeKeeper()=default
Allow empty initialization.
MeasurementBasedTimeKeeper(const GlobalTime &time_of_event, const MeasurementBasedTime ×tamp)
Constructs a new instance from the time the event has occured (measurement was received) and its time...
Definition: measurement_time_keeper.hpp:56
MeasurementBasedTime latest_timestamp() const noexcept
Get the latest stored timestamp.
Definition: measurement_time_keeper.hpp:133