Skip to content

Commit 6247cdd

Browse files
authored
Merge pull request #3 from Texas-Aerial-Robotics/workflows
added github workflow, gitignore, and mahony filter
2 parents d16ef8e + d6bc878 commit 6247cdd

File tree

146 files changed

+482
-32227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+482
-32227
lines changed

.cproject

Lines changed: 0 additions & 202 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build STM32 Project
2+
3+
on:
4+
push:
5+
branches: ["master", "workflows"]
6+
pull_request:
7+
branches: ["master", "workflows"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
- name: Install ARM GCC toolchain
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y gcc-arm-none-eabi
21+
22+
- name: Build project
23+
run: make

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
debug/
2+
*.o
3+
.settings/
4+
*.cproject
5+
*.project

.project

Lines changed: 0 additions & 32 deletions
This file was deleted.

.settings/com.st.stm32cube.ide.mcu.sfrview.prefs

Lines changed: 0 additions & 2 deletions
This file was deleted.

.settings/language.settings.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.settings/org.eclipse.cdt.core.prefs

Lines changed: 0 additions & 6 deletions
This file was deleted.

.settings/stm32cubeide.project.prefs

Lines changed: 0 additions & 5 deletions
This file was deleted.

Core/Inc/MahonyAHRS.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//=====================================================================================================
2+
// MahonyAHRS.h
3+
//=====================================================================================================
4+
//
5+
// Madgwick's implementation of Mayhony's AHRS algorithm.
6+
// See: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms
7+
//
8+
// Date Author Notes
9+
// 29/09/2011 SOH Madgwick Initial release
10+
// 02/10/2011 SOH Madgwick Optimised for reduced CPU load
11+
//
12+
//=====================================================================================================
13+
#ifndef MahonyAHRS_h
14+
#define MahonyAHRS_h
15+
16+
//----------------------------------------------------------------------------------------------------
17+
// Variable declaration
18+
19+
extern volatile float twoKp; // 2 * proportional gain (Kp)
20+
extern volatile float twoKi; // 2 * integral gain (Ki)
21+
extern volatile float q0, q1, q2, q3; // quaternion of sensor frame relative to auxiliary frame
22+
23+
//---------------------------------------------------------------------------------------------------
24+
// Function declarations
25+
26+
void MahonyAHRSupdate(float q[4], float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz);
27+
void MahonyAHRSupdateIMU(float q[4], float gx, float gy, float gz, float ax, float ay, float az);
28+
29+
#endif
30+
//=====================================================================================================
31+
// End of file
32+
//=====================================================================================================

Core/Inc/mpu9250.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,33 @@ typedef struct {
1919
volatile int16_t gyro_x;
2020
volatile int16_t gyro_y;
2121
volatile int16_t gyro_z;
22+
volatile int16_t mag_x;
23+
volatile int16_t mag_y;
24+
volatile int16_t mag_z;
2225
} IMU_RawData_t;
2326

2427
// Struct for processed IMU data
2528
typedef struct {
29+
float gyro_offX;
30+
float gyro_offY;
31+
float gyro_offZ;
2632
volatile float accel_x;
2733
volatile float accel_y;
2834
volatile float accel_z;
2935
volatile float gyro_x;
3036
volatile float gyro_y;
3137
volatile float gyro_z;
38+
volatile float mag_x;
39+
volatile float mag_y;
40+
volatile float mag_z;
3241
} IMU_ProcessedData_t;
3342

43+
typedef struct {
44+
float calibData1;
45+
float calibData2;
46+
float calibData3;
47+
} Mag_CalibData_t;
48+
3449
// Struct for Kalman filter outputs
3550
typedef struct {
3651
double angle; // Estimated angle
@@ -54,11 +69,11 @@ void mpu9250_setup();
5469
void mpu9250_write_reg(uint8_t reg, uint8_t data);
5570
void mpu9250_read_reg(uint8_t reg, uint8_t *data, uint8_t len);
5671

57-
//update raw measurements from IMU
58-
void mpu9250_getRawAngle();
72+
void mpu9250_calibrateGyro(uint16_t numCalPoints);
5973

60-
//provide pointer to Kalman struct, newAngle requires raw angle measurement, newRate requires raw gyro measurement, dt is delta time
61-
double kalman_getAngle(Kalman_t *Kalman, double newAngle, double newRate, double dt);
74+
//update raw measurements from IMU
75+
void mpu9250_getRawData();
76+
void mpu9250_getProcessedAngle();
6277

6378

6479
#endif /* INC_MPU9250_H_ */

0 commit comments

Comments
 (0)