0.4.1
Loading...
Searching...
No Matches
NAV::LowPassFilter Class Reference

Filters incoming data. More...

Data Structures

struct  FilterItem
 Filter description. More...
 

Public Member Functions

void guiConfig () override
 ImGui config window which is shown on double click.
 
 LowPassFilter ()
 Default constructor.
 
 LowPassFilter (const LowPassFilter &)=delete
 Copy constructor.
 
 LowPassFilter (LowPassFilter &&)=delete
 Move constructor.
 
LowPassFilteroperator= (const LowPassFilter &)=delete
 Copy assignment operator.
 
LowPassFilteroperator= (LowPassFilter &&)=delete
 Move assignment operator.
 
void restore (const json &j) override
 Restores the node from a json object.
 
json save () const override
 Saves the node into a json object.
 
std::string type () const override
 String representation of the Class Type.
 
 ~LowPassFilter () override
 Destructor.
 
- Public Member Functions inherited from NAV::Node
virtual void deinitialize ()
 Deinitialize the Node.
 
bool doDeinitialize (bool wait=false)
 Asks the node worker to deinitialize the node.
 
bool doDisable (bool wait=false)
 Asks the node worker to disable the node.
 
bool doEnable ()
 Enable the node.
 
bool doInitialize (bool wait=false)
 Asks the node worker to initialize the node.
 
bool doReinitialize (bool wait=false)
 Asks the node worker to reinitialize the node.
 
virtual void flush ()
 Function called by the flow executer after finishing to flush out remaining data.
 
template<typename T>
std::optional< InputPin::IncomingLink::ValueWrapper< T > > getInputValue (size_t portIndex) const
 Get Input Value connected on the pin. Only const data types.
 
Mode getMode () const
 Get the current mode of the node.
 
const ImVec2 & getSize () const
 Get the size of the node.
 
State getState () const
 Get the current state of the node.
 
bool hasInputPinWithSameTime (const InsTime &insTime) const
 Checks wether there is an input pin with the same time.
 
virtual bool initialize ()
 Initialize the Node.
 
InputPininputPinFromId (ax::NodeEditor::PinId pinId)
 Returns the pin with the given id.
 
size_t inputPinIndexFromId (ax::NodeEditor::PinId pinId) const
 Returns the index of the pin.
 
void invokeCallbacks (size_t portIndex, const std::shared_ptr< const NodeData > &data)
 Calls all registered callbacks on the specified output port.
 
bool isDisabled () const
 Checks if the node is disabled.
 
bool isInitialized () const
 Checks if the node is initialized.
 
bool isOnlyRealtime () const
 Checks if the node is only working in real time (sensors, network interfaces, ...)
 
bool isTransient () const
 Checks if the node is changing its state currently.
 
std::string nameId () const
 Node name and id.
 
 Node (const Node &)=delete
 Copy constructor.
 
 Node (Node &&)=delete
 Move constructor.
 
 Node (std::string name)
 Constructor.
 
void notifyOutputValueChanged (size_t pinIdx, const InsTime &insTime, const std::scoped_lock< std::mutex > &&guard)
 Notifies connected nodes about the change.
 
virtual bool onCreateLink (OutputPin &startPin, InputPin &endPin)
 Called when a new link is to be established.
 
virtual void onDeleteLink (OutputPin &startPin, InputPin &endPin)
 Called when a link is to be deleted.
 
Nodeoperator= (const Node &)=delete
 Copy assignment operator.
 
Nodeoperator= (Node &&)=delete
 Move assignment operator.
 
OutputPinoutputPinFromId (ax::NodeEditor::PinId pinId)
 Returns the pin with the given id.
 
size_t outputPinIndexFromId (ax::NodeEditor::PinId pinId) const
 Returns the index of the pin.
 
void releaseInputValue (size_t portIndex)
 Unblocks the connected node. Has to be called when the input value should be released and getInputValue was not called.
 
std::scoped_lock< std::mutex > requestOutputValueLock (size_t pinIdx)
 Blocks the thread till the output values was read by all connected nodes.
 
virtual void restoreAtferLink (const json &j)
 Restores link related properties of the node from a json object.
 
void wakeWorker ()
 Wakes the worker thread.
 
virtual ~Node ()
 Destructor.
 

Static Public Member Functions

static std::string category ()
 String representation of the Class Category.
 
static std::string typeStatic ()
 String representation of the Class Type.
 
- Static Public Member Functions inherited from NAV::Node
static std::string toString (State state)
 Converts the state into a printable text.
 

Private Types

enum class  FilterType : uint8_t {
  Linear ,
  COUNT
}
 Types of available filters (to be extended) More...
 

Private Member Functions

void afterCreateLink (OutputPin &startPin, InputPin &endPin) override
 Called when a new link was established.
 
void afterDeleteLink (OutputPin &startPin, InputPin &endPin) override
 Called when a link was deleted.
 
void receiveObs (InputPin::NodeDataQueue &queue, size_t pinIdx)
 Callback when receiving data on a port.
 
bool resetNode () override
 Resets the node. It is guaranteed that the node is initialized when this is called.
 

Static Private Member Functions

static std::optional< double > filterData (FilterItem &item, const InsTime &insTime, double value)
 Filter the provided data.
 
static const char * to_string (FilterType value)
 Converts the enum to a string.
 

Private Attributes

std::vector< std::string > _availableItems
 Available items.
 
std::vector< FilterItem_filterItems
 Items to filter.
 
size_t _gui_availableItemsSelection
 Selected item in the combo.
 

Static Private Attributes

static constexpr size_t INPUT_PORT_INDEX_FLOW
 Flow.
 
static constexpr size_t OUTPUT_PORT_INDEX_FLOW
 Flow.
 

Friends

void from_json (const json &j, LowPassFilter::FilterItem &data)
 Converts the provided json object into a link object.
 
void to_json (json &j, const FilterItem &data)
 Converts the provided link into a json object.
 

Additional Inherited Members

- Public Types inherited from NAV::Node
enum class  Mode : uint8_t {
  REAL_TIME ,
  POST_PROCESSING
}
 Different Modes the Node can work in. More...
 
enum class  State : uint8_t {
  Disabled ,
  Deinitialized ,
  DoInitialize ,
  Initializing ,
  Initialized ,
  DoDeinitialize ,
  Deinitializing ,
  DoShutdown ,
  Shutdown
}
 Possible states of the node. More...
 
- Data Fields inherited from NAV::Node
bool callbacksEnabled
 Enables the callbacks.
 
ax::NodeEditor::NodeId id
 Unique Id of the Node.
 
std::vector< InputPininputPins
 List of input pins.
 
Kind kind
 Kind of the Node.
 
std::string name
 Name of the Node.
 
std::vector< OutputPinoutputPins
 List of output pins.
 
std::multimap< InsTime, std::pair< OutputPin *, size_t > > pollEvents
 Map with callback events (sorted by time)
 
- Protected Attributes inherited from NAV::Node
ImVec2 _guiConfigDefaultWindowSize
 
bool _hasConfig
 Flag if the config window should be shown.
 
bool _lockConfigDuringRun
 Lock the config when executing post-processing.
 
bool _onlyRealTime
 Whether the node can run in post-processing or only real-time.
 

Detailed Description

Filters incoming data.

Definition at line 28 of file LowPassFilter.hpp.

Member Enumeration Documentation

◆ FilterType

enum class NAV::LowPassFilter::FilterType : uint8_t
strongprivate

Types of available filters (to be extended)

Enumerator
Linear 

Linear fit filter.

COUNT 

Amount of items in the enum.

Definition at line 71 of file LowPassFilter.hpp.

Constructor & Destructor Documentation

◆ LowPassFilter() [1/3]

NAV::LowPassFilter::LowPassFilter ( )

Default constructor.

Definition at line 40 of file LowPassFilter.cpp.

◆ ~LowPassFilter()

NAV::LowPassFilter::~LowPassFilter ( )
override

Destructor.

Definition at line 52 of file LowPassFilter.cpp.

◆ LowPassFilter() [2/3]

NAV::LowPassFilter::LowPassFilter ( const LowPassFilter & )
delete

Copy constructor.

◆ LowPassFilter() [3/3]

NAV::LowPassFilter::LowPassFilter ( LowPassFilter && )
delete

Move constructor.

Member Function Documentation

◆ afterCreateLink()

void NAV::LowPassFilter::afterCreateLink ( OutputPin & startPin,
InputPin & endPin )
overrideprivatevirtual

Called when a new link was established.

Parameters
[in]startPinPin where the link starts
[in]endPinPin where the link ends

Reimplemented from NAV::Node.

Definition at line 242 of file LowPassFilter.cpp.

◆ afterDeleteLink()

void NAV::LowPassFilter::afterDeleteLink ( OutputPin & startPin,
InputPin & endPin )
overrideprivatevirtual

Called when a link was deleted.

Parameters
[in]startPinPin where the link starts
[in]endPinPin where the link ends

Reimplemented from NAV::Node.

Definition at line 292 of file LowPassFilter.cpp.

◆ category()

std::string NAV::LowPassFilter::category ( )
staticnodiscard

String representation of the Class Category.

Definition at line 67 of file LowPassFilter.cpp.

◆ filterData()

std::optional< double > NAV::LowPassFilter::filterData ( FilterItem & item,
const InsTime & insTime,
double value )
staticnodiscardprivate

Filter the provided data.

Parameters
[in]itemFilter item to fit
[in]insTimeCurrent Time
[in]valueCurrent value to filter

Definition at line 348 of file LowPassFilter.cpp.

◆ guiConfig()

void NAV::LowPassFilter::guiConfig ( )
overridevirtual

ImGui config window which is shown on double click.

Attention
Don't forget to set _hasConfig to true in the constructor of the node

Reimplemented from NAV::Node.

Definition at line 72 of file LowPassFilter.cpp.

◆ operator=() [1/2]

LowPassFilter & NAV::LowPassFilter::operator= ( const LowPassFilter & )
delete

Copy assignment operator.

◆ operator=() [2/2]

LowPassFilter & NAV::LowPassFilter::operator= ( LowPassFilter && )
delete

Move assignment operator.

◆ receiveObs()

void NAV::LowPassFilter::receiveObs ( InputPin::NodeDataQueue & queue,
size_t pinIdx )
private

Callback when receiving data on a port.

Parameters
[in]queueQueue with all the received data messages
[in]pinIdxIndex of the pin the data is received on

Definition at line 308 of file LowPassFilter.cpp.

◆ resetNode()

bool NAV::LowPassFilter::resetNode ( )
overrideprivatevirtual

Resets the node. It is guaranteed that the node is initialized when this is called.

Reimplemented from NAV::Node.

Definition at line 229 of file LowPassFilter.cpp.

◆ restore()

void NAV::LowPassFilter::restore ( const json & j)
overridevirtual

Restores the node from a json object.

Parameters
[in]jJson object with the node state

Reimplemented from NAV::Node.

Definition at line 222 of file LowPassFilter.cpp.

◆ save()

json NAV::LowPassFilter::save ( ) const
nodiscardoverridevirtual

Saves the node into a json object.

Reimplemented from NAV::Node.

Definition at line 210 of file LowPassFilter.cpp.

◆ to_string()

const char * NAV::LowPassFilter::to_string ( FilterType value)
staticprivate

Converts the enum to a string.

Parameters
[in]valueEnum value to convert into text
Returns
String representation of the enum

Definition at line 382 of file LowPassFilter.cpp.

◆ type()

std::string NAV::LowPassFilter::type ( ) const
nodiscardoverridevirtual

String representation of the Class Type.

Implements NAV::Node.

Definition at line 62 of file LowPassFilter.cpp.

◆ typeStatic()

std::string NAV::LowPassFilter::typeStatic ( )
staticnodiscard

String representation of the Class Type.

Definition at line 57 of file LowPassFilter.cpp.

Friends And Related Symbol Documentation

◆ from_json

void from_json ( const json & j,
LowPassFilter::FilterItem & data )
friend

Converts the provided json object into a link object.

Parameters
[in]jJson object with the needed values
[out]dataObject to fill from the json

Definition at line 408 of file LowPassFilter.cpp.

◆ to_json

void to_json ( json & j,
const FilterItem & data )
friend

Converts the provided link into a json object.

Parameters
[out]jJson object which gets filled with the info
[in]dataData to convert into json

Definition at line 399 of file LowPassFilter.cpp.

Field Documentation

◆ _availableItems

std::vector<std::string> NAV::LowPassFilter::_availableItems
private

Available items.

Definition at line 108 of file LowPassFilter.hpp.

◆ _filterItems

std::vector<FilterItem> NAV::LowPassFilter::_filterItems
private

Items to filter.

Definition at line 110 of file LowPassFilter.hpp.

◆ _gui_availableItemsSelection

size_t NAV::LowPassFilter::_gui_availableItemsSelection
private

Selected item in the combo.

Definition at line 105 of file LowPassFilter.hpp.

◆ INPUT_PORT_INDEX_FLOW

size_t NAV::LowPassFilter::INPUT_PORT_INDEX_FLOW
staticconstexprprivate

Flow.

Definition at line 66 of file LowPassFilter.hpp.

◆ OUTPUT_PORT_INDEX_FLOW

size_t NAV::LowPassFilter::OUTPUT_PORT_INDEX_FLOW
staticconstexprprivate

Flow.

Definition at line 65 of file LowPassFilter.hpp.


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