Jump to content
I2Cdevlib Forums

limon

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by limon

  1. Thank you for your answer! The equations you wrote here are clear for me. And how are you going to use PI controller at the end? Am I right? : for example you have calculated the new value for front left motor. His new rate shoul be 1500 (motorCommand[FRONT_LEFT]). Now he has rate of 1400 (oldRate[FRONT_LEFT]). After this you are going to use PI controller instead of the direct setting motor rate: Something like that? If no, please explain to me, it is vefy interesting :-)
  2. I did not touched anything in the libs, so I think it works at 100Hz. Every loop (if I delete my delay(6)) takes about 10 msecs.
  3. Hi to all again! It semms I fixed this "bug". But there is no understanding of the reason: I'v made this changings: old: // read a packet from FIFO mpu.getFIFOBytes(fifoBuffer, packetSize); // track FIFO count here in case there is > 1 packet available // (this lets us immediately read more without waiting for an interrupt) fifoCount -= packetSize; new: while (fifoCount >= packetSize){ // read a packet from FIFO mpu.getFIFOBytes(fifoBuffer, packetSize); // track FIFO count here in case there is > 1 packet available // (this lets us immediately read more without waiting for an interrupt) fifoCount -= packetSize; } now, I never see fifo overflows at all. Program never hangs. But... why it hanged??? I'v spend 5 hours of "debugging" and testing...
  4. Hello! I am kindly asking for help with my small question: I am writing some algorithm, which must work one time in one loop iteration. It takes him ~ 5-7 msec to proceed every loop(). I noticed, that my program hangs sometimes. Very rarely: ~ after 10 - 30 minutes of working. Than I went to DMP example, added delay(6) at the end of a loop.... And the same result: sometimes it hangs (after 10 - 30 minutes of working). I added Serial.println in the loop, where the program waits for interrupt, because it is the only one loop. Like this: while (!mpuInterrupt && fifoCount < packetSize) { Serial.println("Waiting..."); } And there is no "Waiting..." messages, when it hangs. Here is a full code of "my" MPU DMP example. It is the same as standart exampe, except two of three lines. I also added the loop period counting and printed it with YPR data. Also I tried it with two different MPU-6050... Sory for my English :-)
  5. Hello, edorphy! Your post made me interested: I understand, why do you need PID contollers to control pitch and roll. But why do you need PI controller? Could you explain please in a simple way? :-)
  6. Thanks, luisrodenas, for your reply! Here is how I connected MPU to my Arduino UNO: Is it right? And what frequency has DMP?
  7. Hello all! I am running MPU 6050 example. Every time after burning arduino i see this in the com port monitor: And this waiting can last VERY long... When I delete this while loop: while (!mpuInterrupt && fifoCount < packetSize) { // other program behavior stuff here // . // . // . // if you are really paranoid you can frequently test in between other // stuff to see if mpuInterrupt is true, and if so, "break;" from the // while() loop to immediately process the MPU data // . // . // . } Everything works OK... No waiting at all, and I see data immediately. This is the question. Must I wait for interrupt or I can read data from MPU (mpu.dmpGetXXXXXXXX) every time I need?
  8. Thank you for your help! I tried to do this, and had another error in Sensor.h: sensor.h:18: error: 'MPU6050' does not name a type Because sensor.h don't know about MPU libraries... As I understand, if I write a class A, i should create two files: A.h & A.cpp. A.cpp must include A.h... Anyway, if I comment the string #include "sensor.h" in sensor.cpp, i get this errors: sensor.cpp:4: error: 'Sensor' has not been declared Btw you can download my test project and compile it with different includes... Thank you for your help and suggestions!!!
  9. Hello, Diego! Here you can find one of the PID realizations https://github.com/MegaPirateNG/ardupilot-mpng/tree/mpng-3.0.1-r3/libraries/AC_PID also, there is a storing PID values to the EEPROM, but you can delete it :-) And filtering... There is no need to use only Kalman. Here you can find some other filters https://github.com/MegaPirateNG/ardupilot-mpng/tree/mpng-3.0.1-r3/libraries/Filter Hope it helps you. Maybe you can help me with my noobish question? http://www.i2cdevlib.com/forums/topic/110-arduino-multiple-definition-of-some-function-mpu6050xxxxxx/ Because my math is OK. But my skill in Arduino is poor :-)
  10. Hello, dear pro MPU users! :-) I have no problem to compile the example for Arduino. This is good :-) But I can't move all the initializations and all the serial output into new class, I called Sensor. I'v created Sensor.h, Sensor.cpp In the sensor.h: #ifndef SENSOR_H #define SENSOR_H #include "I2Cdev.h" #include "MPU6050_6Axis_MotionApps20.h" //#include "MPU6050.h" // not necessary if using MotionApps include file // Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation // is used in I2Cdev.h #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE #include "Wire.h" #endif class Sensor{ public: static Sensor & getInstance(){ static Sensor instance; return instance; } bool init(); bool getYpr(float & y, float & p, float r); protected: MPU6050 _mpu; .................................. ...................... ........... In the main project: #include "Wire.h" #include "sensor.h" void setup() { Sensor::getInstance().init(); } void loop() { float y,p,r; Sensor::getInstance().getYpr(y,p,r); } And I have a lot of errors like this: I'v found some information, that this may be caused by including "MPU6050.h", but I don't do it! I can't attach archives here. So, here is a link to a dropbox with my test project: https://dl.dropboxusercontent.com/u/51786067/testMPU.rar Hope, my question is not very stupid :-) Thanks!
×
×
  • Create New...