Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ettore Pane
Skyward Boardcore
Commits
d3651151
Commit
d3651151
authored
1 year ago
by
Federico Lolli
Browse files
Options
Downloads
Patches
Plain Diff
[LowPass] added first draft of LowPass filter
parent
db2db92f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmake/boardcore.cmake
+1
-0
1 addition, 0 deletions
cmake/boardcore.cmake
src/shared/algorithms/Filters/LowPass.cpp
+40
-0
40 additions, 0 deletions
src/shared/algorithms/Filters/LowPass.cpp
src/shared/algorithms/Filters/LowPass.h
+56
-0
56 additions, 0 deletions
src/shared/algorithms/Filters/LowPass.h
with
97 additions
and
0 deletions
cmake/boardcore.cmake
+
1
−
0
View file @
d3651151
...
...
@@ -43,6 +43,7 @@ foreach(OPT_BOARD ${BOARDS})
${
SBS_BASE
}
/src/shared/algorithms/NAS/StateInitializer.cpp
${
SBS_BASE
}
/src/shared/algorithms/SFD/SFDAscent.cpp
${
SBS_BASE
}
/src/shared/algorithms/SFD/SFDDescent.cpp
${
SBS_BASE
}
/src/shared/algorithms/Filters/LowPass.cpp
# Debug
${
SBS_BASE
}
/src/shared/utils/Debug.cpp
...
...
This diff is collapsed.
Click to expand it.
src/shared/algorithms/Filters/LowPass.cpp
0 → 100644
+
40
−
0
View file @
d3651151
/* Copyright (c) 2023 Skyward Experimental Rocketry
* Author: Federico Lolli
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include
"LowPass.h"
namespace
Boardcore
{
// TODO: WARNING! initialized at 0
LowPass
::
LowPass
(
float
gain
,
float
cutoff_freq
,
float
lambda
)
:
gain
(
gain
),
cutoff_freq
(
cutoff_freq
),
lambda
(
lambda
),
output
(
0
)
{
}
float
LowPass
::
filter
(
float
input
)
{
output
=
lambda
*
output
+
(
gain
/
cutoff_freq
)
*
(
1
-
lambda
)
*
input
;
return
output
;
}
}
// namespace Boardcore
This diff is collapsed.
Click to expand it.
src/shared/algorithms/Filters/LowPass.h
0 → 100644
+
56
−
0
View file @
d3651151
/* Copyright (c) 2023 Skyward Experimental Rocketry
* Author: Federico Lolli
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
namespace
Boardcore
{
class
LowPass
{
public:
/**
* @brief Construct a new Low Pass object
*
* @param gain The gain of the filter
* @param cutoff_freq The cutoff frequency of the filter
* @param lambda The lambda parameter of the filter
*
* @note WARNING: Initialize output at 0 at first
*/
LowPass
(
float
gain
,
float
cutoff_freq
,
float
lambda
);
/**
* @brief Filter the input
*
* @param input The input to filter
*/
float
filter
(
float
input
);
private:
float
cutoff_freq
;
float
lambda
;
float
gain
;
float
output
;
};
}
// namespace Boardcore
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment