From fde9c1cf361d9d55e172e18aedaeaeae4420660e Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 19 Dec 2023 05:25:57 +0300 Subject: [PATCH] Minor changes and cleanups --- flix/cli.ino | 3 +-- flix/control.ino | 1 - flix/imu.ino | 14 +++----------- tools/fft.py | 5 +++++ 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/flix/cli.ino b/flix/cli.ino index ecf9ad8..9615ee6 100644 --- a/flix/cli.ino +++ b/flix/cli.ino @@ -30,8 +30,7 @@ const char* motd = "cg - calibrate gyro\n" "ca - calibrate accel\n" "fullmot - test motor on all signals\n" -"reset - reset state\n" -"wifi - start wi-fi access point\n"; +"reset - reset drone's state\n"; const struct Param { const char* name; diff --git a/flix/control.ino b/flix/control.ino index eb28656..df7c2bc 100644 --- a/flix/control.ino +++ b/flix/control.ino @@ -79,7 +79,6 @@ void interpretRC() } armed = controls[RC_CHANNEL_THROTTLE] >= 0.05 && controls[RC_CHANNEL_AUX] >= 0.5; - thrustTarget = controls[RC_CHANNEL_THROTTLE]; if (mode == ACRO) { diff --git a/flix/imu.ino b/flix/imu.ino index 6573215..cae41dd 100644 --- a/flix/imu.ino +++ b/flix/imu.ino @@ -38,7 +38,7 @@ void setupIMU() bool readIMU() { if (IMU.readSensor() < 0) { - Serial.println("IMU read error"); // TODO: + Serial.println("IMU read error"); return false; } @@ -83,6 +83,7 @@ void calibrateAccel() void loadAccelCal() { + // NOTE: this should be changed to the actual values IMU.setAccelCalX(-0.0048542023, 1.0008112192); IMU.setAccelCalY(0.0521845818, 0.9985780716); IMU.setAccelCalZ(0.5754694939, 1.0045746565); @@ -90,6 +91,7 @@ void loadAccelCal() void loadGyroCal() { + // NOTE: this should be changed to the actual values IMU.setGyroBiasX_rads(-0.0185128022); IMU.setGyroBiasY_rads(-0.0262369743); IMU.setGyroBiasZ_rads(0.0163032326); @@ -101,13 +103,3 @@ void printIMUCal() Serial.printf("accel bias: %f %f %f\n", IMU.getAccelBiasX_mss(), IMU.getAccelBiasY_mss(), IMU.getAccelBiasZ_mss()); Serial.printf("accel scale: %f %f %f\n", IMU.getAccelScaleFactorX(), IMU.getAccelScaleFactorY(), IMU.getAccelScaleFactorZ()); } - -// Accel bias: 0.0463809967 0.0463809967 0.1486964226 -// Accel scale: 0.9986976385 0.9993721247 1.0561490059 - -// Accel bias: 0.0145006180 0.0145006180 0.0000000000 -// Accel scale: 0.9989741445 0.9993283749 1.0000000000 - -// Correct: -// Accel bias: -0.0048542023 0.0521845818 0.5754694939 -// Accel scale: 1.0008112192 0.9985780716 1.0045746565 diff --git a/tools/fft.py b/tools/fft.py index c2c04ff..1d1e780 100755 --- a/tools/fft.py +++ b/tools/fft.py @@ -34,6 +34,11 @@ N = int(sample_rate * duration) yf = np.fft.rfft(records) xf = np.fft.rfftfreq(N, 1 / sample_rate) +# print out fft data +print('Frequency, Amplitude') +for i in range(len(xf)): + print(xf[i], ',', abs(yf[i])) + plt.plot(xf, np.abs(yf)) plt.title('FFT of ' + log_entry) plt.xlabel('Frequency')