Update mpu6050driver.cpp#1
Conversation
|
Sorry, I actually only want to commit 'Update mpu6050driver.cpp'. the other commits are only specific to my usecase |
leeyunhome
left a comment
There was a problem hiding this comment.
Hello, @JosefGst @hiwad-aziz
Thank you for your nice article
I have some questions.
- What is the license for this library?
- I want to get angles like below url.
url : https://github.com/tockn/MPU6050_tockn
How can I get angles using this mpu6050driver? - Can I substitute sensor_msgs::msg::Imu to custom msg?
like below.
builtin_interfaces/Time stamp int16 accx int16 accy int16 accz int16 gyrx int16 gyry int16 gyrz float32 angx float32 angy float32 angz
Thank you very much.
|
hello @leeyunhome
|
|
Hello, Thank you for your answer. you may need to integrate all the angular velocities and devide over time. Let me explain what I think In the project I referenced above (https://github.com/tockn/MPU6050_tockn) The angle was calculated with the raw data as shown below. ` rawAccX = wire->read() << 8 | wire->read(); temp = (rawTemp + 12412.0) / 340.0; accX = ((float)rawAccX) / 16384.0; angleAccX = atan2(accY, sqrt(accZ * accZ + accX * accX)) * 360 / 2.0 / PI; gyroX = ((float)rawGyroX) / 65.5; gyroX -= gyroXoffset; interval = (millis() - preInterval) * 0.001; angleGyroX += gyroX * interval; angleX = (gyroCoef * (angleX + gyroX * interval)) + (accCoef * angleAccX); Thank you. |
Co-authored-by: Anas Derkaoui <115218309+anasderkaoui@users.noreply.github.com>
the called parameter to calc the duration should be "frequency"