ROSEndEffector
ROS End-Effector package: provides a ROS-based set of standard interfaces to command robotics end-effectors in an agnostic fashion.
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ROSEE::Utils::SecondOrderFilter< SignalType > Class Template Reference

#include <Utils.h>

+ Collaboration diagram for ROSEE::Utils::SecondOrderFilter< SignalType >:

Public Types

typedef std::shared_ptr< SecondOrderFilter< SignalType > > Ptr
 

Public Member Functions

 SecondOrderFilter ()
 
 SecondOrderFilter (double omega, double eps, double ts, const SignalType &initial_state)
 
void reset (const SignalType &initial_state)
 
const SignalType & process (const SignalType &input)
 
const SignalType & getOutput () const
 
void setOmega (double omega)
 
double getOmega ()
 
void setDamping (double eps)
 
double getDamping ()
 
void setTimeStep (double ts)
 
double getTimeStep ()
 

Private Member Functions

void computeCoeff ()
 

Private Attributes

double _omega
 
double _eps
 
double _ts
 
double _b1
 
double _b2
 
double _a0
 
double _a1
 
double _a2
 
bool _reset_has_been_called
 
SignalType _y
 
SignalType _yd
 
SignalType _ydd
 
SignalType _u
 
SignalType _ud
 
SignalType _udd
 

Detailed Description

template<typename SignalType>
class ROSEE::Utils::SecondOrderFilter< SignalType >

Definition at line 294 of file Utils.h.

Member Typedef Documentation

template<typename SignalType>
typedef std::shared_ptr<SecondOrderFilter<SignalType> > ROSEE::Utils::SecondOrderFilter< SignalType >::Ptr

Definition at line 299 of file Utils.h.

Constructor & Destructor Documentation

template<typename SignalType>
ROSEE::Utils::SecondOrderFilter< SignalType >::SecondOrderFilter ( )
inline

Definition at line 301 of file Utils.h.

301  :
302  _omega ( 1.0 ),
303  _eps ( 0.8 ),
304  _ts ( 0.01 ),
305  _reset_has_been_called ( false )
306  {
307  computeCoeff();
308  }
template<typename SignalType>
ROSEE::Utils::SecondOrderFilter< SignalType >::SecondOrderFilter ( double  omega,
double  eps,
double  ts,
const SignalType &  initial_state 
)
inline

Definition at line 310 of file Utils.h.

310  :
311  _omega ( omega ),
312  _eps ( eps ),
313  _ts ( ts ),
314  _reset_has_been_called ( false )
315  {
316  computeCoeff();
317  reset ( initial_state );
318  }
void reset(const SignalType &initial_state)
Definition: Utils.h:320

Member Function Documentation

template<typename SignalType>
void ROSEE::Utils::SecondOrderFilter< SignalType >::computeCoeff ( )
inlineprivate

Definition at line 391 of file Utils.h.

392  {
393  _b1 = 2.0;
394  _b2 = 1.0;
395 
396  _a0 = 1.0 + 4.0*_eps/ ( _omega*_ts ) + 4.0/std::pow ( _omega*_ts, 2.0 );
397  _a1 = 2 - 8.0/std::pow ( _omega*_ts, 2.0 );
398  _a2 = 1.0 + 4.0/std::pow ( _omega*_ts, 2.0 ) - 4.0*_eps/ ( _omega*_ts );
399 
400  }
template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::getDamping ( )
inline

Definition at line 373 of file Utils.h.

374  {
375  return _eps;
376  }
template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::getOmega ( )
inline

Definition at line 362 of file Utils.h.

363  {
364  return _omega;
365  }
template<typename SignalType>
const SignalType& ROSEE::Utils::SecondOrderFilter< SignalType >::getOutput ( ) const
inline

Definition at line 351 of file Utils.h.

352  {
353  return _y;
354  }
template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::getTimeStep ( )
inline

Definition at line 384 of file Utils.h.

385  {
386  return _ts;
387  }
template<typename SignalType>
const SignalType& ROSEE::Utils::SecondOrderFilter< SignalType >::process ( const SignalType &  input)
inline

Definition at line 331 of file Utils.h.

332  {
333 
334  if ( !_reset_has_been_called ) {
335  reset ( input*0 );
336  }
337 
338 
339  _ydd = _yd;
340  _yd = _y;
341  _udd = _ud;
342  _ud = _u;
343 
344 
345  _u = input;
346  _y = 1.0/_a0 * ( _u + _b1*_ud + _b2*_udd - _a1*_yd - _a2*_ydd );
347 
348  return _y;
349  }
void reset(const SignalType &initial_state)
Definition: Utils.h:320
template<typename SignalType>
void ROSEE::Utils::SecondOrderFilter< SignalType >::reset ( const SignalType &  initial_state)
inline

Definition at line 320 of file Utils.h.

321  {
322  _reset_has_been_called = true;
323  _u = initial_state;
324  _y = initial_state;
325  _yd = initial_state;
326  _ydd = initial_state;
327  _udd = initial_state;
328  _ud = initial_state;
329  }
template<typename SignalType>
void ROSEE::Utils::SecondOrderFilter< SignalType >::setDamping ( double  eps)
inline

Definition at line 367 of file Utils.h.

368  {
369  _eps = eps;
370  computeCoeff();
371  }
template<typename SignalType>
void ROSEE::Utils::SecondOrderFilter< SignalType >::setOmega ( double  omega)
inline

Definition at line 356 of file Utils.h.

357  {
358  _omega = omega;
359  computeCoeff();
360  }
template<typename SignalType>
void ROSEE::Utils::SecondOrderFilter< SignalType >::setTimeStep ( double  ts)
inline

Definition at line 378 of file Utils.h.

379  {
380  _ts = ts;
381  computeCoeff();
382  }

Member Data Documentation

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_a0
private

Definition at line 407 of file Utils.h.

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_a1
private

Definition at line 407 of file Utils.h.

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_a2
private

Definition at line 407 of file Utils.h.

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_b1
private

Definition at line 406 of file Utils.h.

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_b2
private

Definition at line 406 of file Utils.h.

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_eps
private

Definition at line 403 of file Utils.h.

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_omega
private

Definition at line 402 of file Utils.h.

template<typename SignalType>
bool ROSEE::Utils::SecondOrderFilter< SignalType >::_reset_has_been_called
private

Definition at line 409 of file Utils.h.

template<typename SignalType>
double ROSEE::Utils::SecondOrderFilter< SignalType >::_ts
private

Definition at line 404 of file Utils.h.

template<typename SignalType>
SignalType ROSEE::Utils::SecondOrderFilter< SignalType >::_u
private

Definition at line 411 of file Utils.h.

template<typename SignalType>
SignalType ROSEE::Utils::SecondOrderFilter< SignalType >::_ud
private

Definition at line 411 of file Utils.h.

template<typename SignalType>
SignalType ROSEE::Utils::SecondOrderFilter< SignalType >::_udd
private

Definition at line 411 of file Utils.h.

template<typename SignalType>
SignalType ROSEE::Utils::SecondOrderFilter< SignalType >::_y
private

Definition at line 411 of file Utils.h.

template<typename SignalType>
SignalType ROSEE::Utils::SecondOrderFilter< SignalType >::_yd
private

Definition at line 411 of file Utils.h.

template<typename SignalType>
SignalType ROSEE::Utils::SecondOrderFilter< SignalType >::_ydd
private

Definition at line 411 of file Utils.h.


The documentation for this class was generated from the following file: