13#ifndef DelayedMeasurementObserverHPP
14#define DelayedMeasurementObserverHPP
16#include <boost/circular_buffer.hpp>
18#include <state-observation/api.h>
24class AsynchronousDataBase
27 AsynchronousDataBase() {}
30 virtual ~AsynchronousDataBase() {}
31 virtual void merge(
const AsynchronousDataBase & input2) = 0;
34class AsynchronousDataMapBase
37 AsynchronousDataMapBase() {}
40 virtual ~AsynchronousDataMapBase() {}
41 virtual bool checkIndex(TimeIndex k) = 0;
43 virtual bool empty()
const = 0;
44 virtual void erase(TimeIndex k) = 0;
45 virtual void clear() = 0;
47 virtual TimeIndex getFirstIndex() = 0;
50template<
typename DataType>
54 inline bool checkIndex(TimeIndex k)
override;
56 inline void clear()
override;
57 inline void erase(TimeIndex k)
override;
58 inline bool empty()
const override;
60 inline TimeIndex getFirstIndex()
override;
63 std::map<TimeIndex, DataType> v_;
66template<
typename DataType>
69template<
typename DataType>
89 unsigned long bufferCapacity,
90 const std::shared_ptr<IndexedInputArrayInterface> input =
nullptr,
91 const std::shared_ptr<AsynchronousDataMapBase> async_input =
nullptr,
92 const std::shared_ptr<AsynchronousDataMapBase> async_meas =
nullptr);
184 xBuffer_.set_capacity(stateCapacity);
192 inline double getSamplingTime()
197 TimeIndex getAsynchronousFirstIndex();
203 typedef boost::circular_buffer<IndexedVector>::iterator StateIterator;
208 virtual void startNewIteration_() = 0;
210 inline const boost::circular_buffer<IndexedVector> & getStateVectorBuffer()
const
215 bool stateIsSet()
const;
223 IndexedVectorArray
y_;
225 std::shared_ptr<IndexedInputArrayInterface>
u_;
229 TimeIndex currentIterIndex_;
238#include <state-observation/observer/delayed-measurements-observer.hxx>
void setCurrentState(const ObserverBase::StateVector &x_k)
Modify the value of the state vector at the current time.
void setSamplingTime(const double dt)
set the sampling time of the measurements
const ObserverBase::StateVector & getCurrentEstimatedState()
Get the Current Estimated State.
virtual StateVector oneStepEstimation_(StateIterator it)=0
Runs one loop of the estimator.
boost::circular_buffer< IndexedVector > xBuffer_
The state estimation of the observer (only one state is recorded).
virtual void initEstimator(const Vector &x)
initializes the state vector.
virtual void clearStates() override
Removes the state estimation.
virtual void setStateCapacity(unsigned long stateCapacity)
set the sampling time of the measurements
DelayedMeasurementObserver(const DelayedMeasurementObserver &)=delete
Not copyable: the copy would share the buffers of inputs and measurements.
DelayedMeasurementObserver()=delete
Default constructor.
virtual ~DelayedMeasurementObserver()
Destructor.
virtual TimeIndex getMeasurementTime() const
Get the time index of the last given measurement.
std::shared_ptr< AsynchronousDataMapBase > y_asynchronous_
Container for the asynchronous measurements.
IndexedVectorArray y_
Container for the measurements.
virtual void setState(const ObserverBase::StateVector &x_k, TimeIndex k) override
Set the value of the state vector at time index k.
virtual void setInput(const InputBase &u_k, TimeIndex k) override
Vector getMeasurement(TimeIndex k) const
Get the measurement of the time index k.
virtual void clearInputs() override
std::shared_ptr< IndexedInputArrayInterface > u_
Container for the inputs.
virtual TimeIndex getCurrentTime() const
Get the value of the time index of the current state estimation.
virtual const ObserverBase::StateVector & getEstimatedState(TimeIndex k) override
getestimated State
virtual void clearDelayedInputs()
std::shared_ptr< AsynchronousDataMapBase > u_asynchronous_
Container for the asynchronous inputs.
virtual void clearMeasurements() override
Remove all the given values of the measurements.
DelayedMeasurementObserver(double dt, Index n, Index m, unsigned long bufferCapacity, const std::shared_ptr< IndexedInputArrayInterface > input=nullptr, const std::shared_ptr< AsynchronousDataMapBase > async_input=nullptr, const std::shared_ptr< AsynchronousDataMapBase > async_meas=nullptr)
virtual void clearDelayedMeasurements()
Remove all the given values of the measurements.
void setMeasurement(const Vector &y, TimeIndex k) override
sets the measurement
Vector StateVector
StateVector is the type of state vector.
ObserverBase(Index n, Index m)
InputVector is the type of the input vector.
Filtering of divergent component of motion (DCM) and estimation of a bias betweeen the DCM and the co...
Eigen::VectorXd Vector
Dynamic sized scalar vector.
Defines the base class of a state observer. The observer is destinated to any dynamical system with a...