Skip to content

Fix Obj_DistLat decode offset (-204.8 m to -204.6 m) - #10

Open
jayden1711 wants to merge 1 commit into
polymathrobotics:mainfrom
jayden1711:fix/distlat-offset
Open

jayden1711 wants to merge 1 commit into
polymathrobotics:mainfrom
jayden1711:fix/distlat-offset

Conversation

@jayden1711

Copy link
Copy Markdown

The Obj_DistLat decode macro used an offset of -1024 * 0.2 = -204.8 m. The ARS408 DBC says -204.6 m, and so do START_ (1023) and OFF_ (-1023) for the same signal in this header. This changes the CALC_Obj_1_General_Obj_DistLat macro to -1023, so raw 1023 decodes to 0 m and every object's lateral distance moves up by 0.2 m.

Replay before the change: with the node built at e451f4d, raw 1023 was published as y = -0.200 where the DBC expects 0.000. The same -0.200 m bias was there at raw 0, 1013, 1033, 1523 and 2047.

Replay after the change: I did not rebuild the whole node. I compiled the new test below against the patched header and it passes. Before the patch the same test fails with -0.2 for raw 1023, -204.8 for raw 0 and 204.6 for raw 2047.

The test is test/test_can_defines.cpp. It sets raw values with the header's SET_ macro and checks that the decoded values are 0, -204.6 and 204.8 m for raw 1023, 0 and 2047. It does not need vcan or ROS, so it also runs when CI is set. I ran it with g++ and Catch2 v3.4.0 in a ROS jazzy container. I did not run it through colcon.

I only touched the Obj_DistLat macro. The Cluster_DistLat macro has a similar mismatch with its OFF_ value, but the node does not decode clusters, so I left it alone.

Fixes #9 (fill in the number of the issue)

I can adjust this if you'd prefer a different approach.

@jayden1711

Copy link
Copy Markdown
Author

The Build and test workflow is waiting on maintainer approval to run. Main also fails in its ROS 2 lyrical job, unrelated to this change. Is anything else needed for review?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Obj_DistLat is decoded with a -204.8 m offset, DBC says -204.6 m (every object 0.2 m off in y)

1 participant