How to access ego pose

Given an instance token or a sample token, what is the fastest way for me to access the ego_pose?

Should I safely assume that given a sample token, all the sensor_data shares the same ego_pose token?

1 Like

Hi, no that is incorrect. Every sample_data has its own ego pose. Take a look at https://github.com/nutonomy/nuscenes-devkit/blob/master/schema.md, particularly the fields ending in “_token”. You need to go sample -> sample_data -> ego_pose. You can access the sample data as sample[‘data’][‘CAM_FRONT’].

I feel like there is a discrepancy between what you describe here and the tutorial.

In the tutorial, sample is defined as an annotated keyframe of a scene at a given timestamp. Since it is a keyframe, I am assuming that its associate “sample_data” should have is_key_frame=True, which means (quoted from the schema.md) “the time-stamps should be very close to the sample it points to.”

Therefore, I infer that all the sample_data should have time-stamps very close to each other. And therefore their ego_pose should be very close to each other. This is opposite conclusion from what you describe about.

If the ego_pose of each sample_data is different, which part of my reasoning above is wrong? And what is the best way for me to access the ego pose of the current key frame?

========================
Update:
I did an experiment. You are right, given a sample, all its sensor’s sample data has different time stamp and ego_pose. So it seems like the description in the tutorial is not accurate (over simplified?). Then do you have suggestion which sensor’s ego_pose should be used as the reference of current key frame? I assume it would be LiDAR?

Hi. I guess the keyword here is “very close”. In general the lidar rotates clock-wise starting from “left”. Each camera is triggered when the lidar is in the center of its FOV. So the camera timestamps differ by about 1/6 * lidar_rotation_time (roughly, B0 has a larger FOV). The lidar timestamp is captured when the revolution completes (I believe). The sample also has a timestamp, which (I believe) is inherited from the lidar.
Once we have the timestamp we simply use the closest ego pose, which is published at 50Hz.

For simplicity I suggest you use sample[‘timestamp’].

1 Like

I see! Thank you so much for such detailed explanation.