-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand_prefilter.h
More file actions
30 lines (27 loc) · 869 Bytes
/
Copy pathcommand_prefilter.h
File metadata and controls
30 lines (27 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @file command_prefilter.h
* @author your name (you@domain.com)
* @brief Algorithm of the command prefilter (third-order)
* @version 0.3
* @date 2023-05-12
* 2021-02-27 結構變數版本
* 2021-10-06 class 版本
* 2023-05-12 更新 naming style
* @copyright Copyright (c) 2023
*
*/
#pragma once
#include <Arduino.h>
class CommandPrefilter
{
public:
void init(const double& cutoff_freq, const double& sample_interval);
void update(const double& input_sig, double& pos_f, double& vel_f, double& acc_f);
private:
double T; // Sample interval
double fc; // Cut-off frequency
double tau; // Time constant
double a[3]; // Coefficient array
double r; // Original command input
double xf[3], F[3], y[3]; // States, ODEs, Outputs.
};