Giter VIP home page Giter VIP logo

madflight's People

Contributors

qqqlab avatar vaishakhsnair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

madflight's Issues

There may be an issue with the I2C code

I modified the print_ I2c_ Scan() section code ๏ผŒI modified the I2C PINS and now I can find the I2C device. So now I can confirm that the software is not working properly
void print_i2c_scan() {
//Serial.printf("I2C: Scanning ...\n");
// byte count = 0;
//i2c->begin();
//for (byte i = 8; i < 120; i++) {
// i2c->beginTransmission(i); // Begin I2C transmission Address (i)
// if (i2c->endTransmission() == 0) { // Receive 0 = success (ACK response)
// Serial.printf("I2C: Found address: 0x%02X (%d)\n",i,i);
// count++;
// }
//}
//Serial.printf("I2C: Found %d device(s)\n", count);
byte error, address;
int nDevices;

Serial.println("Scanning...");

nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
WIRE.beginTransmission(address);
error = WIRE.endTransmission();

if (error == 0)
{
  Serial.print("I2C device found at address 0x");
  if (address<16)
    Serial.print("0");
  Serial.print(address,HEX);
  Serial.println("  !");

  nDevices++;
}
else if (error==4)
{
  Serial.print("Unknown error at address 0x");
  if (address<16)
    Serial.print("0");
  Serial.println(address,HEX);
}

}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");

}
madflight starting 5 ...
madflight starting 4 ...
madflight starting 3 ...
madflight starting 2 ...
madflight starting 1 ...
USE_HW_ESP32
I2C: SDA=21 SCL=22
SPI: MOSI=23 MISO=19 SCLK=18 CS=15
Scanning...
I2C device found at address 0x68 !
done

USE_RX_PPM pin=35
USE_IMU_MPU6050_I2C
E (4065) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4066) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4077) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4089) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4100) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4111) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4123) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4134) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4145) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4157) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4168) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4180) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
float AccErrorX = +0.000061;
float AccErrorY = +0.000061;
float AccErrorZ = -1.000061;
float GyroErrorX = -0.007634;
float GyroErrorY = -0.007634;
float GyroErrorZ = +0.007634;
Paste these values in user specified variables section and comment out calculate_IMU_error() in void setup.
ahrs_Setup() No Magnetometer
ahrs_Setup() Estimated yaw:-0.00
gx:+0.00 gy:+0.00 gz:-0.00 ax:+0.00 ay:+0.00 az:-0.00 mx:+0.00 my:+0.00 mz:+0.00 roll:+0.0 pitch:-0.0 yaw:-0.0 yaw_mag:-0.0 imu_err_cnt:0
gx:+0.00 gy:+0.00 gz:-0.00 ax:+0.00 ay:+0.00 az:-0.00 mx:+0.00

Unable to compile example for RP2040

I installed the madflight library in Arduino IDE 2.3.2 and tried to compile the Quadcopter example for RP2040. This is the error message:

In file included from C:\Users\instalador\Documents\Arduino\libraries\madflight\src/madflight_board_default_RP2040.h:56:0,
                 from C:\Users\instalador\Documents\Arduino\libraries\madflight\src/madflight/hw_RP2040/hw_RP2040.h:18,
                 from C:\Users\instalador\Documents\Arduino\libraries\madflight\src/madflight.h:35,
                 from C:\Users\instalador\AppData\Local\Temp\.arduinoIDE-unsaved2024329-20448-q43dyj.jlxdh\Quadcopter\Quadcopter.ino:198:
C:\Users\instalador\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\4.1.1\cores\arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/common/pico_stdlib/include/pico/stdlib.h:11:10: fatal error: pico/stdio.h: No such file or directory
 #include "pico/stdio.h"
          ^~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

Issue compiling library version 1.1.2 for esp32

libraries\madflight\src\madflight/hw_ESP32/ESP32_PWM.h:65:20: error: 'ledcSetup' was not declared in this scope; did you mean 'ledc_stop'?
   65 |         act_freq = ledcSetup(ch, freq, bits);
      |                    ^~~~~~~~~
      |                    ledc_stop
libraries\madflight\src\madflight/hw_ESP32/ESP32_PWM.h:72:7: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
   72 |       ledcAttachPin(pin, ch);
      |       ^~~~~~~~~~~~~
      |       ledcAttach

How do I fix it? I tried changing both of them to the suggested but error worsens.
Thank you

Unable to recognize MPU6050

Hello!
this project is fantastic and I am very interested in it! I tried using RP2040 and ESP32 to test your code, but couldn't recognize MPU6050
I tested MPU6050 using other code and the hardware is working properly
I only connected to MPU6050, I did not connect to RC receiver
//========================================================================================================================//
// INCLUDES //
//========================================================================================================================//
//include hardware specific code
#if defined ARDUINO_ARCH_ESP32
#include "hw_ESP32.h"
#elif defined ARDUINO_ARCH_RP2040
#include "hw_RP2040.h"
#include <FreeRTOS.h> //FreeRTOS
#include <semphr.h> //FreeRTOS
#else
#error "Unknown hardware architecture"
#endif

#include "ahrs.h"

//========================================================================================================================//
// USER-SPECIFIED DEFINES //
//========================================================================================================================//

//-------------------------------------
// APPLICATION SETTINGS
//-------------------------------------
#define USE_IMU_INTERRUPT //Uncomment to use interrupt pin and not loop() to trigger loop_imu()

//-------------------------------------
// RC RECEIVER
//-------------------------------------
//Uncomment only one receiver type
#define USE_RCIN_PPM
//#define USE_RCIN_PWM
//#define USE_RCIN_SBUS
//#define USE_RCIN_DSM
#include "src/RCIN/RCIN.h" //first define USE_RCIN_xxx then include RCIN.h

//-------------------------------------
// IMU SENSOR
//-------------------------------------
//Uncomment only one IMU
#define USE_IMU_MPU6050_I2C //acc/gyro
//#define USE_IMU_MPU9150_I2C //acc/gyro/mag
//#define USE_IMU_MPU6500_I2C //acc/gyro Note: SPI interface is faster
//#define USE_IMU_MPU9250_I2C //acc/gyro/mag Note: SPI interface is faster
//#define USE_IMU_MPU6500_SPI //acc/gyro
//#define USE_IMU_MPU9250_SPI //acc/gyro/mag

//Uncomment one I2C address. If unknown, see output of print_i2c_scan()
#define IMU_I2C_ADR 0x68 //MPU9250
//#define IMU_I2C_ADR 0x77 //MPU9150

//Full scale gyro range in deg/sec. Most IMUs support 250,500,1000,2000. Can use any value here, driver will pick next greater setting.
#define IMU_GYRO_DPS 250

//Full scale gyro accelerometer in G's. Most IMUs support 2,4,8,16. Can use any value here, driver will pick next greater setting.
#define IMU_ACCEL_G 2

//Uncomment only one sensor orientation. The labels is yaw / roll (in that order) needed to rotate the sensor from it's normal position to it's mounted position.
//if not sure what is needed: try each setting until roll-right gives positive ahrs_roll, pitch-up gives positive ahrs_pitch, and yaw-right gives increasing ahrs_yaw
//#define IMU_ROTATE_NONE
#define IMU_ROTATE_YAW90
//#define IMU_ROTATE_YAW180
//#define IMU_ROTATE_YAW270
//#define IMU_ROTATE_ROLL180
//#define IMU_ROTATE_YAW90_ROLL180
//#define IMU_ROTATE_YAW180_ROLL180
//#define IMU_ROTATE_YAW270_ROLL180
#include "src/IMU/IMU.h" //first define IMU_xxx then include IMO.h

The serial port outputs the following information

madflight starting 5 ...
madflight starting 4 ...
madflight starting 3 ...
madflight starting 2 ...
madflight starting 1 ...
USE_HW_ESP32
I2C: SDA=23 SCL=22
SPI: MOSI=21 MISO=36 SCLK=19 CS=18
I2C: Scanning ...
I2C: Found address: 0x08 (8)
I2C: Found address: 0x09 (9)
I2C: Found address: 0x0A (10)
I2C: Found address: 0x0B (11)
I2C: Found address: 0x0C (12)
I2C: Found address: 0x0D (13)
I2C: Found address: 0x0E (14)
I2C: Found address: 0x0F (15)
I2C: Found address: 0x10 (16)
I2C: Found address: 0x11 (17)
I2C: Found address: 0x12 (18)
I2C: Found address: 0x13 (19)
I2C: Found address: 0x14 (20)
I2C: Found address: 0x15 (21)
I2C: Found address: 0x16 (22)
I2C: Found address: 0x17 (23)
I2C: Found address: 0x18 (24)
I2C: Found address: 0x19 (25)
I2C: Found address: 0x1A (26)
I2C: Found address: 0x1B (27)
I2C: Found address: 0x1C (28)
I2C: Found address: 0x1D (29)
I2C: Found address: 0x1E (30)
I2C: Found address: 0x1F (31)
I2C: Found address: 0x20 (32)
I2C: Found address: 0x21 (33)
I2C: Found address: 0x22 (34)
I2C: Found address: 0x23 (35)
I2C: Found address: 0x24 (36)
I2C: Found address: 0x25 (37)
I2C: Found address: 0x26 (38)
I2C: Found address: 0x27 (39)
I2C: Found address: 0x28 (40)
I2C: Found address: 0x29 (41)
I2C: Found address: 0x2A (42)
I2C: Found address: 0x2B (43)
I2C: Found address: 0x2C (44)
I2C: Found address: 0x2D (45)
I2C: Found address: 0x2E (46)
I2C: Found address: 0x2F (47)
I2C: Found address: 0x30 (48)
I2C: Found address: 0x31 (49)
I2C: Found address: 0x32 (50)
I2C: Found address: 0x33 (51)
I2C: Found address: 0x34 (52)
I2C: Found address: 0x35 (53)
I2C: Found address: 0x36 (54)
I2C: Found address: 0x37 (55)
I2C: Found address: 0x38 (56)
I2C: Found address: 0x39 (57)
I2C: Found address: 0x3A (58)
I2C: Found address: 0x3B (59)
I2C: Found address: 0x3C (60)
I2C: Found address: 0x3D (61)
I2C: Found address: 0x3E (62)
I2C: Found address: 0x3F (63)
I2C: Found address: 0x40 (64)
I2C: Found address: 0x41 (65)
I2C: Found address: 0x42 (66)
I2C: Found address: 0x43 (67)
I2C: Found address: 0x44 (68)
I2C: Found address: 0x45 (69)
I2C: Found address: 0x46 (70)
I2C: Found address: 0x47 (71)
I2C: Found address: 0x48 (72)
I2C: Found address: 0x49 (73)
I2C: Found address: 0x4A (74)
I2C: Found address: 0x4B (75)
I2C: Found address: 0x4C (76)
I2C: Found address: 0x4D (77)
I2C: Found address: 0x4E (78)
I2C: Found address: 0x4F (79)
I2C: Found address: 0x50 (80)
I2C: Found address: 0x51 (81)
I2C: Found address: 0x52 (82)
I2C: Found address: 0x53 (83)
I2C: Found address: 0x54 (84)
I2C: Found address: 0x55 (85)
I2C: Found address: 0x56 (86)
I2C: Found address: 0x57 (87)
I2C: Found address: 0x58 (88)
I2C: Found address: 0x59 (89)
I2C: Found address: 0x5A (90)
I2C: Found address: 0x5B (91)
I2C: Found address: 0x5C (92)
I2C: Found address: 0x5D (93)
I2C: Found address: 0x5E (94)
I2C: Found address: 0x5F (95)
I2C: Found address: 0x60 (96)
I2C: Found address: 0x61 (97)
I2C: Found address: 0x62 (98)
I2C: Found address: 0x63 (99)
I2C: Found address: 0x64 (100)
I2C: Found address: 0x65 (101)
I2C: Found address: 0x66 (102)
I2C: Found address: 0x67 (103)
I2C: Found address: 0x68 (104)
I2C: Found address: 0x69 (105)
I2C: Found address: 0x6A (106)
I2C: Found address: 0x6B (107)
I2C: Found address: 0x6C (108)
I2C: Found address: 0x6D (109)
I2C: Found address: 0x6E (110)
I2C: Found address: 0x6F (111)
I2C: Found address: 0x70 (112)
I2C: Found address: 0x71 (113)
I2C: Found address: 0x72 (114)
I2C: Found address: 0x73 (115)
I2C: Found address: 0x74 (116)
I2C: Found address: 0x75 (117)
I2C: Found address: 0x76 (118)
I2C: Found address: 0x77 (119)
I2C: Found 112 device(s)
USE_RX_PPM pin=35
USE_IMU_MPU6050_I2C
E (4348) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4348) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4360) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4371) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4383) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4394) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4405) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4417) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4428) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
E (4440) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=48
E (4451) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=97
E (4462) ledc: requested frequency and duty resolution can not be achieved, try reducing freq_hz or duty_resolution. div_param=195
float AccErrorX = +0.000000;
float AccErrorY = +0.000000;
float AccErrorZ = -1.000000;
float GyroErrorX = +0.000000;
float GyroErrorY = +0.000000;
float GyroErrorZ = +0.000000;
Paste these values in user specified variables section and comment out calculate_IMU_error() in void setup.
ahrs_Setup() No Magnetometer
ahrs_Setup() Estimated yaw:-0.00
gx:+0.00 gy:+0.00 gz:+0.00 ax:+0.00 ay:+0.00 az:+0.00 mx:+0.00 my:+0.00 mz:+0.00 roll:+0.0 pitch:-0.0 yaw:+0.0 yaw_mag:-0.0 imu_err_cnt:0
gx:+0.00 gy:+0.00 gz:+0.00 ax:+0.00 ay:+0.00 az:+0.00 mx:+0.00 my:+0.00 mz:+0.00 roll:+0.0 pitch:-0.0 yaw:+0.0 yaw_mag:-0.0 imu_err_cnt:0

Thank you!

Compilling last version 1.1.1 with an i2c imu doesn't work

Hello

Firts of all, thanks for sharing rhis project! ๐Ÿ˜‰

Everytime i compile your quadcopter.ino file example with any of the IMU_SPI , it compiles correctly , i export the compiled binary in uf2, and after loading it to the RP2040, it reeboots and i have acess to all the help and cli commands!
When i do a i2c (scan) the mpu6050 is detected at address 0X68!
But since i dont have any spi imu, only i2c, i defined use imu i2c mpu6050
It compiles witout errors , but after putting the uf2 exported compiled file in the rp2040, it loads it but the rp2040 doesnt reboot, no led flashes or blinks, and i loose the com port access to the rp2040, meaning that i cant do anything more!
No change in your original quadcopter ino file example except the IMU !
Any help is greatly appreciated

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.