Localization using IMU
Hi all, I am looking to use IMU sensor to locate my robot.
I found a lot of answers, and I know that there is a problem of drift when using only one sensor for localization. But I want to try now with only one sensor which is IMU. So, I tried these equations in my code:
dt= self.t1 - self.t0
self.ax1=data.linear_acceleration.x
self.ay1=data.linear_acceleration.y
self.speedx = dt*(self.ax1) # get speed from acceleration according to x
self.speedy = dt*(self.ay1) # get speed from acceleration according to y
speed=np.sqrt(( self.speedx * self.speedx)+( self.speedy * self.speedy)) # get speed
# I am using a custom message i.e. the orientation.z is the yaw angle (Euler Angle) in the following equations
self.posx=self.posx+ speed * dt* math.cos(math.radians(data.orientation.z))
self.posy=self.posy+ speed * dt* math.sin(math.radians(data.orientation.z))
I want to know if my method is correct with anyone who has tried this before?
PS: I am using a custom message i.e. the orientation.z is the yaw angle (Euler Angle)
Thank you.
Yes and no. Mathematically speaking makes sense. On the other side you have to take care of the numeric instability and the fact that the yaw angle resets once reaches 360°. Take a look to this question and its code here: link