PX4 Firmware
PX4 Autopilot Software http://px4.io
|
A simple derivative approximation. More...
#include <BlockDerivative.hpp>
Public Member Functions | |
BlockDerivative (SuperBlock *parent, const char *name) | |
virtual | ~BlockDerivative ()=default |
float | update (float input) |
Update the state and get current derivative. More... | |
void | setU (float u) |
void | reset () |
float | getU () |
float | getLP () |
float | getO () |
Public Member Functions inherited from control::SuperBlock | |
SuperBlock (SuperBlock *parent, const char *name) | |
~SuperBlock ()=default | |
SuperBlock (const SuperBlock &)=delete | |
SuperBlock & | operator= (const SuperBlock &)=delete |
SuperBlock (SuperBlock &&)=delete | |
SuperBlock & | operator= (SuperBlock &&)=delete |
void | setDt (float dt) override |
void | updateParams () override |
Public Member Functions inherited from control::Block | |
Block (SuperBlock *parent, const char *name) | |
virtual | ~Block ()=default |
Block (const Block &)=delete | |
Block & | operator= (const Block &)=delete |
Block (Block &&)=delete | |
Block & | operator= (Block &&)=delete |
void | getName (char *name, size_t n) |
float | getDt () |
Public Member Functions inherited from ListNode< Block *> | |
void | setSibling (Block * sibling) |
const Block * | getSibling () const |
Protected Attributes | |
float | _u |
previous input More... | |
bool | _initialized |
BlockLowPass | _lowPass |
low pass filter More... | |
Protected Attributes inherited from control::SuperBlock | |
List< Block * > | _children |
Protected Attributes inherited from control::Block | |
const char * | _name |
SuperBlock * | _parent |
float | _dt {0.0f} |
List< BlockParamBase * > | _params |
Protected Attributes inherited from ListNode< Block *> | |
Block * | _list_node_sibling |
Additional Inherited Members | |
Protected Member Functions inherited from control::SuperBlock | |
List< Block * > & | getChildren () |
void | updateChildParams () |
Protected Member Functions inherited from control::Block | |
virtual void | updateParamsSubclass () |
SuperBlock * | getParent () |
List< BlockParamBase * > & | getParams () |
A simple derivative approximation.
This uses the previous and current input. This has a built in low pass filter.
Definition at line 61 of file BlockDerivative.hpp.
|
inline |
Definition at line 65 of file BlockDerivative.hpp.
|
virtualdefault |
|
inline |
Definition at line 92 of file BlockDerivative.hpp.
Referenced by control::blockDerivativeTest(), blockDerivativeTest(), blockPDTest(), control::blockPDTest(), control::blockPIDTest(), and blockPIDTest().
|
inline |
Definition at line 93 of file BlockDerivative.hpp.
|
inline |
Definition at line 91 of file BlockDerivative.hpp.
Referenced by control::blockDerivativeTest(), blockDerivativeTest(), blockPDTest(), control::blockPDTest(), blockPIDTest(), control::blockPIDTest(), and update().
|
inline |
Definition at line 90 of file BlockDerivative.hpp.
Referenced by MulticopterPositionControl::Run().
|
inline |
Definition at line 89 of file BlockDerivative.hpp.
Referenced by control::blockDerivativeTest(), blockDerivativeTest(), blockPDTest(), control::blockPDTest(), blockPIDTest(), control::blockPIDTest(), and update().
float control::BlockDerivative::update | ( | float | input | ) |
Update the state and get current derivative.
This call updates the state and gets the current derivative. As the derivative is only valid on the second call to update, it will return no change (0) on the first. To get a closer estimate of the derivative on the first call, call setU() one time step before using the return value of update().
input | the variable to calculate the derivative of |
Definition at line 48 of file BlockDerivative.cpp.
References _initialized, _lowPass, f(), control::Block::getDt(), getU(), setU(), and control::BlockLowPass::update().
Referenced by control::blockDerivativeTest(), blockDerivativeTest(), control::blockPDTest(), blockPDTest(), blockPIDTest(), control::blockPIDTest(), and MulticopterPositionControl::set_vehicle_states().
|
protected |
Definition at line 97 of file BlockDerivative.hpp.
Referenced by update().
|
protected |
|
protected |
previous input
Definition at line 96 of file BlockDerivative.hpp.