-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update mpu6050driver.cpp #1
base: main
Are you sure you want to change the base?
Conversation
Sorry, I actually only want to commit 'Update mpu6050driver.cpp'. the other commits are only specific to my usecase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
|
||
Grant user access to i2c, need to reboot afterwards: | ||
|
||
sudo usermod <user-name> -aG i2c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sudo usermod <user-name> -aG i2c | |
sudo usermod <user-name> -aG i2c # or this: sudo chmod +777 /dev/i2c-* |
the called parameter to calc the duration should be "frequency"