Repository navigation
Conversation
|
No broken links found in changed files. |
hamishwillee
left a comment
There was a problem hiding this comment.
I pushed three commits of docs review edits to this branch (wording, formatting, restructure of the PTGL-100 page, and cross-links from the rangefinder overview and Flycore page). The inline comments below are the things I couldn't fill in or confirm myself. Note the docs link check will fail until the hero image is added, and the Where to Buy link is a placeholder; the parameter and module reference links resolve once those pages are regenerated after merge.
|
Thanks @hamishwillee for the documentation improvements. I've pushed the updates in 4d2642e:
|
There was a problem hiding this comment.
Thanks for the updates in 4d2642e. I've pushed 02ecf35 with further docs changes, mostly to bring the PTGL-100 page in line with the other rangefinder pages and our new template.
- Added Specifications (from manual §2), Hardware Setup (Mounting, Pinouts, Wiring with pin numbers) and Firmware Support sections. The driver isn't in the common rangefinder set, so the page now says it's only in firmware for boards that enable it, and how to add it.
- Used the standard port, baud-rate and Deconflicting Ports wording, linked the shared rangefinder Testing section, and reduced the Protocol section to the supported commands and a link to the manual.
- Added version badges, the NDAA cell, a link to
SENS_PTGL100_CFGfrom the Flycore page, and a release note.
The inline comments are questions I can't answer from the manual or the code. The most important is the manual's redistribution terms.
One firmware question as well: the driver is fixed at 460800 baud. If a module ships at 115200 (as manual §4.1 says) or is set to 921600, the driver gets no samples and only retries the start command. Should it probe other rates or fall back, or at least report the likely cause in ptgl100 status?
02ecf35 to
72f6231
Compare
|
Thanks @hamishwillee for the documentation improvements and detailed review. I’ve pushed [bb173664b6](bb17366) with the documentation and driver diagnostic updates.
Validation passed: the SITL build, all 15 parser unit tests, and the virtual-UART integration test covering fragmented and invalid frames, measurement failures, communication outages, simulated module restarts, repeated start/stop, the new diagnostics, MAVLink output and ULog recording. |
|
Thanks @amovlgf, that covers everything from the last round. I've pushed 1a8939c with wording and template fixes to the page (mounting guidance from the manual, a generic wiring table, power and port details, and links). A few follow-ups:
Optional: in |
|
Thanks @hamishwillee for the further review. I've checked your edits and pushed [dc0a788568](dc0a788) with the follow-up documentation updates and a module photo.
|
dc0a788 to
d1b2975
Compare
hamishwillee
left a comment
There was a problem hiding this comment.
Thanks @amovlgf. This round is an AI-assisted docs review (Claude), which I've checked before posting.
I've pushed b3ca998 with the fixes it found that didn't need your input:
- Cropped the module photo and converted it to WebP (220 KB → 6 KB).
- Moved the connector type and the Pixhawk adapter sentence from Wiring to Pinouts, and removed lines that repeated other sections (the power draw, and the Flycore pointer above the TELEM3 table).
- Corrected the Protocol summary to match the commands the driver actually sends.
- Named
SENS_PTGL100_CFGwhere the page said "the parameter(s)", and fixed some small wording and grammar issues. - Changed NDAA in the rangefinder table from ✖️ to
~. You said JRT makes no compliance statement, and~is what we use when the status is unknown. - Added
min/maxtoSENS_PTGL100_ROT.
The inline comments are mostly questions only you or JRT can answer, plus two FYIs on changes you should check.
Questions that don't belong to a specific line:
- Direct sunlight: manual §7(2) says not to use the module in direct sunlight (请勿在阳光直射条件下使用该产品). Is that a real limit for outdoor use on a vehicle, or does it only refer to range being reduced (§5 item 7)? If it's a real limit, the page should say so.
- Merge: as agreed, this needs a squash merge so the manual PDF and rendering in earlier commits don't reach
main.
Outstanding: all the earlier review threads are now resolved, so the only open items are the questions in this review.
|
Thanks @hamishwillee for the review. I've pushed [9fb2236c1b](amovlgf@9fb2236) with the follow-up documentation updates:
I also checked both FYIs: the protocol summary matches the driver, and the orientation limits of 0–25 match its startup validation. Both changes are retained. |
|
@amovlgf Hardware test logs could also be attached to this PR. |
There was a problem hiding this comment.
Note
This is an AI review (Claude).
Thanks @amovlgf. I've resolved the 6 threads that are now fixed, and pushed 26ba805a9b to your branch with these changes:
- Pinout drawing: compressed
ptgl100_pinout.png(181 KB → 95 KB). - Pin numbering: merged the two sentences describing pin order on the socket into one.
- Direct sunlight: cited the manual section (§7(2)), as the page does elsewhere.
Please pull before making further changes.
New since the last review
No inline comments this round.
- Hardware test logs: @farhangnaderi asked for hardware test logs. Could you attach a log from the Flycore test (for example, a Flight Review link)?
Still open from earlier reviews
- Pin 1 location: the drawing answers this for the module socket. For the supplied cable, is it wired 1:1, and how is pin 1 marked on it (wire colour, or a mark on the plug)? Please say so on the page instead of "check the corresponding contacts" (
ptgl100.md:65).
EDIT. Once this is sorted I'll have a last look at the docs, but we're probably good :-)
|
Thanks @hamishwillee and @farhangnaderi. I've pushed [013176f91e](amovlgf@013176f) with an annotated photo of the supplied cable connector. The documentation now confirms the pin-to-pin wiring (1–1 through 6–6). All wires shown are black; with the connector viewed as shown and the wires pointing downwards, pin 1 ( Here is the [Flycore TELEM3 hardware ground-test log](https://logs.px4.io/plot_app?log=f1046b38-c45d-42dc-be32-f3c0f66d26a5). It was recorded on firmware |
There was a problem hiding this comment.
Note
This is an AI review (Claude).
Thanks @amovlgf, the cable photo answers the pin 1 question. Thanks also for the Flycore test log. I've resolved the 1 thread that is now fixed, and pushed edf11a7435 to your branch with these changes:
- Units: removed the space between values and unit symbols throughout
ptgl100.md(3.3V,0.8mm,25°C), which is the PX4 docs style. - Cable photo: compressed
ptgl100_cable_pinout.png(1.65 MB → 938 KB).
Please pull before making further changes.
New since the last review
There's one inline suggestion, to tighten the cable description.
- TIMESYNC change: the PR still changes
src/modules/mavlink/mavlink_timesync.cpp(0216ff6, a611639). The same fix is now onmain(#29856), so this file has nothing to do with the rangefinder. Could you rebase ontomainso it drops out of the PR diff? - Cable photo size: at 938 KB it's still large for the docs. Most of it is empty background. Could you crop it to the connector and the top of the wires? Saving it as WebP (like
ptgl100_hero.webp) would also make it much smaller.
Still open from earlier reviews
None.
edf11a7 to
9e966dd
Compare
|
Thanks for the review, @hamishwillee! I rebased onto upstream/main, and the TIMESYNC changes are gone from the PR diff. In 9e966dd, I cropped the cable photo, converted it to WebP, and combined the pin numbering explanation into one sentence. |
hamishwillee
left a comment
There was a problem hiding this comment.
Note
This is an AI review (Claude).
Thanks @amovlgf. I've resolved the 1 thread that is now fixed. I haven't pushed any changes this round.
- Rebase: the TIMESYNC change has dropped out of the PR diff.
- Cable photo: the cropped WebP is 31 KB, down from 938 KB.
- Cable wording: the pin-order sentences are combined as suggested.
New since the last review
No inline comments. CI is green on 9e966dd08d.
Still open from earlier reviews
None. The docs look good to me.
Support the revised PTGL-100 serial protocol and expose range data through the standard sensor, telemetry and logging interfaces. Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
Apply documentation review fixes: consistent measurement terminology, clearer wording, Prettier formatting, a Flycore power note, and cross-links from the rangefinder overview and Flycore board page. Shorten the SENS_PTGL100_ROT long description to the sibling drivers' wording. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Lead with what a user needs: move the driver, validation and protocol detail into a Developer Information section at the end, state the baud requirement up front, and link the parameters, module reference and general rangefinder setup. Add the sensor's entry to the rangefinder overview. The hero image link is a placeholder until the image is supplied. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Put the baud requirement ahead of the tested-on note, move Diagnostics under Developer Information, and add a Where to Buy section. The purchase link is a placeholder until the product page URL is supplied. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Provide the manufacturer resources and verified Flycore TELEM3 setup needed to reproduce the completed hardware test. Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
Bring the PTGL-100 page in line with the rangefinder page template and address review findings: add Specifications, Hardware Setup (mounting, pinouts, wiring with pin numbers) and Firmware Support sections, since the driver is only built for boards that enable it. Use the standard port, baud and deconflicting wording, link the shared testing section, and cut the protocol detail that duplicates the driver and manual. Also add the version badge and NDAA status in the rangefinder overview, link SENS_PTGL100_CFG from the Flycore page, and add a release note. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Make missing sensor replies actionable without treating failed range measurements as a communication outage. Cover the diagnostics and recovery in the virtual-UART integration test. Document the factory baud rate, manufacturer configuration support, connector, EN grounding and ToF technology. Remove the manufacturer manual and rendering and direct readers to JRT for the manual. Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
State that the Flycore hardware test used a custom-made adapter cable to distinguish it from the cable listed in the manufacturer packing list. Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
Bring the page closer to the rangefinder template after the author's latest update, and add the manufacturer's mounting guidance. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Clarify the factory baud rate, supplied cable and tested Flycore wiring so users can reproduce the documented setup. Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
Move the connector type to Pinouts, drop text that repeated other sections, correct the protocol summary to match the commands the driver sends, and use ~ for NDAA since JRT makes no compliance statement. Crop the module photo and convert it to WebP. Bound SENS_PTGL100_ROT to the 0-25 range the driver accepts. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Make the operating limits and connector orientation clear so users can wire and configure the sensor correctly. Keep developer validation instructions beside the tests. Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Make pin 1 identifiable on the supplied cable when preparing an adapter. Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Assisted-by: Codex Signed-off-by: lvguofei <1969354053@qq.com>
9e966dd to
271d0a2
Compare
hamishwillee
left a comment
There was a problem hiding this comment.
Thanks very much @amovlgf !
|
Thanks @hamishwillee for your thorough review, documentation improvements, and approval! Is there anything else needed from me before merging? Do you have a rough idea of when this PR might be merged? I'm happy to help with any remaining steps. |
|
@farhangnaderi Could I please have a review of this? It should just be a "rubber stamp", because the code changes are minimal. |
farhangnaderi
left a comment
There was a problem hiding this comment.
@amovlgf Please address the mentioned comments. Thnks
|
|
||
| } else { | ||
| // The distance bytes are undefined on failure. Do not refresh an old sample. | ||
| perf_count(_measurement_failures); |
There was a problem hiding this comment.
Could we publish the sample with signal_quality = 0 instead? EKF2 already handles that through its bad-quality hysteresis in sensor_range_finder.cpp, and the log and GCS would show the sensor is alive but has no valid return. Something like:
} else {
// Distance bytes are undefined on failure: publish as invalid rather than going silent.
_rangefinder.update(now, 0.f, 0);
perf_count(_measurement_failures);
}There was a problem hiding this comment.
Thanks. A checksum-valid failure reply now publishes a fresh sample with current_distance = 0 and signal_quality = 0. The virtual UART test verified that the invalid samples appear in uORB, MAVLink, and ULog.
| } | ||
|
|
||
| } else if (reply.command == ptgl100::SELF_TEST) { | ||
| _self_test_received = true; |
There was a problem hiding this comment.
If the module reports a hardware fault at boot, the driver keeps publishing and nothing warns the user.
Could we surface it at least once? For example:
_self_test_received = true;
_self_test_status = reply.status;
_self_test_error = reply.error_code;
if (reply.status != ptgl100::STATUS_SUCCESS) {
PX4_WARN("self test failed (status %u, error 0x%02x)", reply.status, reply.error_code);
}An events::send might be even better, so the warning reaches QGC and the log, but a PX4_WARN is a good start.
There was a problem hiding this comment.
Thanks. The driver now logs a warning with the status and error code when the module reports a failed self-test. The virtual UART test verified both the warning and that ranging resumes after the retry.
| } | ||
| } | ||
|
|
||
| TEST(PTGL100Parser, RecoversAfterTruncationWithChecksumCollision) |
There was a problem hiding this comment.
This test shows something worth stating openly: after a cut-off frame, the bytes 55 aa 69 01 01 55 aa 69 pass the additive checksum and decode as a successful 87.47 m reading. The driver then publishes it as a real measurement.
The test only checks that the parser recovers on the next frame. It doesn't check what happened to the bad one, so this is silently accepted.
I understand this comes from the protocol's weak 8-bit checksum and can't be fully prevented in the parser. EKF2's innovation checks would probably reject one spike, too. Still, could we either:
- add a light plausibility check before publishing (for example, reject one sample that jumps far beyond what's physically possible at ~100 Hz), or
- at minimum, add a comment in the driver (not only in the test) noting that a corrupted stream can occasionally produce an in-range phantom reading?
That way, whoever debugs an odd range spike in a log later knows where to look.
There was a problem hiding this comment.
I documented the checksum limitation where the driver publishes measurements. The parser test now explicitly checks the spurious 87.466 m reading and recovery to the next valid 100 m reading. A fixed jump threshold could also reject real changes when the beam moves between surfaces.
Distinguish an invalid range return from a silent UART link and surface module self-test faults. Document the additive checksum collision so an apparently valid spike can be traced to the protocol. Assisted-by: Codex:gpt-6.2-sol Signed-off-by: lvguofei <1969354053@qq.com>
Summary
Make PTGL-100 measurements available through the standard distance_sensor, MAVLink and ULog paths.
Problem
PX4 currently does not support the JRT PTGL-100 laser rangefinder used for altitude measurement.
Solution
Add configurable serial-port assignment and orientation, reply validation, and rate-limited recovery without republishing stale measurements. Enable the driver in Flycore firmware and document wiring, setup and protocol limitations.
Testing
Hardware testing with the PTGL-100 module has been completed, and test logs can be provided on request.
Virtual-UART SITL tests also passed for fragmented, corrupt and legacy frames; range limits; outages and simulated power cycles; repeated start/stop; and standard MAVLink/ULog output.