Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix oak topic and lock protobuf version #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"camera-app-kivy": {
"name": "camera-app-kivy",
"type": "app",
"exec_cmd": "/mnt/managed_home/farm-ng-user-<yourusername>/camera-streamer-kivy/entry.sh",
"exec_cmd": "/mnt/managed_home/farm-ng-user-<USERNAME>/camera-streamer-kivy/entry.sh",
"display_name": "Kivy Camera App",
"autostart": false
}
Expand Down
4 changes: 0 additions & 4 deletions service_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"log_level": "INFO",
"subscriptions": [
{
"uri": {
"path": "*",
"query": "service_name=oak0"
},
"every_n": 1
}
]
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ install_requires =
kivy
farm_ng_amiga
PyTurboJPEG
protobuf==5.27.2

tests_require =
pytest

Expand Down
8 changes: 5 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from farm_ng.core.event_service_pb2 import SubscribeRequest
from farm_ng.core.events_file_reader import payload_to_protobuf
from farm_ng.core.events_file_reader import proto_from_json_file
from farm_ng.core.uri_pb2 import Uri
from turbojpeg import TurboJPEG

os.environ["KIVY_NO_ARGS"] = "1"
Expand Down Expand Up @@ -94,7 +93,9 @@ async def run_wrapper():
oak0_client = EventClient(config)

if oak0_client is None:
raise RuntimeError(f"No {config.name} service config provided in service_config.json")
raise RuntimeError(
f"No {config.name} service config provided in service_config.json"
)

# stream camera frames
self.tasks: list[asyncio.Task] = [
Expand All @@ -114,9 +115,10 @@ async def stream_camera(
await asyncio.sleep(0.01)

rate = oak_client.config.subscriptions[0].every_n
uri = {"path": f"{oak_client.config.name}/{view_name}"}

async for event, payload in oak_client.subscribe(
SubscribeRequest(uri=Uri(path=f"/{view_name}"), every_n=rate),
SubscribeRequest(uri=uri, every_n=rate),
decode=False,
):
if view_name == self.view_name:
Expand Down
Loading