Skip to content

Commit 1387692

Browse files
committed
tweaks to timestamp
1 parent 5b2763f commit 1387692

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/main/java/WallEye/WallEye.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ public WallEyeResult[] getResults() {
119119
for (int j = 0; j < temp[7]; ++j)
120120
tags[i] = (int) temp[j + 8];
121121

122-
122+
//(long)temp[6]
123123
if(dios.size() == 0 || gyroResults[i][maxGyroResultSize - 1] == null || temp[6] > gyroResults[i][currentGyroIndex - 1 >= 0 ? currentGyroIndex - 1 : maxGyroResultSize - 1].getTimestamp())
124124
results.add(new WallEyeResult(new Pose3d(new Translation3d(temp[0], temp[1], temp[2]), new Rotation3d(temp[3], temp[4], temp[5])),
125-
temp[6], i, curUpdateNum, (int) temp[7], tags, temp[8 + (int) temp[7]] ));
125+
(long)temp[6] + sub.getAtomic().timestamp, i, curUpdateNum, (int) temp[7], tags, temp[8 + (int) temp[7]] ));
126126
else
127127
results.add(new WallEyeResult(new Pose3d(new Translation3d(temp[0], temp[1], temp[2]), findGyro((long)temp[6], i)),
128-
temp[6], i, curUpdateNum, (int) temp[7], tags, temp[8 + (int) temp[7]] ));
128+
(long)temp[6] + sub.getAtomic().timestamp, i, curUpdateNum, (int) temp[7], tags, temp[8 + (int) temp[7]] ));
129129

130130
}
131131
WallEyeResult[] returnArray = new WallEyeResult[results.size()];
@@ -153,7 +153,6 @@ public Rotation3d findGyro(long timestamp, int camIndex) {
153153
return new Rotation3d();
154154

155155
while ((timestamp - gyroResults[camIndex][mid].getTimestamp() > 1.0/camFPS * 1000000 || timestamp - gyroResults[camIndex][mid].getTimestamp() < 0)&& min != mid && loops < 10) {
156-
System.out.println(min + " " + mid + " " + max);
157156
loops++;
158157
if (gyroResults[camIndex][mid].getTimestamp() > timestamp)
159158
max = mid;
@@ -162,7 +161,6 @@ public Rotation3d findGyro(long timestamp, int camIndex) {
162161
mid = max > min ? (max - min) / 2 + min: (maxGyroResultSize - min + max) / 2 + min;
163162
mid %= maxGyroResultSize;
164163
}
165-
System.out.println(gyroResults[camIndex][mid].getTimestamp() + " " + timestamp + " " + loops + " " + Math.abs(gyroResults[camIndex][mid].getTimestamp() - timestamp) + " " + (min != mid));
166164
return new Rotation3d(0, 0, gyroResults[camIndex][mid].getGyro());
167165
}
168166

src/main/java/WallEye/WallEyeResult.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
public class WallEyeResult {
1212
Pose3d cameraPose;
13-
double timeStamp;
13+
long timeStamp;
1414
int updateNum;
1515
int numTags;
1616
int originCam;
@@ -28,7 +28,7 @@ public class WallEyeResult {
2828
* @param tags an array of tag ids that was used to calculate pose
2929
* @param ambiguity a double that represents to confidence of the pose
3030
*/
31-
public WallEyeResult(Pose3d pose, double timeStamp, int originCam, int updateNum, int numTags, int[] tags, double ambiguity) {
31+
public WallEyeResult(Pose3d pose, long timeStamp, int originCam, int updateNum, int numTags, int[] tags, double ambiguity) {
3232
cameraPose = pose;
3333
this.timeStamp = timeStamp;
3434
this.updateNum = updateNum;
@@ -60,7 +60,7 @@ public Pose3d getCameraPose() {
6060
*
6161
* @return timestamp of the result
6262
*/
63-
public double getTimeStamp() {
63+
public long getTimeStamp() {
6464
return timeStamp;
6565
}
6666

0 commit comments

Comments
 (0)