nutonomy / nuscenes-devkit

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

in static_layers.py I can't understand the what the function 'correct_yaw' does? #959

Closed npu-wkl closed 11 months ago

npu-wkl commented 11 months ago

in the function 'make_representation',it gets the yaw angle by yaw = quaternion_yaw(Quaternion(sample_annotation['rotation'])) and then yaw_corrected is calculated by yaw_corrected = correct_yaw(yaw)

Is the yaw indicates the angle difference between the instance heading and the positive direction of the x-axis of the global coordinate system? then why correct_yaw is needed?

whyekit-motional commented 11 months ago

@npu-wkl pls look at the docstring for make_representation: https://github.com/nutonomy/nuscenes-devkit/blob/master/python-sdk/nuscenes/prediction/input_representation/static_layers.py#L73-L85

In particular:

nuScenes maps were flipped over the y-axis, so we need to add pi to the angle needed to rotate the heading.

npu-wkl commented 11 months ago

@whyekit-motional Thank you for your rapid reply. Does the word 'flipped' mean that the y and z coordinate remains unchanged but the x coordinate becomes -x?

whyekit-motional commented 11 months ago

Yes, I believe that is the case

npu-wkl commented 11 months ago

@whyekit-motional thank you.Now i get the discreted points of a lane by poses = arcline_path_utils.discretize_lane(lane_record, resolution_meters=1) [(421.2419602954602, 1087.9127960414617, 2.739593514975998), (420.34712994585345, 1088.2930152148274, 2.739830026428688), (419.45228865726136, 1088.6732086473173, 2.739830026428688), (418.5574473686693, 1089.0534020798073, 2.739830026428688), (417.66260608007724, 1089.433595512297, 2.739830026428688), (416.76776479148515, 1089.813788944787, 2.739830026428688), (415.87292350289306, 1090.1939823772768, 2.739830026428688), (414.97808221430097, 1090.5741758097668, 2.739830026428688), (414.0832409257089, 1090.9543692422567, 2.739830026428688), (413.1883996371168, 1091.3345626747464, 2.739830026428688), (412.29355834852475, 1091.7147561072363, 2.739830026428688), (411.39871705993266, 1092.0949495397263, 2.739830026428688), (410.5038757713406, 1092.4751429722162, 2.739830026428688), (409.6090344827485, 1092.8553364047061, 2.739830026428688), (408.7141931941564, 1093.2355298371958, 2.739830026428688), (407.81935190556436, 1093.6157232696858, 2.739830026428688), (406.92451061697227, 1093.9959167021757, 2.739830026428688), (406.0296693283802, 1094.3761101346656, 2.739830026428688), (405.1348280397881, 1094.7563035671556, 2.739830026428688), (404.239986751196, 1095.1364969996453, 2.739830026428688), (403.3451454626039, 1095.5166904321352, 2.739830026428688), (402.4503041740119, 1095.8968838646251, 2.739830026428688), (401.5554628854198, 1096.277077297115, 2.739830026428688), (400.6606215968277, 1096.657270729605, 2.739830026428688), (399.7657803082356, 1097.0374641620947, 2.739830026428688), (398.8709390196435, 1097.4176575945846, 2.739830026428688), (397.9760977310515, 1097.7978510270746, 2.739830026428688), (397.0812564424594, 1098.1780444595645, 2.739830026428688), (396.1864151538673, 1098.5582378920544, 2.739830026428688), (395.2915738652752, 1098.9384313245444, 2.739830026428688), (394.3967548911081, 1099.318677260896, 2.739492242286598), (393.5022271882191, 1099.69960782173, 2.738519982101022), (392.60807027168346, 1100.0814079160527, 2.737547721915446), (391.71428498673856, 1100.4640771829522, 2.7365754617298705)] btw this is the raw code of the Maps tutorial the poses is a list of points,every item in it is a tuple (x,y,yaw) my question: 1、Is the yaw angle we get in the tuple with respect to the global coordinate system? 2、if the answer of question1 is 'no', should i use the function 'correct_yaw' to get the yaw angle wrt the global coordinate system? 3、When should I use ‘correct_yaw’?

whyekit-motional commented 11 months ago
  1. Yes
  2. N.A.
  3. I suppose if you are doing some yaw operation on the map based on the rotation you retrieve from a sample annotation, it would be good to use correct_yaw
npu-wkl commented 11 months ago

@whyekit-motional Thanks a lot. I get the the discreted poses of a lane by the code by poses = arcline_path_utils.discretize_lane(lane_record, resolution_meters=1),and i get the pose of a vehicle retrieve from a sample annotation . According to my understanding they are both in the same coordinate system, so i don't need to make any operations to covert them.In other words,i don't need to care about why 'nuScenes maps were flipped over the y-axis,'. Am i right?

whyekit-motional commented 11 months ago

@npu-wkl yes, based on my understanding of your described use-case, I don't think you need the correct_yaw operation