Add ROS 2 talker/listener template in Swift#62
Open
Joannis wants to merge 5 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ3DosZiiBU97p3YN1HwxQ
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ3DosZiiBU97p3YN1HwxQ
Two-service app group (talker + listener) using swift-ros2 over CycloneDDS, ROS 2 Humble wire format. Registered in meta.json and root README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ3DosZiiBU97p3YN1HwxQ
…rror) Keeping BUILD_IDLC on (ddsc needs it for builtin types) and disabling the ddsperf tool fixes the "target pattern contains no '%'" configure failure on Debian bookworm's GNU make 4.3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ3DosZiiBU97p3YN1HwxQ
Swift's `print` block-buffers when stdout is a pipe, so a long-running node never flushed. Write each line straight to FileHandle.standardOutput instead (the Swift 6 stdout global can't be used from strict-concurrency code). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ3DosZiiBU97p3YN1HwxQ
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Swift template implementing the canonical ROS 2 Humble talker/listener demo using the pure-Swift swift-ros2 client over CycloneDDS, packaged as a two-service Wendy app group and wired into repo metadata/docs for discoverability.
Changes:
- Introduces
swift/ros2-talker-listener/withtalkerandlistenerSwiftPM executables, each built into its own container image. - Adds Wendy template metadata (
template.json) and app-group configuration (wendy.json) with host-network entitlements for DDS multicast discovery. - Registers and documents the new template in
meta.json, the rootREADME.md, and adds design/plan docs underdocs/superpowers/.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| swift/ros2-talker-listener/wendy.json | Defines a two-service app group (talker + listener) with host networking. |
| swift/ros2-talker-listener/template.json | Declares template variables (APP_ID, ROS_DOMAIN_ID) and description. |
| swift/ros2-talker-listener/README.md | Template-specific usage and interoperability notes. |
| swift/ros2-talker-listener/talker/Sources/talker/main.swift | Swift ROS 2 publisher implementation (1 Hz chatter). |
| swift/ros2-talker-listener/talker/Package.swift | SwiftPM manifest for the talker service. |
| swift/ros2-talker-listener/talker/Dockerfile | Builds CycloneDDS from source and the talker binary in a multi-stage image. |
| swift/ros2-talker-listener/talker/.swift-version | Pins Swift toolchain version for talker. |
| swift/ros2-talker-listener/listener/Sources/listener/main.swift | Swift ROS 2 subscriber implementation (logs chatter). |
| swift/ros2-talker-listener/listener/Package.swift | SwiftPM manifest for the listener service. |
| swift/ros2-talker-listener/listener/Dockerfile | Builds CycloneDDS from source and the listener binary in a multi-stage image. |
| swift/ros2-talker-listener/listener/.swift-version | Pins Swift toolchain version for listener. |
| README.md | Adds a top-level section documenting the new Swift ROS 2 template. |
| meta.json | Registers ros2-talker-listener as a Swift template in repo metadata. |
| docs/superpowers/specs/2026-07-01-ros2-talker-listener-swift-design.md | Design doc for the template implementation. |
| docs/superpowers/plans/2026-07-01-ros2-talker-listener-swift.md | Detailed implementation/validation plan for the template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let msg = StringMsg(data: "Hello World: \(count)") | ||
| try pub.publish(msg) | ||
| log("Publishing: '\(msg.data)'") | ||
| try await Task.sleep(nanoseconds: 1_000_000_000) |
Comment on lines
+7
to
+9
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| cmake git build-essential \ | ||
| && rm -rf /var/lib/apt/lists/* |
Comment on lines
+7
to
+9
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| cmake git build-essential \ | ||
| && rm -rf /var/lib/apt/lists/* |
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.
Summary
Adds
swift/ros2-talker-listener— the canonical ROS 2talker/listenerdemo in Swift, packaged as a two-service app group.rclcpp, no C++ interop) that speaks the ROS 2 wire format directly over CycloneDDS.std_msgs/String("Hello World: N") on/chatterat 1 Hz. listener: subscribes and logs each message.ros2 topic echo /chatterfrom a Humble node sees them).talker,listener) in onewendy.jsonapp group; payoff iswendy device logs.meta.json(languages: ["swift"]) and documented in the rootREADME.md.Design + plan
docs/superpowers/specs/2026-07-01-ros2-talker-listener-swift-design.mddocs/superpowers/plans/2026-07-01-ros2-talker-listener-swift.mdValidation
Rendered the template from tracked files (tokens substituted),
docker buildboth services clean, and ran the pair — the talker publishes and the listener receives every message over real CycloneDDS across two containers:Two build issues found and fixed during validation (see commits):
ddsperftype-gen) → build with-DBUILD_DDSPERF=OFF.printblock-buffers on a pipe sowendy device logsstayed empty → log via unbufferedFileHandle.standardOutput(the Swift 6stdoutglobal is off-limits under strict concurrency).Not yet run on a physical device; local flow was verified by running the listener in the talker's network namespace (deterministic loopback multicast).
🤖 Generated with Claude Code
https://claude.ai/code/session_01VQ3DosZiiBU97p3YN1HwxQ