使用MPU6050检测车辆的速度

huangapple go评论49阅读模式
英文:

Detect the speed of the vehicle using MPU6050

问题

我一直在尝试使用MPU-6050获取车辆的速度,但找不到方法来实现它,所以最终我陷入了困境。

def stateCondition():
    while True:
        acc_x = read_raw_data(ACCEL_XOUT_H)
        acc_y = read_raw_data(ACCEL_YOUT_H)
        acc_z = read_raw_data(ACCEL_ZOUT_H)
        gyro_x = read_raw_data(GYRO_XOUT_H)
        gyro_y = read_raw_data(GYRO_YOUT_H)
        gyro_z = read_raw_data(GYRO_ZOUT_H)
        # 全幅范围+/- 250度/摄氏度,根据灵敏度比例因子
        Ax = acc_x/16384.0
        Ay = acc_y/16384.0
        Az = acc_z/16384.0
        Gx = gyro_x/131.0
        Gy = gyro_y/131.0
        Gz = gyro_z/131.0
        # 在这里继续编写代码以计算车辆的速度(以千米/小时或其他单位)

# 谢谢
英文:

i have been trying to get speed of the vehicle using MPU-6050 but couldn't find my way to do it so,
in the end i am stuck here

def stateCondition():
while True:
    acc_x = read_raw_data(ACCEL_XOUT_H)
    acc_y = read_raw_data(ACCEL_YOUT_H)
    acc_z = read_raw_data(ACCEL_ZOUT_H)
    gyro_x = read_raw_data(GYRO_XOUT_H)
    gyro_y = read_raw_data(GYRO_YOUT_H)
    gyro_z = read_raw_data(GYRO_ZOUT_H)
    # Full scale range +/- 250 degree/C as per sensitivity scale factor
    Ax = acc_x/16384.0
    Ay = acc_y/16384.0
    Az = acc_z/16384.0
    Gx = gyro_x/131.0
    Gy = gyro_y/131.0
    Gz = gyro_z/131.0

can some one please write the rest of it so that it returns the speed of the vehicle in km/hr or whatever it is!!!!!

Thank you

答案1

得分: 1

MPU6050将为您提供关于运动的变化信息(主要是加速或减速,还包括曲线),但不会提供绝对值。这只能通过随时间积分来实现,但这需要已知的起始位置/速度。而且,这是非常不精确的,特别是对于廉价的运动传感器。要获取车辆的速度,使用GNSS模块要容易得多。

英文:

An MPU6050 will provide you with information about changes in motion (acceleration or decelleration mostly, but also curves). It will not provide you with absolute values. That can only be achieved by integrating over time, but this requires a known start position/speed. Also, it is very inexact, particularly with cheap motion sensors such as this one.

To get the speed of a vehicle, it is much easier to use a GNSS module instead.

huangapple
  • 本文由 发表于 2023年2月14日 00:45:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/75438826.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定