Skip to content

TC: fix working width discovery - #618

Merged
martonmiklos merged 2 commits into
Open-Agriculture:mainfrom
gunicsba:tc-fix-working-width
Sep 13, 2026
Merged

martonmiklos merged 2 commits into
Open-Agriculture:mainfrom
gunicsba:tc-fix-working-width

Conversation

@gunicsba

Copy link
Copy Markdown
Member

I noticed that the Müller Elektronik sprayer working widths weren't correct.

Now it has fallbacks according to: https://www.isobus.net/isobus/attachments/345/ISO11783-11-DDI-290-SetpointWorkState-v1.pdf

Each Section Device Element shall at least provide one type of Working Width. If
more than one type of Working Width is provided, then the Section Controller shall be
capable to use the different Working Width types with the following priority:

  1. Actual Working Width (DDI 67)
  2. Maximum Working Width (DDI 70)
  3. Default Working Width (DDI 68)

Comment thread isobus/src/isobus_device_descriptor_object_pool_helpers.cpp Outdated
@gunicsba

Copy link
Copy Markdown
Member Author

@GwnDaan I made the changes but not sure why the Build started to fail. It doesn't make sense. previous build only had clang-format error...

@gunicsba

gunicsba commented Apr 5, 2026

Copy link
Copy Markdown
Member Author

@ad3154 @martonmiklos something isn't right with our tests .. for me they seem to fail randomly...
and not just for this PR but for other PRs too.

@ad3154

ad3154 commented Apr 6, 2026

Copy link
Copy Markdown
Member

@ad3154 @martonmiklos something isn't right with our tests .. for me they seem to fail randomly... and not just for this PR but for other PRs too.

Yeah, it's the timing related stuff... the tests do actual thread delays and read actual system time everywhere, which is prone to unpredictability. Ideally we just need to add an abstraction to our timing interface to allow overriding it from a test environment. Adding this abstraction would also greatly speed up the tests....

@ad3154

ad3154 commented Apr 7, 2026

Copy link
Copy Markdown
Member

@ad3154 @martonmiklos something isn't right with our tests .. for me they seem to fail randomly... and not just for this PR but for other PRs too.

I have opened a PR that should finally completely fix the random test failures. It was not fun, but it needed to happen, haha.

#682

@gunicsba
gunicsba requested a review from GwnDaan May 25, 2026 16:45
@gunicsba

Copy link
Copy Markdown
Member Author

Added a few more tests and implemented the same for the booms.

@gunicsba gunicsba changed the title Tc fix working width TC: fix working width discovery Jun 1, 2026
Comment thread isobus/src/isobus_task_controller_server.cpp Outdated
ad3154
ad3154 previously approved these changes Sep 4, 2026
Comment thread test/tc_server_tests.cpp Outdated
Comment thread isobus/src/isobus_task_controller_server.cpp Outdated
Comment thread isobus/src/isobus_task_controller_server.cpp Outdated
@gunicsba

gunicsba commented Sep 12, 2026

Copy link
Copy Markdown
Member Author

Working Width Discovery Fix - Summary

The PR is squashed into a single commit on top of current main, and the review comments are addressed. It only contains the working width fix; the Section / SubBoom deduplication will be done in a separate PR later.

Problem

Section and sub boom widths were only read from ActualWorkingWidth (DDI 67). Some devices (e.g. Müller Elektronik sprayers) only provide Maximum or Default Working Width, so the width was missing.

Width priority (ISO 11783-10, DDI 290 SetpointWorkState)

  1. ActualWorkingWidth (DDI 67 / 0x0043)
  2. MaximumWorkingWidth (DDI 70 / 0x0046)
  3. DefaultWorkingWidth (DDI 68 / 0x0044)

Section and SubBoom store all three values. get_width_with_priority() picks the first one that is present and non-zero, so the order in the DDOP does not matter. If none qualify, an empty ObjectPoolValue is returned.

Other changes

  • TC server: a working set master reporting zero members logs a specific error (and uses break instead of return, so the rx message queue keeps being processed). When more than one member is reported, the client is still accepted and the unsupported member count is logged as an error.
  • Comparisons now put the constant first (0 == numberOfWorkingSetMembers, 1 != numberOfWorkingSetMembers).

Tests (test/tc_server_tests.cpp, suite TaskControllerServerTest)

  • DDOPHelper_SectionWidthPriority: Actual wins even when referenced last, Maximum wins over Default, Default only, and a zero Actual width is skipped.
  • DDOPHelper_SubBoomWidthPriority: all three widths, Maximum + Default, and Default only.
  • DDOPHelper_SubBoomWidthPriorityWithProcessData: values come from DeviceProperty and editable flags from DeviceProcessData.

All 33 TC server / DDOP helper tests pass locally (MSVC, Debug). clang-format has been applied.

Backward compatibility

width_mm is still populated, and no existing members were renamed or removed.

Section and sub boom working widths were only read from Actual Working
Width (DDI 67). Devices such as Müller Elektronik sprayers only provide
Maximum or Default Working Width, so widths were missing.

Per ISO 11783-10 DDI 290 (SetpointWorkState), the width is now chosen
with priority Actual (DDI 67) > Maximum (DDI 70) > Default (DDI 68),
independent of the order the properties appear in the DDOP. All three
values are exposed; width_mm is kept for backward compatibility.

Also, in the TC server, log a specific error when a working set master
reports zero members. When it reports more than one member, the client
is still accepted, and the unsupported member count is logged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@martonmiklos
martonmiklos self-requested a review September 13, 2026 11:04
@martonmiklos
martonmiklos merged commit 1830a47 into Open-Agriculture:main Sep 13, 2026
13 of 14 checks passed
@gunicsba
gunicsba deleted the tc-fix-working-width branch September 13, 2026 19:50
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.

5 participants