wheel encoders + mpu605 differential drive mobile robot Odometry

20 views (last 30 days)
Hello dear reader
I have been experimenting for months but coudln't get a precise solution to my problme, which is:
  1. I wish to detect ticks from my encoder in matlab code, Not Simulink. i can't find any function that does that. (Interrupts)
  2. I wish to find my robot's orientation from my MPU6050 sensor.
  3. How do i combine these outputs to get a good estimate of my robot's position to feed them to my closed loop controller in simulink.
  4. Have a wonderful day

Answers (1)

Brian Fanous
Brian Fanous on 6 Sep 2022
You can read data from an mpu650 using an Arduino as described here:
If you simply want to determine orientation consider following this example
but use the imufilter or complementaryFilter as there is no magnetometer present in your setup.
If you would like to fuse wheel encoder ticks and IMU data you should consider using the insEKF filter
  1 Comment
Welid Benchouche
Welid Benchouche on 6 Sep 2022
Thanks for answering dr @Brian Fanous,
However, I am using a raspberry pi, MPU6050 gives me 6 outputs, 3 for accelerometer in 3 axes, and 3 for angular velocities in 3 axes, but how do i use them to get my orientation, and my biggest problem is with getting ticks from the wheel encoder i attached in the picture below, how do i detect that the pin attached to my wheel encoder f249 went high or low, i hope you understand my issue, when i use it in say for example python and use interrupts it gives me a good result, but when i use it in simulink it gives me very low number of ticks for a very high number of wheel rotations, find attached the simulink block i am using, is it because i am using Connected I/O instead of External? is it because of bad usage of sampling time or Configuration parameters ? please help !

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!