Skip to content

Fix broken assertions in RadarPointCloud PCD header parsing#1191

Open
Mr-Neutr0n wants to merge 1 commit intonutonomy:masterfrom
Mr-Neutr0n:fix/assertion-error-messages
Open

Fix broken assertions in RadarPointCloud PCD header parsing#1191
Mr-Neutr0n wants to merge 1 commit intonutonomy:masterfrom
Mr-Neutr0n:fix/assertion-error-messages

Conversation

@Mr-Neutr0n
Copy link

Summary

Fixes two bugs in RadarPointCloud.from_file() PCD header validation (python-sdk/nuscenes/utils/data_classes.py):

  • Height assertion error message: The check is assert height == 1 but the error message said "height != 0 not supported!". Fixed to say "height != 1 not supported!".

  • COUNT assertion is a no-op: The expression c != c is always False for strings (the NaN != NaN trick only works on floats), so assert len([c for c in counts if c != c]) == 0 always passes regardless of the COUNT values. Replaced with assert all(int(c) == 1 for c in counts) to properly enforce that multi-element fields are not supported by the binary parser.

Test plan

  • Verified both assertions trigger correctly on invalid input
  • Confirmed no other code depends on the previous (broken) behavior

- Fix height assertion error message: said "height != 0" but the check
  is "height == 1", so the message now correctly says "height != 1".

- Fix COUNT assertion: the expression `c != c` is always False for
  strings, making the assertion a no-op. Replace with an explicit check
  that all COUNT values equal 1, since multi-element fields are not
  supported by the binary parser below.
@whyekit-motional
Copy link
Collaborator

Lgtm, thanks for raising this @Mr-Neutr0n!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants