Fixed dynamics_t

master
Michal Fratczak 2020-04-16 12:03:38 +02:00
rodzic 1ae35139d5
commit 56257dbde2
2 zmienionych plików z 2 dodań i 4 usunięć

Wyświetl plik

@ -10,7 +10,6 @@ bool dynamics_t::add(const tp timestamp, const float val)
if( !initialised_ && timestamp.time_since_epoch().count() )
{
val_ = val;
val_prev_ = val;
val_prev_timestamp_ = timestamp;
dVdT_ = 0;
@ -26,7 +25,7 @@ bool dynamics_t::add(const tp timestamp, const float val)
if( (timestamp - val_prev_timestamp_).count() < min_dT_ )
return false;
dVdT_ = (val - val_prev_) / float((timestamp - val_prev_timestamp_).count());
dVdT_ = (val - val_) / float((timestamp - val_prev_timestamp_).count());
if(val > val_max_)
val_max_ = val;
@ -34,7 +33,7 @@ bool dynamics_t::add(const tp timestamp, const float val)
if(val < val_min_)
val_min_ = val;
val_prev_ = val;
val_ = val;
val_prev_timestamp_ = timestamp;
return true;

Wyświetl plik

@ -13,7 +13,6 @@ public:
private:
bool initialised_ = false;
float val_ = 0;
float val_prev_ = 0;
tp val_prev_timestamp_; // timestamp of previous value
float val_min_ = std::numeric_limits<float>::max();
float val_max_ = -std::numeric_limits<float>::min();