Generate the radar point cloud for a scene with velocity component

Hello!! I am very new in this field. I want to extract the pointcloud of radar for one scene along with its velocity component.

I need this data to work later in MatLab.

Until I have used ‘export_scene_pointcloud’ function to extract the pointcloud for a scene but in the output i can only one file repeating over loop.

can you please help me getting all pcd file to have pointcloud for one scene with v comp.

43

@Dnyandeep_Mandaokar your code to get the radar point clouds for a single scene looks correct to me - you simply need to wrap it into a function and then call it while loop over the scenes, e.g.:

for scene in nusc.scene:
  your_function_to_get_radar_pointclouds_of_one_scene()

Thank you so much for quick response.
I am able to get the data now for a scene and now I am taking first three element of shape (x,y,z) .
BUt I will use this data in Matlab, How can I align the vx_com and v_y_com?

Also where I can find the sensor config?

I also noticed all five radar sensors have differnt numbers of points. for for some it 11000 and for some it is just 4000. is this right?

@Dnyandeep_Mandaokar with regards to your various queries:

  1. I also noticed all five radar sensors have differnt numbers of points. for for some it 11000 and for some it is just 4000. is this right?

Yes, depending on the sample, the number of points from the radar can differ

  1. Also where I can find the sensor config?

If you are looking for the extrinsic of the radar, you can check the calibrated_sensor record (for more details, pls take a look at https://www.nuscenes.org/nuscenes#data-format)

is this the write script, I am use scene to extract the data and I believe i am talking all the possible sample I can take. However, scene 0 has 404 samples, I am extracting data for 5 radars with same script but why then the number of pointclouds is different ?
indent preformatted text by 4 spacesfrom
nuscenes import NuScenes
import os.path as osp
import numpy as np
from tqdm import tqdm
from pyquaternion import Quaternion
from PIL import Image
import csv
from nuscenes.utils.data_classes import RadarPointCloud
import matplotlib.pyplot as plt
from nuscenes.utils.geometry_utils import view_points

import the data

nusc = NuScenes(version=‘v1.0-mini’, dataroot=‘D:/Download/Pro2/NUSCENE’, verbose=True)

nusc.list_scenes()
my_scene = nusc.scene[0]

#print(my_scene)
scene_token = my_scene[‘token’]

plt.show()

#print(scene_token)
channel1 = ‘RADAR_FRONT’
channel2 = ‘RADAR_FRONT_LEFT’
channel3 = ‘RADAR_FRONT_RIGHT’
channel4 = ‘RADAR_BACK_LEFT’
channel5 = ‘RADAR_BACK_RIGHT’
channel6 = ‘CAM_FRONT’

scene_rec = nusc.get(‘scene’, scene_token)
start_sample_rec = nusc.get(‘sample’, scene_rec[‘first_sample_token’])

sd_rec1 = nusc.get(‘sample_data’, start_sample_rec[‘data’][channel1])
sd_rec2 = nusc.get(‘sample_data’, start_sample_rec[‘data’][channel2])
sd_rec3 = nusc.get(‘sample_data’, start_sample_rec[‘data’][channel3])
sd_rec4 = nusc.get(‘sample_data’, start_sample_rec[‘data’][channel4])
sd_rec5 = nusc.get(‘sample_data’, start_sample_rec[‘data’][channel5])
sd_rec6 = nusc.get(‘sample_data’, start_sample_rec[‘data’][channel6])

Make list of frames

cur_sd_rec1 = sd_rec1
sd_tokens1 = []
while cur_sd_rec1[‘next’] != ‘’:
cur_sd_rec1 = nusc.get(‘sample_data’, cur_sd_rec1[‘next’])
sd_tokens1.append(cur_sd_rec1[‘token’])

for sd_token1 in tqdm(sd_tokens1):
sc_rec1 = nusc.get(‘sample_data’, sd_token1)
sample_rec1 = nusc.get(‘sample’, sc_rec1[‘sample_token’])
radar_token1 = sd_rec1[‘token’]
radar_rec1 = nusc.get(‘sample_data’, radar_token1)
pc1 = RadarPointCloud.from_file(osp.join(nusc.dataroot, radar_rec1[‘filename’]))

@Dnyandeep_Mandaokar 404 samples for a scene seems wrong - there are usually about 40 samples per scene, since the data in nuScenes is labelled at 2 Hz (and each scene has a duration of approx. 20 secs)