Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

Haseeb Vashishth




Posted Questions



Wait...

Posted Answers



Answer


UHS-II cards have a second row of pins as compared to UHS-I, so they can be quite a bit faster, everything else being equal, BUT your camera needs to have slot(s) that also have the second row of pins AND their firmware needs to be able to take advantage of UHS-III to get the benefits.


Answer is posted for the following question.

What is uhs 2?

Answer


Tarocash Casuarina

Address: Shop GD 217 Casuarina Square, 247 Trower Rd, Casuarina NT 0810, Australia


Answer is posted for the following question.

Where would I locate best menswear shop in Darwin, Australia?

Answer


1
"""
2
This code is to sort out a reply to
3
https://github.com/nutonomy/nuscenes-devkit/issues/122
4
"""
5
6
import numpy as np
7
import matplotlib.pyplot as plt
8
9
from pyquaternion import Quaternion
10
11
from nuscenes import NuScenes
12
13
GLOBAL_X_AXIS = np.array([1, 0, 0])
14
GLOBAL_Z_AXIS = np.array([0, 0, 1])
15
16
17
def unit_vector(vector):
18
    """ Returns the unit vector of the vector.  """
19
    return vector / np.linalg.norm(vector)
20
21
22
def angle_between(v1, v2):
23
    """ Returns the angle in degrees between vectors 'v1' and 'v2' """
24
    v1_u = unit_vector(v1)
25
    v2_u = unit_vector(v2)
26
    return 180/np.pi * np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))
27
28
29
def main():
30
    nusc = NuScenes('v1.0-mini')
31
32
    scene_number = 6
33
34
    # Grab first sample
35
    sample = nusc.get('sample', nusc.scene[scene_number]['first_sample_token'])
36
37
    # Cycle through all samples and store ego pose translation and rotation.
38
    poses = []
39
    while not sample['next'] == '':
40
        sample = nusc.get('sample', sample['next'])
41
        lidar = nusc.get('sample_data', sample['data']['LIDAR_TOP'])
42
        pose = nusc.get('ego_pose', lidar['ego_pose_token'])
43
        poses.append((pose['translation'], Quaternion(pose['rotation'])))
44
45
    # Print values for first pose.
46
    (x, y, _), q = poses[0]
47
    print('First location (x, y): {:.1f}, {:.1f}'.format(x, y))
48
    print('Orientation at first location: {:.2f} degrees'.format(q.degrees))
49
50
    # Plot all poses on global x, y plan along with orientation.
51
    # This doesn't really answer the question, it's just as a sanity check.
52
53
    for (x, y, z), q in poses:
54
        plt.plot(x, y, 'r.')
55
56
        # The x axis of the ego frame is pointing towards the front of the vehicle.
57
        ego_x_axis = q.rotate(GLOBAL_X_AXIS)
58
        plt.arrow(x, y, ego_x_axis[0], ego_x_axis[1])
59
60
    plt.axis('equal')
61
    plt.xlabel('x-global')
62
    plt.ylabel('y-global')
63
64
    # Calculate deviations from global vertical axis and plot.
65
    # This demonstrates that the z-axis of the ego poses are not
66
    # all pointing upwards.
67
68
    vertical_offsets = []
69
    for (_, _, _), q in poses:
70
71
        # The z axis of the ego frame indicates deviation from global vertical axis (direction of gravity)
72
        ego_z_axis = q.rotate(GLOBAL_Z_AXIS)
73
        vertical_offsets.append(angle_between(ego_z_axis, GLOBAL_Z_AXIS))
74
75
    plt.savefig('xyposes.png')
76
    plt.figure()
77
    plt.hist(vertical_offsets)
78
    plt.xlabel('Angle (degrees)')
79
    plt.ylabel('Count')
80
    plt.title('Offset from global vertical axis.')
81
    plt.savefig('vertical_offsets.png')
82
83
    # Finally show that all calibrated sensor tokens for a particular scene is indeed the same
84
    sample = nusc.get('sample', nusc.scene[scene_number]['first_sample_token'])
85
86
    cali_sensor_tokens = []
87
    while not sample['next'] == '':
88
        sample = nusc.get('sample', sample['next'])
89
        lidar = nusc.get('sample_data', sample['data']['LIDAR_TOP'])
90
        cali_sensor = nusc.get('calibrated_sensor', lidar['calibrated_sensor_token'])
91
        cali_sensor_tokens.append(cali_sensor['token'])
92
93
    # Assert that they all point to the same calibrated sensor record
94
    assert len(set(cali_sensor_tokens)) == 1
95
96
97
if __name__ == "__main__":
98
    main()
99

Answer is posted for the following question.

How to ego vehicle coord system parallel to world z plane nuscenes (Python Programing Language)


Wait...