Basic_Frame_TypeC_2023_Omni
Loading...
Searching...
No Matches
uarm_math.hpp
1/*
2******************************************************************************
3* @file : maths.h
4* @brief(op) : general use of the maths
5* @created time : Jul, 2023
6* @author(op) : Haoran
7*
8******************************************************************************
9* Copyright (c) 2023 UARM Artemis.
10* All rights reserved.
11******************************************************************************
12*/
13
14#ifndef __UARM_MATH_HPP
15#define __UARM_MATH_HPP
16
17#ifdef GTEST
18#include "fake_arm_math.h"
19#else
20#include "arm_math.h"
21#include "stm32f407xx.h"
22#endif
23
24// #include <cmath>
25#include "math.h"
26#include "uarm_types.hpp"
27
28/* User defiend functions declaration */
29/* maths */
30float sign(float x);
31
32double exp_sum(double* array, int length);
33void softmax(float* x, int len);
34void abs_limit(float* a, float ABS_MAX);
35float in_out_map(float input, float in_min, float in_max, float out_min,
36 float out_max);
37float fast_inv_sqrt(float x);
38float realign(float theta, float pos);
39
40float value_limit(float x, float min_x, float max_x);
41float relative_angle(float angle1, float angle2);
42float relative_angle_rad(float angle1, float angle2);
43
44/* generic filters */
45void init_folp_filter(first_order_low_pass_t* folp, float a);
46float first_order_low_pass_filter(first_order_low_pass_t* folp, float data);
47float first_order_high_pass_filter(first_order_high_pass_t* fohp, float data);
48float first_order_comp_filter(float a, float lowPF, float highPF);
49void init_ewma_filter(ewma_filter_t* ewma, float a);
50float ewma_filter(ewma_filter_t* ewma, float cur_data);
51void init_swm_filter(sliding_mean_filter_t* filter, size_t window_size);
52float sliding_window_mean_filter(sliding_mean_filter_t* filter, float new_data);
53
54#endif
Definition uarm_types.hpp:31
Definition uarm_types.hpp:22
Definition uarm_types.hpp:14
Definition uarm_types.hpp:38