Skip to content

Add Windows ASCII serial bridge for physical-arm bring-up - #54

Closed
AbdulWQ wants to merge 5 commits into
mainfrom
cursor/embedded-ascii-bridge-6c0c
Closed

AbdulWQ wants to merge 5 commits into
mainfrom
cursor/embedded-ascii-bridge-6c0c

Conversation

@AbdulWQ

@AbdulWQ AbdulWQ commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary

  • Adds waybionic_embedded_bridge: Windows host ASCII serial teleop + UDP closed-loop RViz twin for the current UNO R4 / MCP2515 @ 500 kbps / MKS SERVO42D stack (J1, J3, J4/J5; J2 unused).
  • Adds matching firmware under firmware/waybionic_ascii_teleop/ (encoder stream, gear-aware speed/accel, coast-DISABLE).
  • Documents the interim path in docs/embedded_ascii_bridge.md. This sits beside the carrier slcan stack — Docker Desktop on Windows cannot open COM ports, so serial stays on the host.

Known issues (please read)

  1. WASD / pitch–roll / CW–CCW still messy. We are actively fixing key → joint sense. Current intent is W/S = pitch and A/D = roll, with J1 up/down CW/CCW flipped once for local wiring, but physical mounting may still disagree with the URDF twin. Expect follow-up sign fixes.
  2. Coast-DISABLE + live magnetic encoder is not fully tested yet. Hard F3=0 froze encoder updates on these 42Ds, so DISABLE now coasts (F3 on, runtime Ma=0) and we poll 35h raw. Hand-moving a joint after Q and confirming RViz follows has not been verified end-to-end on hardware after the latest flash. POWEROFF remains the hard coil-off path.

Test plan

  • Flash firmware/waybionic_ascii_teleop/waybionic_ascii_teleop.ino
  • start_rviz.ps1 then start_teleop.ps1 on Windows + Docker Desktop
  • Confirm hold-to-move / release-to-stop on J1, J3, wrist
  • Confirm RViz twin tracks under ENABLE (encoder lock message)
  • Re-check WASD pitch vs roll and J1 CW/CCW against the real arm + twin
  • After latest flash: Q coast, hand-move a joint, confirm RViz still updates (explicitly untested so far)

Host package + UNO R4 firmware for the current MCP2515 @ 500 kbps /
MKS SERVO42D stack (J1/J3/J4/J5), with keyboard teleop and a closed-loop
RViz twin over UDP into Docker. This is an interim path alongside the
carrier SLCAN stack, which Docker Desktop on Windows cannot use for COM.

Known open items called out in the package README:
- WASD pitch/roll and J1 CW/CCW sense still need hardware confirmation
- Coast-DISABLE with live magnetic encoder (35h) is implemented but not
  fully tested on hardware yet after the latest flash
@coderabbitai

coderabbitai Bot commented Oct 28, 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: 765ff740-5f1c-49d8-b783-d36fd71cb3b4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Restore digit printI64 and coastCurrentMa=250 on the OG J1/J3/J4/J5
8 MHz / 500 kbps path, and align host/docs labels away from Ma=0.
Use 31h cumulative reads with checksum, force 8Ch respond + SR_vFOC,
accept-all MCP filters, and pause ENC TX while the bus is in TXBO so
Q-mode hand-follow can lock once CAN ACKs return.
Pitch +/-75 now gates DIFF_A/D (the cmds the host actually sends for pitch)
so IRL motors stop with the soft ROM. Xbox sticks/buttons, M sim-only twin
jog, and F5 HOME/SETHOME return to the captured startup encoder pose.

@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 9f250c2.

The Windows ASCII serial bridge has several blocking issues that need to be addressed before approval:

  1. Host-loss safety: The watchdog parameter is ignored, and the firmware lacks a demonstrated command-expiry mechanism.
  2. Emergency stop: A held movement key may issue another command after ESTOP because motion control is not latched disabled.
  3. Wrist mapping: Pitch/roll encoder feedback does not match the keyboard and firmware command conventions.
  4. ROS feedback: Incoming serial data is not polled, preventing the expected /embedded/firmware_line updates.

I've added inline comments identifying each issue and the required corrections.

Testing: The previous local review reported 1,305 passing tests, but those tests do not cover the new standalone bridge. Current GitHub x86 and ARM64 CI jobs are failing. The firmware checks pass for their configured sketches, but the new ASCII sketch is not included in that compilation matrix.

Please address the blocking defects, add regression tests, and complete the Windows hardware validation checklist covering movement directions, stopping, disconnection, coast mode and encoder feedback.

Finally, PR #55 states that its approach supersedes this implementation. Please confirm whether PR #54 is still intended to merge or should be closed in favour of #55.

self._ser: serial.Serial | None = None
self._last_tx = 0.0
self._rx_buf = bytearray()
_ = watchdog_s

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 watchdog parameter is currently discarded rather than enforced.

The previous review also found no command-expiry check in the firmware loop. This leaves continuous motion commands without a demonstrated automatic stop when host communication is lost.

Please implement firmware-enforced command expiry so motion stops after the documented timeout, and add regression tests covering host disconnection and command silence.

print("> ZERO (encoder origin captured, viz bias cleared)")
elif name == "escape":
_safe_send(client, protocol.ESTOP)
held.clear()

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 emergency-stop handler clears the tracked keys but does not latch motion control into a disabled state.

As identified in the previous review, a physically held movement key can be detected again and issue another motion command after ESTOP.

Please require all motion controls to be released and the operator to explicitly re-enable control before accepting new movement commands. Add a regression test covering a key held continuously through ESTOP.

out_right = _shaft_rad(c5, WRIST_GEAR)

# Pitch = average of left/right; roll = differential.
j4 = 0.5 * (out_left + out_right)

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 wrist encoder mapping appears inconsistent with the keyboard and firmware command conventions.

The previous review reproduced this issue: opposite wrist motor counts resulted in zero pitch and approximately -1.047 rad roll, although that movement is commanded as pitch.

Please reconcile the motor directions, gear ratios, and pitch/roll mapping with the actual hardware conventions. Add tests verifying that commanded wrist pitch and roll produce matching encoder feedback and RViz joint states.

self._line_pub.publish(msg)
self.get_logger().info(f"FW: {line}")

self._client = UnoSerialClient(

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 serial client receives an on_line callback, but the previous review found no call to poll_lines() in this ROS node.

Without polling incoming serial data, the callback cannot process received firmware messages, leaving /embedded/firmware_line without the expected updates.

Please add a ROS timer or equivalent receive mechanism to process incoming serial lines, and add a test verifying that firmware messages are published to /embedded/firmware_line.

@yassinsolim

Copy link
Copy Markdown
Member

Closing this in favour of #55, which is merged. #55 brings the real arm up through the ground station's own drive, teleop, diagnostics and RViz nodes on the same UNO R4 + MCP2515 hardware, over the carrier's SLCAN link, so the simulation and the real arm share one code path instead of the real arm having its own bridge and teleop.

This PR was the reference for the hardware setup: the MCP2515 at 500 kbit/s and which drives are fitted. Thank you for getting the hardware talking. The branch cursor/embedded-ascii-bridge-6c0c stays in the repository if anything in it is worth coming back to; for anything that is missing from the new path, please open a new PR.

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.

3 participants