nutonomy / nuscenes-devkit

The devkit of the nuScenes dataset.
https://www.nuScenes.org
Other
2.24k stars 617 forks source link

The difference between the rotation_rate and yaw_rate in CAN expansion #930

Closed liuyueChang closed 1 year ago

liuyueChang commented 1 year ago

the rotation_rate in the Pose, and the yaw_rate in the vehicle_monitor, what is the difference between the z in rotation_rate and yaw_rate. Just frequency?

whyekit-motional commented 1 year ago

@liuyueChang yes, between rotation_rate (in pose) and yaw_rate in vehicle_monitor, I believe the frequency of the data is different and there is probably some smoothing done to get yaw_rate

You can compare the two via:

import matplotlib.pyplot as plt
import numpy as np
from nuscenes.can_bus.can_bus_api import NuScenesCanBus

nusc_can = NuScenesCanBus(dataroot='/data/sets/nuscenes')

scene_name = 'scene-0001'

rotation_rate_utime = []
rotation_rate = []
for data in nusc_can.get_messages(scene_name, 'pose'):
    rotation_rate_utime.append(data['utime'])
    rotation_rate.append(np.rad2deg(data['rotation_rate'][-1]))

yaw_rate_utime = []
yaw_rate = []
for data in nusc_can.get_messages(scene_name, 'vehicle_monitor'):
    yaw_rate_utime.append(data['utime'])
    yaw_rate.append(data['yaw_rate'])    

# Plot.
plt.plot(rotation_rate_utime, rotation_rate, label = "rotation_rate")
plt.plot(yaw_rate_utime, yaw_rate, label = "yaw_rate")
plt.legend()
plt.xticks([])
plt.show()

image