mars_lib 0.1.0.2abe2576fe7f
Modular and Robust Sensor-Fusion
Loading...
Searching...
No Matches
core_logic.h
Go to the documentation of this file.
1// Copyright (C) 2021 Christian Brommer, Control of Networked Systems, University of Klagenfurt, Austria.
2//
3// All rights reserved.
4//
5// This software is licensed under the terms of the BSD-2-Clause-License with
6// no commercial use allowed, the full terms of which are made available
7// in the LICENSE file. No license in patents is granted.
8//
9// You can contact the author at <christian.brommer@ieee.org>
10
11#ifndef CORELOGIC_H
12#define CORELOGIC_H
13
14#include <mars/buffer.h>
15#include <mars/core_state.h>
16#include <mars/sensor_manager.h>
18#include <Eigen/Dense>
19#include <iostream>
20#include <memory>
21
22namespace mars
23{
28{
29public:
30 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
31
32 std::shared_ptr<CoreState> core_states_{ nullptr };
36 bool core_is_initialized_{ false };
38 bool core_init_warn_once_{ false };
39 bool verbose_{ false };
40 bool verbose_out_of_order_{ false };
41 bool discard_ooo_prop_meas_{ false };
44
49 CoreLogic(std::shared_ptr<CoreState> core_states);
50 CoreLogic() = default;
51
58 int Initialize(const Eigen::Vector3d& p_wi_init, const Eigen::Quaterniond& q_wi_init);
59
64 CoreStateMatrix GenerateStateTransitionBlock(const int& first_transition_idx, const int& last_transition_idx);
65
69 Eigen::MatrixXd PropagateSensorCrossCov(const Eigen::MatrixXd& sensor_cov, const CoreStateMatrix& core_cov,
70 const CoreStateMatrix& state_transition);
71
75 bool PerformSensorUpdate(std::shared_ptr<SensorAbsClass> sensor, const Time& timestamp, BufferEntryType* sensor_data);
76 bool PerformSensorUpdate(std::shared_ptr<SensorAbsClass> sensor, const Time& timestamp, BufferEntryType* sensor_data,
77 bool* added_interm_state);
78
89 void PerformCoreStatePropagation(std::shared_ptr<SensorAbsClass> sensor, const Time& timestamp,
90 const BufferEntryType& prior_state_entry, BufferEntryType* sensor_entry);
91
107 void ReworkBufferStartingAtIndex(const int& index);
108
130 bool ProcessMeasurement(std::shared_ptr<SensorAbsClass> sensor, const Time& timestamp, const BufferDataType& data);
131};
132} // namespace mars
133
134#endif // CORELOGIC_H
The BufferDataType binds the core and sensor state in form of a shared void pointer.
Definition buffer_data_type.h:36
Definition buffer_entry_type.h:41
BufferClass that holds mars::BufferEntryType elements and provides access methods.
Definition buffer.h:35
The CoreLogic class represents the high-level logic for the operation of the filter.
Definition core_logic.h:28
bool verbose_
Definition core_logic.h:39
bool PerformSensorUpdate(std::shared_ptr< SensorAbsClass > sensor, const Time &timestamp, BufferEntryType *sensor_data)
PerformSensorUpdate Returns new state with corrected state and updated covariance.
SensorManager sensor_manager_
Buffer that holds measurements prior initialization.
Definition core_logic.h:35
bool core_init_warn_once_
Definition core_logic.h:38
void PerformCoreStatePropagation(std::shared_ptr< SensorAbsClass > sensor, const Time &timestamp, const BufferEntryType &prior_state_entry, BufferEntryType *sensor_entry)
PerformCoreStatePropagation Propagates the core state and returns the new state entry.
int Initialize(const Eigen::Vector3d &p_wi_init, const Eigen::Quaterniond &q_wi_init)
Initialize the filter with information available in the prior init buffer.
void ReworkBufferStartingAtIndex(const int &index)
ReworkBufferStartingAtIndex Reprocesses the buffer after an out of order update, starting at given 'i...
CoreLogic(std::shared_ptr< CoreState > core_states)
CoreLogic.
CoreStateMatrix GenerateStateTransitionBlock(const int &first_transition_idx, const int &last_transition_idx)
GenerateStateTransitionBlock Returns the state transition block between 'first_transition_idx' and 'l...
Buffer buffer_
Holds a pointer to the core_states.
Definition core_logic.h:33
bool ProcessMeasurement(std::shared_ptr< SensorAbsClass > sensor, const Time &timestamp, const BufferDataType &data)
ProcessMeasurement Processes the sensor input.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW std::shared_ptr< CoreState > core_states_
Definition core_logic.h:32
Buffer buffer_prior_core_init_
Main buffer of the filter.
Definition core_logic.h:34
bool PerformSensorUpdate(std::shared_ptr< SensorAbsClass > sensor, const Time &timestamp, BufferEntryType *sensor_data, bool *added_interm_state)
CoreLogic()=default
bool core_is_initialized_
Definition core_logic.h:36
bool discard_ooo_prop_meas_
Increased output of information for delayed measurements.
Definition core_logic.h:41
Eigen::MatrixXd PropagateSensorCrossCov(const Eigen::MatrixXd &sensor_cov, const CoreStateMatrix &core_cov, const CoreStateMatrix &state_transition)
PropagateSensorCrossCov.
bool add_interm_buffer_entries_
Discard out of order propagation sensor measurements.
Definition core_logic.h:42
bool verbose_out_of_order_
Increased output of information.
Definition core_logic.h:40
Definition sensor_manager.h:22
Definition time.h:20
Definition buffer.h:27
Eigen::Matrix< double, CoreStateType::size_error_, CoreStateType::size_error_ > CoreStateMatrix
Definition core_state_type.h:134