Carla: vehicle speed direction.

Created on 4 Sep 2018  路  2Comments  路  Source: carla-simulator/carla

Does anybody knows how to get the speed direction of the vehicles? From what I know, the yaw direction of the vehicle is not exactly the speed direction.

python question

All 2 comments

I calculate it myself. You just need to know you IMU now, and in the previous moment. IMU, in this case, it's your position on the map ( measurements.player_measurements.transform.location.x , y, z)

    imu_diff = imu_now - imu_last
        if imu_diff[imu_diff != 0].shape[0] == 1:
            for i in range(3):
                if imu_diff[i] > 0:
                      speed[i] = forward_speed
                      return speed 

    x, y, z = imu_diff[0], imu_diff[1], imu_diff[2]

    # velocity_x
    if x != 0:
        speed[0] = forward_speed / np.sqrt(1 + np.square(z / x) + np.square(y / x))

    #velocity_y
    if y != 0:
        speed[1] = forward_speed / np.sqrt(1 + np.square(z / y) + np.square(x / y))

    # velocity_z
    if z != 0:
        speed[2] = forward_speed / np.sqrt(1 + np.square(y / z) + np.square(x / z))

Hi @Romanenko-Serhii , yes you are right. It seem's that we can't get this information directly from carla, so maybe using this differential method is the best way. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AftermathK picture AftermathK  路  3Comments

kk2491 picture kk2491  路  3Comments

kartikye picture kartikye  路  3Comments

UndeadBlow picture UndeadBlow  路  4Comments

mhusseinsh picture mhusseinsh  路  3Comments