Skip to content

Windows real-arm bridge - #51

Closed
Haroldmin1028 wants to merge 17 commits into
mainfrom
feature/windows-real-arm-harold
Closed

Haroldmin1028 wants to merge 17 commits into
mainfrom
feature/windows-real-arm-harold

Conversation

@Haroldmin1028

Copy link
Copy Markdown
Contributor

Docker Desktop can't open Windows COM ports, so carrier_relay relays the carrier's COM
port to 127.0.0.1:47320. The drive node connects to it with
drive_channel:=socket://host.docker.internal:47320.

Changes

  • waybionic_teleop/carrier_relay.py: passes bytes both ways unchanged, with
    TCP_NODELAY on. Listens only while the carrier is open. Closes the connection if the
    carrier is lost or the bridge stops, so the drive node sees the same thing as a pulled
    USB cable.
  • test/test_carrier_relay.py: 5 tests without hardware, using pyserial loop:// and a
    socket pair. They cover frames passing both ways, carrier loss, bridge stop, a ground
    station disconnect that leaves the carrier open, and connections refused while the
    carrier is unplugged.
  • compose.yaml: adds the wslg-arm service (teleop over UDP with
    drive_interface:=slcan, connected through the bridge).
  • scripts/windows-arm.cmd / .ps1: one-step start. It needs Python 3 and pyserial,
    waits until the bridge is listening, and on exit stops the ground station first, then
    the bridge.
  • BuildInstructions.md: adds a Windows section under Real Arm, and corrects the
    sentence about USB access.

Validation

  • waybionic_teleop: 607 tests, 0 failures. Docker build test passes.
  • With no carrier plugged in, windows-arm.cmd stops with "carrier bridge is not ready"
    and doesn't start the ground station.

Not yet tested (needs the carrier and a lead)

  • Drive scan (mks_setup) and command/reply traffic through the bridge
  • Stopping the bridge and unplugging the carrier: drives stop and need zeroing
  • Zeroing command in the Windows steps
  • Low-speed bench drive move from Windows

yassinsolim and others added 13 commits October 10, 2026 21:01
The drive map uses the CAD gear ratios (26:1 reducers, 3:1 wrist belts) and keeps the tool placeholder at CAN ID 6. slcan_bus writes each tick in one go at 1 Mbaud and follows every frame with an empty line, so a BELL can be matched to the frame the carrier refused. The drive node sends a refused move, stop, setup or zero frame again, shows the carrier's status as can.carrier, stops every drive when the e-stop is pressed, and passes new targets on as soon as teleop sends them. mks_setup finds the drives and sets their CAN IDs and bit rates.
The UDP receiver reports packet loss, jitter, the longest gap and the round trip of a ping that the bridge answers, and warns when the link is unstable. Only the bridge's own answers time the link, and the bridge answers only the station's pings. The receiver polls every millisecond, and xinput_bridge sends at 250 Hz.
scripts/macos.sh gains flash, drives and arm. flash stops with a message naming PR #40 while the carrier firmware is not in the checkout. RoboStack adds joy and pyserial. The build instructions cover flashing the carrier, setting up the drives, removing the placeholder tool drive, zeroing, a remote operator and the monitor rows.
Past MAX_PENDING unanswered lines the link is reopened instead of dropping the oldest, so a later BELL cannot be matched to the wrong frame. On shutdown the drive node waits up to 0.5 s for the carrier to answer and repeats any stop it refused before the carrier is closed.
Each ping nonce is remembered with the bridge it went to, and only the first pong carrying it counts, so a late or replayed pong cannot refresh the round trip.
mks_setup stop now waits for the carrier to take the F7h frame, sends it again if refused, and fails clearly if it never goes out. Both drive simulators deliver frames to broadcast ID 0 to every drive without a reply, as the MKS manual describes.
…t link

close() writes the stops at once and closes the carrier in a finally, so a second Ctrl+C cannot skip them. mks_setup stop fails if the link drops while it waits, and says the carrier took the stop, since drives never answer a broadcast. Carrier writes time out after 0.1 s instead of blocking the loop. The real-arm steps now start with confirmed travel and a working E-stop, and check each gear ratio.
mks_setup requests now send a frame again when the carrier refuses it, and stop with the carrier's problem when the link drops, instead of reporting that no drive answered. The gear-ratio check points at gear_ratio.
The carrier holds at most 32 answers, and a frame it refuses for room needs two, so a stalled bus with many frames unanswered could overflow them and pin later refusals on the wrong frames. A frame beyond the carrier's 16-frame queue is now refused here and handed back like a carrier refusal, and a carrier that leaves the window full for 0.5 s is reopened.
# Conflicts:
#	waybionic_teleop/waybionic_teleop/mks_can.py
#	waybionic_teleop/waybionic_teleop/sim_drives.py
This googletest has no --gtest_fail_if_skipped. It took the flag as unknown, printed its help and exited 0 without running a test, so the step passed with nothing run. The step now fails unless the binary reports passed tests and no skips.
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e69f5d16-6c18-446b-ba5c-c50a58b112f3
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@yassinsolim yassinsolim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Harold. The relay is clean: bytes pass both ways unchanged, it only listens while the carrier is open, and losing the carrier or stopping the bridge closes the connection like a pulled cable. The tests cover each of those cases, and the script's checks for Docker, Python and pyserial are a nice touch. A few things before it merges:

  1. Base branch. #45 is merged, so feature/real-arm-carrier is finished. Merge main into your branch, then change this PR's base to main. The amd64 CI failure is a flaky Cartesian launch test, not your change.
  2. A warning got deleted. In the Mac section, "The receiver takes controller packets from any computer that can reach its port, so do this only on a private network." was replaced by your new section. Please put it back above ### On Windows.
  3. Mac link. "see step 1 in #on-a-mac" isn't a link, and since the heading is now "On macOS", the anchor is #on-macos. Make it [step 1 on macOS](#on-macos), or keep the old heading.
  4. Match the Mac steps. Say to remove tool from drives in arm_drives.yaml first, as the Mac steps do, since the tool drive has no hardware yet. The one-step start also doesn't zero the drives, so say to run the zero command from step 4 before pressing Start.

Not blocking: if port 47320 is already in use, for example by a second bridge, socket.create_server ends in a traceback. A one-line message would be friendlier.

Mujtaba and I will run the hardware checks on your list when we bring up the arm.

@Haroldmin1028
Haroldmin1028 changed the base branch from feature/real-arm-carrier to main October 24, 2026 17:53
@HaroldKim1026

Copy link
Copy Markdown

Failing test being addressed in feature/real-arm-bringup

@ovilikaris-dotcom ovilikaris-dotcom left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed commit 95ab02f.

The six dedicated carrier-relay tests pass, and the x86/ARM64 CI builds succeed. The vcan CI job fails during kernel-package installation, before its tests run.

Before approval, please:

  1. Complete the one-step Windows startup instructions, including fitted-drive configuration and zeroing.
  2. Fix the macOS documentation link.
  3. Attach the planned Windows hardware validation results covering connection, drive scanning, zeroing, low-speed movement, disconnection safety, and launcher shutdown.

I've left inline comments for the documentation corrections.

Windows physical-arm operation remains unverified, so I recommend addressing these items before merging.

Comment thread BuildInstructions.md

The carrier must already be flashed; see step 1 in #on-macos.

**In one step:** plug in only the carrier, put the arm in the zero pose, connect an Xbox controller and double-click `scripts\windows-arm.cmd`. It starts Docker Desktop, the carrier bridge and the controller bridge, each in its own window, then the ground station.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one-step Windows startup instructions are incomplete.

Please document the fitted-drive/tool configuration prerequisite and explicitly explain that the /sim_arm_drives/zero service must be called at the known zero pose before enabling teleop.

The launcher does not perform these steps automatically, so users following only the one-step instructions may not be able to operate the arm correctly.

Comment thread BuildInstructions.md
python -m pip install pyserial
```

The carrier must already be flashed; see step 1 in #on-macos.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please convert #on-macos into a working Markdown anchor link to the macOS setup section so users can navigate directly to the referenced instructions.

@yassinsolim

Copy link
Copy Markdown
Member

Closing this as superseded by #57, which carries the Windows work forward. Your commits "Fix scripts affecting how files are run" and "Add short message when port in already in use" are in #57 with your authorship (bb0b64e, c4e8243), and the Windows launcher is built on them: the relay looks for the carrier's COM port each time it opens it, windows-arm.cmd starts the arm with the setup panel, and #59 adds clone-board detection and a log file. The Windows steps went into docs/operator_guide.md rather than BuildInstructions.md.

Thank you for the Windows work; it is what got the first Windows laptop running. The branch feature/windows-real-arm-harold stays in the repository.

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.

4 participants