Repository navigation
Windows real-arm bridge - #51
Haroldmin1028 wants to merge 17 commits into
Conversation
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.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
yassinsolim
left a comment
There was a problem hiding this comment.
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:
- Base branch. #45 is merged, so
feature/real-arm-carrieris finished. Merge main into your branch, then change this PR's base tomain. The amd64 CI failure is a flaky Cartesian launch test, not your change. - 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. - 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. - Match the Mac steps. Say to remove
toolfromdrivesinarm_drives.yamlfirst, 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.
|
Failing test being addressed in |
ovilikaris-dotcom
left a comment
There was a problem hiding this comment.
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:
- Complete the one-step Windows startup instructions, including fitted-drive configuration and zeroing.
- Fix the macOS documentation link.
- 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.
|
|
||
| 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. |
There was a problem hiding this comment.
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.
| python -m pip install pyserial | ||
| ``` | ||
|
|
||
| The carrier must already be flashed; see step 1 in #on-macos. |
There was a problem hiding this comment.
Please convert #on-macos into a working Markdown anchor link to the macOS setup section so users can navigate directly to the referenced instructions.
|
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, Thank you for the Windows work; it is what got the first Windows laptop running. The branch |
Docker Desktop can't open Windows COM ports, so
carrier_relayrelays the carrier's COMport to
127.0.0.1:47320. The drive node connects to it withdrive_channel:=socket://host.docker.internal:47320.Changes
waybionic_teleop/carrier_relay.py: passes bytes both ways unchanged, withTCP_NODELAYon. Listens only while the carrier is open. Closes the connection if thecarrier 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 pyserialloop://and asocket 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 thewslg-armservice (teleop over UDP withdrive_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 thesentence about USB access.
Validation
waybionic_teleop: 607 tests, 0 failures. Dockerbuild testpasses.windows-arm.cmdstops with "carrier bridge is not ready"and doesn't start the ground station.
Not yet tested (needs the carrier and a lead)
mks_setup) and command/reply traffic through the bridge