kopia lustrzana https://github.com/ogre/pizero_tracker
Fixed dynamics_t
rodzic
1ae35139d5
commit
56257dbde2
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
Ładowanie…
Reference in New Issue