MCPcopy Create free account
hub / github.com/UZ-SLAMLab/ORB_SLAM3 / __init__

Method __init__

Examples/Calibration/python_scripts/process_imu.py:30–74  ·  view source on GitHub ↗
(self, dirName)

Source from the content-addressed store, hash-verified

28 # gyro = np.zeros((1,7))
29
30 def __init__(self, dirName):
31 self.name = dirName
32 self.acc = np.zeros((1, 4))
33 self.gyro = np.zeros((1, 4))
34 self.timesCam = np.zeros((1, 1))
35
36 timesName = self.name + "/cam0/times.txt"
37 timeFile = open(timesName, "r")
38 i = 0
39 next = 0
40 for line in timeFile:
41 currentline = line.split(",")
42 if i%2 == 0:
43 self.timesCam[next] = currentline
44 next = next + 1
45 self.timesCam = np.pad(self.timesCam, ((0, 1), (0, 0)), mode='constant', constant_values=0)
46 i = i + 1
47 print(i, "/", next)
48
49
50 accName = self.name + "/IMU/acc.txt"
51 accFile = open(accName, "r")
52 i = 0
53 for line in accFile:
54 currentline = line.split(",")
55 for j in range(0, 4):
56 self.acc[i][j] = currentline[j]
57 self.acc = np.pad(self.acc, ((0, 1), (0, 0)), mode='constant', constant_values=0)
58 i = i + 1
59
60 gyroName = self.name + "/IMU/gyro.txt"
61 gyroFile = open(gyroName, "r")
62 i = 0
63 for line in gyroFile:
64 currentline = line.split(",")
65 for j in range(0, 4):
66 self.gyro[i][j] = currentline[j]
67 self.gyro = np.pad(self.gyro, ((0, 1), (0, 0)), mode='constant', constant_values=0)
68 i = i + 1
69
70 self.timesCam = np.delete(self.timesCam, self.timesCam.shape[0] - 1, axis=0)
71 self.acc = np.delete(self.acc, self.acc.shape[0] - 1, axis=0)
72 self.gyro = np.delete(self.gyro, self.gyro.shape[0] - 1, axis=0)
73
74 print("Finished")
75
76 def interpolate(self):
77 self.imuSync = np.zeros((self.gyro.shape[0], 7))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected