![]() |
mars_lib
0.1.0.3dc76ee85e09
Modular and Robust Sensor-Fusion
|
BufferClass that holds mars::BufferEntryType elements and provides access methods. More...
#include </home/runner/work/mars_lib/mars_lib/source/mars/include/mars/buffer.h>
Public Member Functions | |
Buffer () | |
Buffer default constructor max buffer size is set to 400 by default. More... | |
Buffer (const int &size) | |
Buffer constructor. More... | |
void | set_max_buffer_size (const int &size) |
set_max_buffer_size More... | |
void | set_keep_last_sensor_handle (const bool &value) |
set_keep_last_sensor_handle More... | |
int | get_max_buffer_size () const |
get_max_buffer_size More... | |
void | ResetBufferData () |
Removes all entrys from the buffer. More... | |
bool | IsEmpty () const |
IsEmpty. More... | |
int | get_length () const |
get_length More... | |
void | PrintBufferEntries () const |
PrintBufferEntries prints all buffer entries in a formatted way. More... | |
bool | get_latest_entry (BufferEntryType *entry) const |
get_latest_entry Returns the last buffer entry More... | |
bool | get_latest_state (BufferEntryType *entry) const |
get_latest_state returns the most recent state entry More... | |
bool | get_oldest_state (BufferEntryType *entry) const |
get_oldest_state Gets the oldest entry with metadata in the state group More... | |
bool | get_oldest_core_state (BufferEntryType *entry) const |
get_oldest_core_state Gets the oldest entry with metadata_ core_state More... | |
bool | get_latest_init_state (BufferEntryType *entry) const |
Gets the latest entry with init_state as metadata. More... | |
bool | get_latest_sensor_handle_state (const std::shared_ptr< SensorAbsClass > &sensor_handle, BufferEntryType *entry) const |
get_latest_sensor_handle_state More... | |
bool | get_latest_sensor_handle_state (const std::shared_ptr< SensorAbsClass > &sensor_handle, BufferEntryType *entry, int *index) const |
get_latest_sensor_handle_state More... | |
bool | get_oldest_sensor_handle_state (const std::shared_ptr< SensorAbsClass > &sensor_handle, BufferEntryType *entry) const |
get_oldest_sensor_handle_state More... | |
bool | get_latest_sensor_handle_measurement (const std::shared_ptr< SensorAbsClass > &sensor_handle, BufferEntryType *entry) const |
get_latest_sensor_handle_measurement More... | |
bool | get_sensor_handle_measurements (const std::shared_ptr< SensorAbsClass > &sensor_handle, std::vector< const BufferEntryType * > *entries) const |
get_sensor_handle_measurements More... | |
bool | get_closest_state (const Time ×tamp, BufferEntryType *entry) const |
get_closest_state More... | |
bool | get_closest_state (const Time ×tamp, BufferEntryType *entry, int *index) const |
bool | get_entry_at_idx (const int &index, BufferEntryType *entry) const |
get_entry_at_idx More... | |
bool | RemoveSensorFromBuffer (const std::shared_ptr< SensorAbsClass > &sensor_handle) |
RemoveSensorFromBuffer Removes all entrys that are associated with the given sensor handle. More... | |
int | AddEntrySorted (const BufferEntryType &new_entry, const bool &after=true) |
AddEntrySorted Adds a new entry to the buffer and ensures the buffer is sorted. More... | |
int | FindClosestTimestamp (const Time ×tamp) const |
FindClosestTimestamp Returns the index of the entry which is the closest to the specified 'timestamp' when searching from newest to oldest entry. More... | |
bool | ClearStatesStartingAtIdx (const int &idx) |
Deletes all states after, and including the given index This also deletes all auto generated states. More... | |
bool | IsSorted () const |
Checks if all buffer entrys are correctly sorted by time. More... | |
bool | OverwriteDataAtIndex (const BufferEntryType &new_entry, const int &index) |
InsertDataAtIndex Adds 'entry' at buffer position 'index'. More... | |
bool | get_intermediate_entry_pair (const std::shared_ptr< SensorAbsClass > &sensor_handle, BufferEntryType *imu_state, BufferEntryType *sensor_state) const |
get_latest_interm_entrie Get last state pair of imu prop and sensor update More... | |
bool | CheckForLastSensorHandleWithState (const std::shared_ptr< SensorAbsClass > &sensor_handle) const |
CheckForLastSensorHandleWithState Checks if the given sensor handle only exists once in the buffer and if it has a state. More... | |
int | RemoveOverflowEntrys () |
RemoveOverflowEntrys Removes the oldest entries if max buffer size is reached. More... | |
Private Attributes | |
std::deque< BufferEntryType > | data_ |
deque container that holds the buffer entries More... | |
int | max_buffer_size_ { 2000 } |
defines the max size at wich the oldest entry is removed More... | |
bool | keep_last_sensor_handle_ { true } |
If true, the last entry of a sensor state entry will be keept in the buffer. More... | |
bool | verbose_ { false } |
Increased cmd output. More... | |
BufferClass that holds mars::BufferEntryType elements and provides access methods.
mars::Buffer::Buffer | ( | ) |
Buffer default constructor max buffer size is set to 400 by default.
mars::Buffer::Buffer | ( | const int & | size | ) |
Buffer constructor.
size | max buffer size |
void mars::Buffer::set_max_buffer_size | ( | const int & | size | ) |
set_max_buffer_size
size | max number of entrys after which the oldest entry is deleted |
void mars::Buffer::set_keep_last_sensor_handle | ( | const bool & | value | ) |
set_keep_last_sensor_handle
value | enables or disables the mechanism to keep the last sensor handle |
int mars::Buffer::get_max_buffer_size | ( | ) | const |
get_max_buffer_size
void mars::Buffer::ResetBufferData | ( | ) |
Removes all entrys from the buffer.
bool mars::Buffer::IsEmpty | ( | ) | const |
IsEmpty.
|
inline |
get_length
void mars::Buffer::PrintBufferEntries | ( | ) | const |
PrintBufferEntries prints all buffer entries in a formatted way.
bool mars::Buffer::get_latest_entry | ( | BufferEntryType * | entry | ) | const |
get_latest_entry Returns the last buffer entry
entry | Output parameter for the latest entry |
bool mars::Buffer::get_latest_state | ( | BufferEntryType * | entry | ) | const |
get_latest_state returns the most recent state entry
entry | Output parameter for the latest state entry |
bool mars::Buffer::get_oldest_state | ( | BufferEntryType * | entry | ) | const |
get_oldest_state Gets the oldest entry with metadata in the state group
entry | Output variable for the oldest state entry |
bool mars::Buffer::get_oldest_core_state | ( | BufferEntryType * | entry | ) | const |
get_oldest_core_state Gets the oldest entry with metadata_ core_state
entry | Output variable for the oldest core state entry |
bool mars::Buffer::get_latest_init_state | ( | BufferEntryType * | entry | ) | const |
Gets the latest entry with init_state as metadata.
entry | Output parameter for the latest init_state entry |
bool mars::Buffer::get_latest_sensor_handle_state | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle, |
BufferEntryType * | entry | ||
) | const |
get_latest_sensor_handle_state
sensor_handle | Seach parameter for the latest assosiated state entry |
entry | Output parameter for the latest sensor handle state entry |
bool mars::Buffer::get_latest_sensor_handle_state | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle, |
BufferEntryType * | entry, | ||
int * | index | ||
) | const |
get_latest_sensor_handle_state
sensor_handle | Seach parameter for the latest assosiated state entry |
entry | Output parameter for the latest sensor handle state entry |
index | Returns the current index of this entry |
bool mars::Buffer::get_oldest_sensor_handle_state | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle, |
BufferEntryType * | entry | ||
) | const |
get_oldest_sensor_handle_state
sensor_handle | seach parameter for the oldest assosiated state entry |
entry | output parameter for the oldest sensor handle state entry |
bool mars::Buffer::get_latest_sensor_handle_measurement | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle, |
BufferEntryType * | entry | ||
) | const |
get_latest_sensor_handle_measurement
sensor_handle | seach parameter for the latest associated measurement entry |
entry | output parameter for the latest sensor handle measurement entry |
bool mars::Buffer::get_sensor_handle_measurements | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle, |
std::vector< const BufferEntryType * > * | entries | ||
) | const |
get_sensor_handle_measurements
sensor_handle | seach parameter for the all associated measurement entries |
entries | output parameter for the sensor handle measurement entries |
bool mars::Buffer::get_closest_state | ( | const Time & | timestamp, |
BufferEntryType * | entry | ||
) | const |
get_closest_state
timestamp | |
entry |
bool mars::Buffer::get_closest_state | ( | const Time & | timestamp, |
BufferEntryType * | entry, | ||
int * | index | ||
) | const |
bool mars::Buffer::get_entry_at_idx | ( | const int & | index, |
BufferEntryType * | entry | ||
) | const |
get_entry_at_idx
index | |
entry |
bool mars::Buffer::RemoveSensorFromBuffer | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle | ) |
RemoveSensorFromBuffer Removes all entrys that are associated with the given sensor handle.
sensor_handle | Sensor handle to be removed |
int mars::Buffer::AddEntrySorted | ( | const BufferEntryType & | new_entry, |
const bool & | after = true |
||
) |
AddEntrySorted Adds a new entry to the buffer and ensures the buffer is sorted.
new_entry | new buffer entry to be added |
The method finds the closest timestamp based on the shortest 'time' distance between the new and existing buffer elements. It then determines if the entry needs to be added before or after the closest entry.
int mars::Buffer::FindClosestTimestamp | ( | const Time & | timestamp | ) | const |
FindClosestTimestamp Returns the index of the entry which is the closest to the specified 'timestamp' when searching from newest to oldest entry.
timestamp | for the surch routine |
bool mars::Buffer::ClearStatesStartingAtIdx | ( | const int & | idx | ) |
Deletes all states after, and including the given index This also deletes all auto generated states.
idx | Start index after which all states are deleted |
bool mars::Buffer::IsSorted | ( | ) | const |
Checks if all buffer entrys are correctly sorted by time.
bool mars::Buffer::OverwriteDataAtIndex | ( | const BufferEntryType & | new_entry, |
const int & | index | ||
) |
InsertDataAtIndex Adds 'entry' at buffer position 'index'.
new_entry | Entry buffer entry to be added |
index | position at which the entry is added |
bool mars::Buffer::get_intermediate_entry_pair | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle, |
BufferEntryType * | imu_state, | ||
BufferEntryType * | sensor_state | ||
) | const |
get_latest_interm_entrie Get last state pair of imu prop and sensor update
This function provides a state pair for an intermediate propagated state and a corresponding sensor update for the same point in time. The intermediate state reflects the propagation of the latest real IMU measurement to the current point in time at which the sensor update will be performed. This is mostelikely an auto generated state, added via the 'InsertIntermediateData' function.
bool mars::Buffer::CheckForLastSensorHandleWithState | ( | const std::shared_ptr< SensorAbsClass > & | sensor_handle | ) | const |
CheckForLastSensorHandleWithState Checks if the given sensor handle only exists once in the buffer and if it has a state.
sensor_handle |
int mars::Buffer::RemoveOverflowEntrys | ( | ) |
RemoveOverflowEntrys Removes the oldest entries if max buffer size is reached.
|
private |
deque container that holds the buffer entries
|
private |
defines the max size at wich the oldest entry is removed
|
private |
If true, the last entry of a sensor state entry will be keept in the buffer.
|
private |
Increased cmd output.