Skip to content

Commit

Permalink
Run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Dec 23, 2024
1 parent cc65b19 commit a12985e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
package org.photonvision.common.util;
/*
* Copyright (C) Photon Vision.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import org.photonvision.common.dataflow.networktables.NetworkTablesManager;
package org.photonvision.common.util;

import edu.wpi.first.networktables.IntegerArrayPublisher;
import edu.wpi.first.networktables.IntegerPublisher;
import edu.wpi.first.networktables.StringArrayPublisher;
import org.photonvision.common.dataflow.networktables.NetworkTablesManager;

public class EpochPublisher {

private IntegerArrayPublisher timePub;
private StringArrayPublisher namePub;

public EpochPublisher(String nickname) {
this.timePub = NetworkTablesManager.getInstance().kRootTable.getSubTable(nickname).getIntegerArrayTopic("tracer/timesUs").publish();
this.namePub = NetworkTablesManager.getInstance().kRootTable.getSubTable(nickname).getStringArrayTopic("tracer/epochNames").publish();
this.timePub =
NetworkTablesManager.getInstance()
.kRootTable
.getSubTable(nickname)
.getIntegerArrayTopic("tracer/timesUs")
.publish();
this.namePub =
NetworkTablesManager.getInstance()
.kRootTable
.getSubTable(nickname)
.getStringArrayTopic("tracer/epochNames")
.publish();
}

public void consume(OrderedTracer tracer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.RobotController;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

Expand Down Expand Up @@ -107,6 +104,7 @@ public long[] getEpochTimes() {
}
return arr;
}

public String[] getEpochNames() {
return m_epochs.keySet().toArray(new String[0]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public CapturedFrame getInputMat() {
// Hal::initialize was called
long captureTimeNs = cvSink.grabFrame(mat.getMat()) * 1000;

tracer.addEpoch("UsbFrameProvider::grabFrrame");
tracer.addEpoch("UsbFrameProvider::grabFrame");

if (captureTimeNs == 0) {
var error = cvSink.getError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ public VisionModule(PipelineManager pipelineManager, VisionSource visionSource,
this::setPipeline,
pipelineManager::getDriverMode,
this::setDriverMode);
epochPublisher =
new EpochPublisher(
visionSource.getSettables().getConfiguration().nickname);
epochPublisher = new EpochPublisher(visionSource.getSettables().getConfiguration().nickname);
uiDataConsumer = new UIDataPublisher(index);
statusLEDsConsumer = new StatusLEDConsumer(index);
addResultConsumer(ntConsumer);
Expand Down Expand Up @@ -609,7 +607,8 @@ private void consumeResult(CVPipelineResult result) {
tracer.addEpoch("VisionModule::consume streams");

// tracer.printEpochs();
epochPublisher.consume(tracer);;
epochPublisher.consume(tracer);
;
}

private void consumePipelineResult(CVPipelineResult result) {
Expand Down

0 comments on commit a12985e

Please sign in to comment.