PI N-472: check the connect and every setup step, make the object retryable, fix stopmotion - #67
Merged
Merged
Conversation
…bject, working stop
initialize handed PI_ConnectUSB a description with every 0x00 stripped and no
terminator, so the DLL read past the vector until it met a zero by chance; it
also set connectionstatus before the connect was checked, so a -1 return was
logged as "Stage initialized" and a retry was refused. shutdown never cleared
the flag. stopmotion passed a Vector{String} where the DLL wants one string.
Verified on the rig (C-885 SN 124014300): init, stop (returns 1), shutdown,
re-init on the same object, and the held-controller refusal. No motion.
Adds a "PI N472 (no hardware)" testset that skips its DLL path whenever a
controller enumerates, so the suite never commands attached hardware. Bumps
to 0.2.4; documents the ccall-boundary rules in CLAUDE.md and the skills.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Per the ruling that this work collects on 0.3rc1: Project.toml, the README and mc-system-design's install pins return to the 0.3rc1 values (no 0.2.4 bump), and DAQmx's [sources] loses the unrelated rev = "main". Markers read v0.3.0. CHANGELOG: one hardware statement (not verified in this repository; the author's no-motion exercise on a C-885 described as such); the connect string is described as relying on filter's implementation rather than missing a terminator, and not as the cause of the intermittent initialize; the id/shutdown fix and the behaviour changes a pinned rig will see (throw on setup failure, re-zeroing re-initialize, first enumerated controller, default id, setvel's return) are listed individually. CLAUDE.md: provenance without a version, BOOL* rule scoped to GCS2, shutdown clears the id too, driver tests use recorded fakes. rig-causes merges the C-867 and C-885 rows; driver-caveats drops the rig claim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
stopmotion never worked; the connect string is what worked by accident. setvel's return is unchanged in value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # CHANGELOG.md # test/runtests.jl
…a break
It changes behaviour only on a path that was already broken ("Stage
initialized" was logged on a half-set-up stage), which main's versioning rule
(CLAUDE.md, decision 0033) does not count as a break; #64's identical
PIStage change is under Fixed. The entry stays under Changed. Ruled with #67
going into main at 0.2.5-DEV.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Targets main, which carries 0.2.5-DEV since #69 folded 0.3rc1 into it and retired it; no version change here. Original fixes by @AliKNS; review changes on top. Main is merged in at e5d534c: the CHANGELOG and
test/runtests.jlconflicts keep both sides.Fixed (PI N-472 driver,
PI_N472)connectionstatuswas set beforePI_ConnectUSBand its-1never checked. It is now set only after a successful connect; a failure logs the description andPI_GetInitError()and leaves the object retryable. The intermittent initialize seen on the rig is more likely another process holding the controller, made sticky by this bug, than anything in the connect string; that is not established.shutdownnever clearedconnectionstatus, so re-initializing the same object was refused. It now clears the flag.shutdowncould close another object's connection.iddefaulted to0, a valid GCS ID, and was never reset. It now defaults to-1, andshutdownresets it.stopmotionnever reached the controller. It passedstage.axes, aVector{String}, asPtr{Cchar}. It now joins the axes.filterover the enumeration buffer happened to leave a terminator, and the string carried a trailing newline. The first description is now passed, stripped, as aString.Changed
initialize(::N472)now throws when a setup step fails. The steps are reference mode,PI_POS, servos, travel range and velocity. On failure it closes the connection and clears the flag and id, which is the PI stage: refuse to finish initialize unreferenced #64 shape forPIStage. Non-breaking under main's rule (CLAUDE.md, Versioning): it changes behaviour only on a path that was already broken, where "Stage initialized" was logged on a half-set-up stage. Enumeration and connect failures still@errorand return.shutdownnow re-zeroes the frame (reference mode off,PI_POS=homepos, servos on).initializeconnects to the first enumerated one.N472()defaultsidto-1.setvel(::N472)returnsFALSEwhenPI_VELfails.Tests
test/pi_n472_fake_sdk.jlreplaces the GCS2 wrappers with a recorder, the same seam as the TCube fake, so no test can reach a DLL.test/pi_n472.jlcovers the connect string, a failed and a retried connect, no controller, thestopmotionaxes string, shutdown ownership, the default id, and each of nine failing setup steps. On the pre-PR driver 52 fail and 12 error; on this head all pass. Full local suite at e5d534c (xvfb-run -a julia --project -e 'using Pkg; Pkg.test()'): 1079 pass, 8 broken, 0 fail, 0 error.Hardware
Not verified in this repository. The author reports exercising initialize,
stopmotionwith no motion in progress, shutdown, re-initialize and a refused second object on a C-885 (SN 124014300), with no motion commanded. Stop during motion and the connect-failure branch were not exercised on hardware.🤖 Generated with Claude Code