Skip to content

Commit

Permalink
Run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Sep 10, 2024
1 parent dc10435 commit df81e9f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public PhotonPipelineMetadata unpack(Packet packet) {
@Override
public PacketSerde<?>[] getNested() {
return new PacketSerde<?>[] {

};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public PnpResult unpack(Packet packet) {
@Override
public PacketSerde<?>[] getNested() {
return new PacketSerde<?>[] {

};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public TargetCorner unpack(Packet packet) {
@Override
public PacketSerde<?>[] getNested() {
return new PacketSerde<?>[] {

};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public void updateEntries() {
var rawBytesEntry =
subTable
.getRawTopic("rawBytes")
.publish(PhotonPipelineResult.photonStruct.getTypeString(), PubSubOption.periodic(0.01), PubSubOption.sendAll(true));
.publish(
PhotonPipelineResult.photonStruct.getTypeString(),
PubSubOption.periodic(0.01),
PubSubOption.sendAll(true));

resultPublisher =
new PacketPublisher<PhotonPipelineResult>(rawBytesEntry, PhotonPipelineResult.photonStruct);
Expand Down
35 changes: 24 additions & 11 deletions scripts/catnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@
import argparse
from tabulate import tabulate


def list_topics(inst: ntcore.NetworkTableInstance, root: str):

topics = inst.getTable(root).getTopics()
subtables = inst.getTable(root).getSubTables()

print(f"Topics under {root}")
print(tabulate([[topic.getName(), topic.getType().name, topic.getTypeString()] for topic in topics],
headers=["Topic Name", "Type", "Type String"]))
print(
tabulate(
[
[topic.getName(), topic.getType().name, topic.getTypeString()]
for topic in topics
],
headers=["Topic Name", "Type", "Type String"],
)
)
print("")
print(f"Tables under {root}")
print(tabulate([[table] for table in subtables],
headers=["Table Name"]))
print(tabulate([[table] for table in subtables], headers=["Table Name"]))
print("")


def print_topic(inst: ntcore.NetworkTableInstance, topic: str):
sub = inst.getTopic(topic).genericSubscribe(options=
ntcore.PubSubOptions(sendAll=True, pollStorage=20)
sub = inst.getTopic(topic).genericSubscribe(
options=ntcore.PubSubOptions(sendAll=True, pollStorage=20)
)
print("")
print(f"Subscribed to {topic}, typestring '{sub.getTopic().getTypeString()}'")
Expand All @@ -40,18 +47,24 @@ def print_topic(inst: ntcore.NetworkTableInstance, topic: str):
print(f"{topic} = {sub.get().value()} (rate={hz:.1f}hz, samples={count})")
sleep(1)


def connect(inst: ntcore.NetworkTableInstance, server: str):
inst.stopServer()
inst.setServer(server)
inst.startClient4("catnt")


def main():
parser = argparse.ArgumentParser(
description="Cat a topic"
parser = argparse.ArgumentParser(description="Cat a topic")
parser.add_argument(
"--echo", type=str, help="Fully qualified topic name", required=False
)
parser.add_argument("--echo", type=str, help="Fully qualified topic name", required=False)
parser.add_argument(
"--server", type=str, default="127.0.0.1", help="IP address of the NT4 server", required=False
"--server",
type=str,
default="127.0.0.1",
help="IP address of the NT4 server",
required=False,
)
parser.add_argument("--list", help="List all topics", required=False)

Expand Down

0 comments on commit df81e9f

Please sign in to comment.