Skip to content

Commit

Permalink
Fix error on yakut/cmd/monitor/_model.py (#108)
Browse files Browse the repository at this point in the history
While passing a Node List (7519.List.1.0.dsdl) from a hardware node to
Ubuntu, yakut monitor produces the following error:

pycyphal.util._broadcast: Unhandled exception in <bound method
Avatar._on_trace of Avatar(node_id=219)>: The truth value of an array
with more than one element is ambiguous. Use a.any() or a.all()
File
"/home/$USER/.local/lib/python3.12/site-packages/yakut/cmd/monitor/_model.py",
line 195, in expand_subjects
    if m.mask:
       ^^^^^^
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()

The node list is produced using .h files produced by nnvg and the
"mask_bitpacked_" field is used instead of "sparse_list" The error is
solved by first checking that the mask is not None and then checking if
it is empty with .any().

---------

Authored-by" Vasileios Vasilopoulos<[email protected]>
Co-authored-by: Pavel Kirienko <[email protected]>
  • Loading branch information
VasileiosVasilopoulos and pavel-kirienko authored Jul 29, 2024
1 parent 15949ea commit 3a22dd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Test and Release Yakut'
on: push
name: 'Test and release Yakut'
on: [ push, pull_request ]

# Ensures that only one workflow is running at a time
concurrency:
Expand All @@ -9,6 +9,8 @@ concurrency:
jobs:
yakut-test:
name: Test Yakut
# https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=edited#pull_request
if: (github.event_name == 'push') || github.event.pull_request.head.repo.fork
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -71,7 +73,9 @@ jobs:
yakut-release:
name: Release Yakut
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '#release') || contains(github.ref, '/main')
if: >
(github.event_name == 'push') &&
(contains(github.event.head_commit.message, '#release') || contains(github.ref, '/main'))
needs: yakut-test
steps:
- name: Check out
Expand Down
2 changes: 1 addition & 1 deletion yakut/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.2
0.13.3
4 changes: 2 additions & 2 deletions yakut/cmd/monitor/_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ def __repr__(self) -> str:
def expand_subjects(m: uavcan.node.port.SubjectIDList_1) -> AbstractSet[int]:
if m.sparse_list is not None:
return frozenset(int(x.value) for x in m.sparse_list)
if m.mask:
return expand_mask(m.mask)
if m.mask is not None and m.mask.any():
return expand_mask(m.mask)
if m.total:
return _COMPLETE_SUBJECT_SET
assert False
Expand Down

0 comments on commit 3a22dd4

Please sign in to comment.