luca Posted June 3, 2014 Report Share Posted June 3, 2014 Thank you Sondre, heard that before but I refused to believe that this mr-know-it-all device will not work for my purposes, I'll still have accumulated error if the yaw drifts, though a compass might help with that. Thanks a lot luca, I was sceptic about this "limitation" with the MPU, but given the circumstances I'll need to take a look at another dead reckoning technique. By now I have measured v & w from the wheels, and I kind of think that applying simple odometry equations and substituting these values (measurements) could give me a good estimation of the mobile robot pose. Do you think Honeywell HMC6352 will do that for my purposes? Thanks in advance I think that the compass is better than the IMU for this kind of problem. In the 2D problem you needs three types of measures: the distance along x, y and the heading angle phi (the yaw). Using this measure you know the pose of the robot in inertial frame. Using the velocity of the wheels and the kinematics you can obtain the x and y position in inertial frame, and using the compass you have the heading angle and the problem (in theory) is solved! In practice, you measure directly only the yaw, so i think that you should use a kalmann filter (with the odometry equations) to estimate with a good precision the pose of the robot. The kalmann filter is necessary because you don't measure directly the x and y position, also the odometry introduce an integration error then the filter is necessary! Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 3, 2014 Report Share Posted June 3, 2014 I think that the compass is better than the IMU for this kind of problem. In the 2D problem you needs three types of measures: the distance along x, y and the heading angle phi (the yaw). Using this measure you know the pose of the robot in inertial frame. Using the velocity of the wheels and the kinematics you can obtain the x and y position in inertial frame, and using the compass you have the heading angle and the problem (in theory) is solved! In practice, you measure directly only the yaw, so i think that you should use a kalmann filter (with the odometry equations) to estimate with a good precision the pose of the robot. The kalmann filter is necessary because you don't measure directly the x and y position, also the odometry introduce an integration error then the filter is necessary! Thanks again Luca, I really appreciate your comments. They give me a great feedback about my work. I'm thinking about these equations: http://rossum.sourceforge.net/papers/DiffSteer/#d6 Some old professor told me they fit good enough my purposes And my measurements are: RServo (1300us) | LServo (1700us) // both servos at full speed 5.57 s - 1 m 5.56 s - 1 m v = 1/5.565 = 0.1796 m/s // robot's linear velocity w = v/r = 0.1796/0.03 = 5.98 rad/s // angular velocity of both wheels Btw here is a video of my MPU mounted on it: Cheers! Quote Link to comment Share on other sites More sharing options...
luca Posted June 4, 2014 Report Share Posted June 4, 2014 I'm thinking about these equations: http://rossum.sourceforge.net/papers/DiffSteer/#d6 Some old professor told me they fit good enough my purposes Nice video! You can try to extract the yaw measurement from IMU and follow this tutorial, i think that it's sufficient to solve your problem! Obviously, this a simple solution, other solution are complicated and the time is precious for you!!! Good Luck! Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 4, 2014 Report Share Posted June 4, 2014 Nice video! 9 You can try to extract the yaw measurement from IMU and follow this tutorial, i think that it's sufficient to solve your problem! Obviously, this a simple solution, other solution are complicated and the time is precious for you!!! Good Luck! Thanks a lot Luca, that's what I vaguely thought, to extract yaw measurements; but you think this code or the one with the raw measurements (from Jeff Rowberg's github codes)? and if it's not too much to ask you for, how (extraction)? I'm not an skilled programmer that's why I'm in a hurry. Cheers! Quote Link to comment Share on other sites More sharing options...
luca Posted June 4, 2014 Report Share Posted June 4, 2014 Thanks a lot Luca, that's what I vaguely thought, to extract yaw measurements; but you think this code or the one with the raw measurements (from Jeff Rowberg's github codes)? and if it's not too much to ask you for, how (extraction)? I'm not an skilled programmer that's why I'm in a hurry. Cheers! To extract the yaw measurements you need convert the raw data from the IMU into the Euler angle (or quaternion), and from this you take the only yaw measurements. I don't know if Jeff Rowberg's github codes can do this, i think yes but i'm not sure. I'm not an Arduino user, so i don't know how to work his codes. However if you have a Invensense MPU, you also have a DMP, so if you use the DMP features you can extract easily the yaw measurement. My advice is to use the DMP! Otherwise you needs some programmer skills and some mathematical / mechanical skills to obtain the yaw measurement from the raw data. Notice that the raw data are noisy, so there is another difficulties that is the noise filtering. Try to study this code: https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino If you understand this code, you need only to extract the yaw measure from quaternion output! Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 4, 2014 Report Share Posted June 4, 2014 To extract the yaw measurements you need convert the raw data from the IMU into the Euler angle (or quaternion), and from this you take the only yaw measurements. I don't know if Jeff Rowberg's github codes can do this, i think yes but i'm not sure. I'm not an Arduino user, so i don't know how to work his codes. However if you have a Invensense MPU, you also have a DMP, so if you use the DMP features you can extract easily the yaw measurement. My advice is to use the DMP! Otherwise you needs some programmer skills and some mathematical / mechanical skills to obtain the yaw measurement from the raw data. Notice that the raw data are noisy, so there is another difficulties that is the noise filtering. Try to study this code: https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino If you understand this code, you need only to extract the yaw measure from quaternion output! I do have a MPU-6050 and also have a DMP (built-in), but how can I do what you mention about extracting yaw measurements from its features? (Btw this topic is about it, ain't that right? the official firmware been released) I'm using that code MPU6050_DMP6.ino (previously loaded into my board hooked up to the MPU-6050) to get the 3D demo running in processing, but haven't gotten deep into it. Thanks again! Quote Link to comment Share on other sites More sharing options...
luca Posted June 5, 2014 Report Share Posted June 5, 2014 I do have a MPU-6050 and also have a DMP (built-in), but how can I do what you mention about extracting yaw measurements from its features? (Btw this topic is about it, ain't that right? the official firmware been released) I'm using that code MPU6050_DMP6.ino (previously loaded into my board hooked up to the MPU-6050) to get the 3D demo running in processing, but haven't gotten deep into it. Thanks again! The answer is trivial! float euler[3]; // [psi, theta, phi] Euler angle container in the main loop: // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetEuler(euler, &q); Serial.print("euler\t"); Serial.print(euler[0] * 180/M_PI); --> roll Serial.print("\t"); Serial.print(euler[1] * 180/M_PI); --> pitch Serial.print("\t"); Serial.println(euler[2] * 180/M_PI); --> yaw euler[2]* 180/M_P is the yaw value in degree..... Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 5, 2014 Report Share Posted June 5, 2014 The answer is trivial! float euler[3]; // [psi, theta, phi] Euler angle container in the main loop: // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetEuler(euler, &q); Serial.print("euler\t"); Serial.print(euler[0] * 180/M_PI); --> roll Serial.print("\t"); Serial.print(euler[1] * 180/M_PI); --> pitch Serial.print("\t"); Serial.println(euler[2] * 180/M_PI); --> yaw euler[2]* 180/M_P is the yaw value in degree..... Did you mean that with "so if you use the DMP features you can extract easily the yaw measurement. My advice is to use the DMP!"? Is that what I couldn't see before? Thank you! Cheers! Quote Link to comment Share on other sites More sharing options...
luca Posted June 6, 2014 Report Share Posted June 6, 2014 Did you mean that with "so if you use the DMP features you can extract easily the yaw measurement. My advice is to use the DMP!"? Is that what I couldn't see before? Thank you! Cheers! Yes! Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 6, 2014 Report Share Posted June 6, 2014 Yes! Sorry for being so insistent and not being able to recognize what is trivial for others, but which part of that code (...MPU6050_DMP6.ino) could give me the position (x, y)? though it might take me maths calculations (double integration, i.e. Kalman filter) hard to apply based on the simple odometry equations (http://rossum.sourceforge.net/papers/DiffSteer/#d6), using the measurements I took from my displacements as initial values. Regards Quote Link to comment Share on other sites More sharing options...
luca Posted June 6, 2014 Report Share Posted June 6, 2014 Sorry for being so insistent and not being able to recognize what is trivial for others, but which part of that code (...MPU6050_DMP6.ino) could give me the position (x, y)? though it might take me maths calculations (double integration, i.e. Kalman filter) hard to apply based on the simple odometry equations (http://rossum.sourceforge.net/papers/DiffSteer/#d6), using the measurements I took from my displacements as initial values. Regards I'm sorry, maybe we had a misunderstood!! In the file MPU6050_DMP6.ino there isn't any line of code that give you the position x and y!! If you want to obtain a measures of position (x,y,z) from an IMU you are needs six kind of measures: the velocity of the body (u,v,w in the my convention of symbols) the angular velocity of the body (P,Q,R) once you have this measures you needs some kinematics relation (rotation matrix) to convert this measures from the body frame to the inertial frame. A this points you simply integrate the new measure of the linear velocity vx,vy and vz to obtain the position x,y and z. This is the teory, in practice this "modus operandi" is wrong because the IMU is less accurate for different causes (drift, etc..) so the position in the x,y and z are incorrect! In this discussion i understand that you are able to measure the velocity of the wheels, so you can using this measures and using the yaw measure from the file MPU6050_ETC, you simply apply the odometry equations to obtain the position x and y. This is all! Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 7, 2014 Report Share Posted June 7, 2014 I'm sorry, maybe we had a misunderstood!! In the file MPU6050_DMP6.ino there isn't any line of code that give you the position x and y!! If you want to obtain a measures of position (x,y,z) from an IMU you are needs six kind of measures: the velocity of the body (u,v,w in the my convention of symbols) the angular velocity of the body (P,Q,R) once you have this measures you needs some kinematics relation (rotation matrix) to convert this measures from the body frame to the inertial frame. A this points you simply integrate the new measure of the linear velocity vx,vy and vz to obtain the position x,y and z. This is the teory, in practice this "modus operandi" is wrong because the IMU is less accurate for different causes (drift, etc..) so the position in the x,y and z are incorrect! In this discussion i understand that you are able to measure the velocity of the wheels, so you can using this measures and using the yaw measure from the file MPU6050_ETC, you simply apply the odometry equations to obtain the position x and y. This is all! Thank you very much. I really appreciate your valuable help on this, you don't know how great were all your responses for me. I think I'll go for the odometry equations instead of coding all that linear algebra procedures. Cheers. Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 7, 2014 Report Share Posted June 7, 2014 Btw Luca, one more question, You think it'd be better for me, talking about coding and adding it to my main obstacle-avoiding/re-orientation(point&shoot)/movetowardsgoal algorithm if I switch to HMC6352 compass module or continue with the InvenSense MPU6050? It'd be like $40 USD extra for me Regards. Quote Link to comment Share on other sites More sharing options...
luca Posted June 8, 2014 Report Share Posted June 8, 2014 Btw Luca, one more question, You think it'd be better for me, talking about coding and adding it to my main obstacle-avoiding/re-orientation(point&shoot)/movetowardsgoal algorithm if I switch to HMC6352 compass module or continue with the InvenSense MPU6050? It'd be like $40 USD extra for me Regards. I think that you should to use the MPU6050. It is less accurate that the only compass, but i think that this isn't a problem.... Life is simple!! Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 11, 2014 Report Share Posted June 11, 2014 Does anyone has an idea of what this error is about "C:\Users\RodolfoNEWlaptop\Desktop\arduino-1.0.2-windows\arduino-1.0.2\libraries\MPU6050_6Axis_MotionApps20/MPU6050_6Axis_MotionApps20.h:37:114: error:" ? Is the first one in a long list. Btw, I think the second one indicates where the problem is: "C:\Users\RodolfoOLDlaptop\Downloads\arduino-1.0.2-windows\arduino-1.0.2\libraries\helper_3dmath\helper_3dmath.h: No such file or directory" I think is trivial but I need someone to help me out please! Regards Quote Link to comment Share on other sites More sharing options...
Flatley Posted June 12, 2014 Report Share Posted June 12, 2014 Does anyone has an idea of what this error is about "C:\Users\RodolfoNEWlaptop\Desktop\arduino-1.0.2-windows\arduino-1.0.2\libraries\MPU6050_6Axis_MotionApps20/MPU6050_6Axis_MotionApps20.h:37:114: error:" ? If you check out the tail end of that error, it gives you the line number that caused it - in this case, line 37 of the MotionApps20 file. If you check that out, you'll see: #include "helper_3dmath.h" Which means it's trying to include that particular header file. Based on the second error, you either don't have it at all or it's not in the right place. You can find it by going up a couple levels to https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050 and throwing everything there into the folder which you're working out of. I had this thing working last summer, (building a quadrotor) but then school started up so I had to hang everything up until now. Back to square one! Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 12, 2014 Report Share Posted June 12, 2014 Thanks for your kind response Flatley, I guess this could be trivial; I'm using another computer (RodolfoNEWlaptop) and I'm trying to compile the sketch ...MPU6050_DMP6.ino from it, based on what you said about the 2nd error, I do have it (helper_3dmath.h) in my libraries. but it's looking for it based on the previous address (C:\\Users\RodolfoOLDlaptop\...) , i.e., the other laptop I first compiled this sketch from. Btw when I moved the entire arduino folder (arduino-1.0.2-windows) from the OLD laptop (including all the libraries/headers from this device) to this NEW one I did copy/paste it from MyDocuments(OLDlaptop) to the Desktop(NEWlaptop). Regards Quote Link to comment Share on other sites More sharing options...
rodolf0ac Posted June 13, 2014 Report Share Posted June 13, 2014 Solved! Just replaced the address (OLDlaptop route) making reference to the "helper_3dmath.h" file in the "MPU6050_6Axis_MotionApps20.h file" by its (helper_3dmath.h) new route (c:\\Users\NEWlaptop\...\helper_3dmath.h). Regards Quote Link to comment Share on other sites More sharing options...
DD1993 Posted December 28, 2015 Report Share Posted December 28, 2015 Hello, could anyone find out how to calibrate the Accel x, y and z? Even with the pdf "MPU HW Offset Registers 1.2" found in the motion_driver_6.12 documentation, I was never able to correct the offsets. Somehow I set the x and y axis near to zero by changing the way how I am writing into the register (i tried out different functions from the I2Cdev.cpp (https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050)). The z axis was either at ca 15000 or at 17000 but never near 16384. In the documentation they did it with the function writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data), but that won't change anything. I hope someone can help me. Quote Link to comment Share on other sites More sharing options...
premsagar0006 Posted August 16, 2017 Report Share Posted August 16, 2017 can anyone suggest me how to use DMP in MPU 6050 ? I want to interface mpu 6050 with FPGA and get the YAW, PITCH AND ROLL values, if i collect the raw data of gyroscope and accelerometer from the registers ii need to perform sensor fusion to get Y,P,R. To avoid this i want to use the DMP which performs the sensor fusion by itself and gives the YAW, PITCH AND ROLL.. Quote Link to comment Share on other sites More sharing options...
abd_jad Posted December 30, 2022 Report Share Posted December 30, 2022 Hi, I am working on a project and I was trying to read the acceleration data. I tried both the real and the world accelerations but i was getting numbers that I don't understand. Is there a way for me to get normal accelerations with m/s^2 ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.