Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TiltAngle.h
00001 /* 00002 * TiltAngle.h 00003 * Copyright (c) 2020, ZHAW 00004 * All rights reserved. 00005 */ 00006 00007 #ifndef TILT_ANGLE_H_ 00008 #define TILT_ANGLE_H_ 00009 00010 #include <cstdlib> 00011 #include <mbed.h> 00012 #include "IMU.h" 00013 #include "ThreadFlag.h" 00014 00015 /** 00016 * This class determines the IMU's tilt angle around the x-axis. 00017 */ 00018 class TiltAngle { 00019 00020 public: 00021 00022 TiltAngle(IMU& imu); 00023 virtual ~TiltAngle(); 00024 float readTiltAngleA(); 00025 float readTiltAngleG(); 00026 float readTiltAngleK(); 00027 float readTiltAngleC(); 00028 00029 private: 00030 00031 static const unsigned int STACK_SIZE = 4096; // stack size of thread, given in [bytes] 00032 static const float PERIOD; // the period of the timer interrupt, given in [s] 00033 static const float M_PI; // the mathematical constant PI 00034 00035 static const float S_Q_ALPHA; 00036 static const float S_Q_OMEGA; 00037 static const float S_R_ALPHA; 00038 static const float S_R_OMEGA; 00039 00040 static const float LOWPASS_FILTER_FREQUENCY; // frequency of the lowpass filter, given in [rad/s] 00041 static const float HIGHPASS_FILTER_FREQUENCY; // frequency of the highpass filter, given in [rad/s] 00042 00043 IMU& imu; 00044 ThreadFlag threadFlag; 00045 Thread thread; 00046 Ticker ticker; 00047 00048 float tiltAngleA; 00049 float tiltAngleG; 00050 float tiltAngleK; 00051 float tiltAngleC; 00052 00053 float p11; 00054 float p12; 00055 float p21; 00056 float p22; 00057 float xAlpha; 00058 float xOmega; 00059 00060 float alphaAccFiltered; 00061 float alphaGyro; 00062 float alphaGyroFiltered; 00063 00064 void sendThreadFlag(); 00065 void run(); 00066 }; 00067 00068 #endif /* TILT_ANGLE_H_ */ 00069
Generated on Fri Jul 29 2022 01:28:48 by
1.7.2