前提・実現したいこと
Arduino初心者です。Arduino及びESP32でラジコン飛行機の制御をするためにMadgwickAHRSのライブラリを
GitHubよりダウンロードして使おうと思ったのですが、ファイルが見つからないエラー(?)が起きてしまいコンパイルが通せませんでした。これは何かほかのファイルをダウンロードする必要があるのでしょうか?それともほかの問題があるのでしょうか?
よろしくお願いします。
発生している問題・エラーメッセージ
ライブラリのexamplesのプログラムでエラーが起きる
Visualize101:1:22: error: CurieIMU.h: No such file or directory compilation terminated. exit status 1 CurieIMU.h: No such file or directory
該当のソースコード
Arduino
1#include <CurieIMU.h> 2#include <MadgwickAHRS.h> 3 4Madgwick filter; 5unsigned long microsPerReading, microsPrevious; 6float accelScale, gyroScale; 7 8void setup() { 9 Serial.begin(9600); 10 11 // start the IMU and filter 12 CurieIMU.begin(); 13 CurieIMU.setGyroRate(25); 14 CurieIMU.setAccelerometerRate(25); 15 filter.begin(25); 16 17 // Set the accelerometer range to 2G 18 CurieIMU.setAccelerometerRange(2); 19 // Set the gyroscope range to 250 degrees/second 20 CurieIMU.setGyroRange(250); 21 22 // initialize variables to pace updates to correct rate 23 microsPerReading = 1000000 / 25; 24 microsPrevious = micros(); 25} 26 27void loop() { 28 int aix, aiy, aiz; 29 int gix, giy, giz; 30 float ax, ay, az; 31 float gx, gy, gz; 32 float roll, pitch, heading; 33 unsigned long microsNow; 34 35 // check if it's time to read data and update the filter 36 microsNow = micros(); 37 if (microsNow - microsPrevious >= microsPerReading) { 38 39 // read raw data from CurieIMU 40 CurieIMU.readMotionSensor(aix, aiy, aiz, gix, giy, giz); 41 42 // convert from raw data to gravity and degrees/second units 43 ax = convertRawAcceleration(aix); 44 ay = convertRawAcceleration(aiy); 45 az = convertRawAcceleration(aiz); 46 gx = convertRawGyro(gix); 47 gy = convertRawGyro(giy); 48 gz = convertRawGyro(giz); 49 50 51 // update the filter, which computes orientation 52 filter.updateIMU(gx, gy, gz, ax, ay, az); 53 54 // print the heading, pitch and roll 55 roll = filter.getRoll(); 56 pitch = filter.getPitch(); 57 heading = filter.getYaw(); 58 Serial.print("Orientation: "); 59 Serial.print(heading); 60 Serial.print(" "); 61 Serial.print(pitch); 62 Serial.print(" "); 63 Serial.println(roll); 64 65 // increment previous time, so we keep proper pace 66 microsPrevious = microsPrevious + microsPerReading; 67 } 68} 69 70float convertRawAcceleration(int aRaw) { 71 // since we are using 2G range 72 // -2g maps to a raw value of -32768 73 // +2g maps to a raw value of 32767 74 75 float a = (aRaw * 2.0) / 32768.0; 76 return a; 77} 78 79float convertRawGyro(int gRaw) { 80 // since we are using 250 degrees/seconds range 81 // -250 maps to a raw value of -32768 82 // +250 maps to a raw value of 32767 83 84 float g = (gRaw * 250.0) / 32768.0; 85 return g; 86}
試したこと
githubから何回かライブラリを入れなおしてみましたが効果ありませんでした。
他にもMadgwickライブラリを使用している方で同様のエラーは見つけられませんでした。
補足情報(FW/ツールのバージョンなど)
version,Arduino1.8.9
ボード,ESP32Dev Module
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/11/15 13:24