Skip to content

Add Cartesian teleop: straight tool moves and tilt about the tip - #27

Merged
yassinsolim merged 31 commits into
mainfrom
feature/cartesian-teleop
Oct 10, 2026
Merged

yassinsolim merged 31 commits into
mainfrom
feature/cartesian-teleop

Conversation

@yassinsolim

@yassinsolim yassinsolim commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Scope

Stacked on #28, which now publishes the simulated six-drive F5 stop and heartbeat fix. This PR adds a Cartesian Xbox teleop group that moves the tool tip along a line, rolls about the tool axis and tilts about the tip. Its closed-form arm kinematics and next-period setpoint keep the commanded Cartesian line inside modeled URDF joint limits. DriveMap.synchronized computes nominal per-drive speeds from actual encoder distance to the next setpoint and scales them together at the configured rpm cap. Drive acceleration, encoder quantization and unmeasured gearing can still cause tracking error; this is not synchronized powered-motor proof.

Safety behavior

The simulated consumer rejects missing or nonfinite joint commands, out-of-range setpoints and invalid robot descriptions without a partial coupled update. It preflights all signed-int24 frames, advances the elapsed heartbeat time before accepting a new target, and requires fresh encoder feedback and a released then newly pressed Start after a pause or fault. A stop sends zero-speed, zero-acceleration MKS F5 frames to all six active simulated drives; already-stopped drives do not repeat the frame. Group transitions require neutral controls. ROS shutdown ignores only the observed invalid-context Jazzy subscription error; unrelated runtime errors still propagate. The controller and simulated drive node both fail closed on model change.

Verification

The locally combined head 1935e043 has both the previous PR27 head and published PR28 f7b7f64 as ancestors, without rewriting either. Isolated ROS Jazzy Compose colcon build/test/test-result passed 825 executed tests, zero errors, failures or skips. A separate launch smoke sent UDP gamepad input through teleop to six in-process simulated drives and /joint_states; it observed motion, B stop with six zero-acceleration F5 frames, Start re-arm and clean process exits. The ROS SIGINT error was reproduced before the bounded guard and absent after, with live-context and unrelated-error negative controls.

A limit-bound simulated 30:1 wrist-tilt step displaced the tip 45.373 micrometres with the pinned old drive-map lookahead, versus 1.127 micrometres with this branch, equal to its neutral encoder-quantization control. The ideal pre-quantization solver error was zero. These are simulated geometry measurements, not motor accuracy or performance claims.

Before merging or powering hardware

The base arm's limits and gear ratios are provisional. Mujtaba must identify the actuated wrist joint from the photographed mechanism and supply measured signed travel from upright zero, rotation direction, mechanical stops and cable margins, or confirm continuous rotation. The current PR27 plus PR28 URDF has no collision boxes; PR37 is a separate collision-model change, with its own as-built geometry gate. PR31 owns physical CAN, and no controller hardware, native vcan or powered motor was exercised here. Fresh PR27 CI, an independent code-owner approval and the downstream PR31/PR37 integrated tests remain separate gates.

Replace the placeholder with the five-joint arm exported from
full-arm-smaller.SLDASM. The tools in scripts/cad regenerate the URDF
and meshes after CAD changes. demo_mode:=true sweeps each joint in turn
and reports a pass/fail row per joint on /diagnostics.

Supersedes #7.
Drive the five joints with an Xbox controller through placeholder MKS
SERVO42D/57D CAN drives, simulated until the real drives are connected.
On Windows, a Python-only XInput bridge sends the controller state to
the new wslg-teleop Compose service over UDP. The RViz camera now
follows the tool so the end of the arm stays in view.
# Conflicts:
#	waybionic_bringup/launch/ground_station.launch.py
# Conflicts:
#	waybionic_bringup/CMakeLists.txt
demo_mode:=True or 1 started joint_state_publisher_gui next to the demo,
because the launch compared the raw text with 'true'. And/Not substitutions
parse booleans the same way IfCondition does. The joint demo test now uses
True and fails without this change.

joint_demo rejects a speed_deg_s of zero or less at startup instead of never
finishing a move, and receives use_sim_time like the other nodes. The CAD
script's help now says which export --check-moves compares.
# Conflicts:
#	waybionic_bringup/launch/ground_station.launch.py
follow_camera:=false stopped the camera follower, so RViz lost the
view_focus frame it orbits. The follower now always runs and holds its
default focus when follow is false, and a launch test checks the frame.

teleop and joy_source use And/Or/Equals substitutions, so teleop:=True
works like IfCondition; the teleop test now uses True. The new nodes
receive use_sim_time, and the UDP receiver reads at most 100 packets per
poll so a flood cannot starve its other callbacks.
The arm is a base yaw, three parallel pitch joints and a roll through the
tool tip, so kinematics.py solves any tip position and tool tilt in closed
form from the URDF. The new Cartesian group (Y) moves the tip along straight
lines in base_link with the tilt fixed; LB keeps only the strongest axis.
At a joint speed limit or the workspace edge the whole step shrinks, so the
tip stops on the line, and the roll turns against the yaw to keep the tool's
heading.

Each drive now gets the next setpoint one period ahead and the speed that
reaches it in exactly one period, measured from its encoder, so all drives
arrive together. acc is 255 because a gentle drive ramp adds the same rpm/s
to every drive and the one with the largest change falls behind. In
simulation a sideways cut at 30:1 gearing stays within 7-17 um of the line,
compared with up to 186 um with the old 1.5x speed rule. At the 1:1
placeholder gearing it stays within about 0.13 mm, one encoder count at the
tip.
D-pad left/right changes the tool pitch while the tip stays in place, so
the shoulder, elbow and wrist move around a fixed point. The tilt uses the
same closed-form step as straight moves, so a joint limit stops it with the
tip still in place. It runs at up to 30 deg/s, scaled by the speed level.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 05:54
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6c7b2251-fd1c-4112-847f-bc4e138d1ae8

📥 Commits

Reviewing files that changed from the base of the PR and between 4d3155c and cf1c5fe.


📒 Files selected for processing (20)
  • BuildInstructions.md
  • waybionic_bringup/CMakeLists.txt
  • waybionic_bringup/scripts/camera_follower.py
  • waybionic_bringup/test/test_arm_model_launch.py
  • waybionic_bringup/test/test_cartesian_launch.py
  • waybionic_teleop/config/arm_drives.yaml
  • waybionic_teleop/config/xbox_teleop.yaml
  • waybionic_teleop/test/test_drive_map.py
  • waybionic_teleop/test/test_joy_udp_receiver.py
  • waybionic_teleop/test/test_kinematics.py
  • waybionic_teleop/test/test_sim_arm_drives_node.py
  • waybionic_teleop/test/test_straight_cut.py
  • waybionic_teleop/test/test_teleop.py
  • waybionic_teleop/test/test_xbox_teleop_node.py
  • waybionic_teleop/waybionic_teleop/drive_map.py
  • waybionic_teleop/waybionic_teleop/joy_udp_receiver.py
  • waybionic_teleop/waybionic_teleop/kinematics.py
  • waybionic_teleop/waybionic_teleop/sim_arm_drives_node.py
  • waybionic_teleop/waybionic_teleop/teleop.py
  • waybionic_teleop/waybionic_teleop/xbox_teleop_node.py

 __________________________________________
< Lint long and prosper with cleaner code. >
 ------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • 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

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Joint-limit enforcement, motion interlocks, acceleration handling and coordinated-motion guarantees have unresolved issues.

Review effort: Balanced
Findings: 2 High severity · 4 Medium severity

Open (6)
What changed in this PR

Extends simulated Xbox teleoperation with Cartesian tool-tip control while retaining the existing joint modes. No hardware commands are added.

Changes:

  • Adds closed-form kinematics, straight-line jogging and tip-centered tilt.
  • Introduces encoder-based drive timing and Cartesian motion settings.
  • Adds unit and launch coverage, plus controller documentation.
File Description
waybionic_teleop/​waybionic_teleop/​xbox_teleop_node.py Loads kinematics and reports Cartesian status.
waybionic_teleop/​waybionic_teleop/​teleop.py Implements Cartesian controls and motion state.
waybionic_teleop/​waybionic_teleop/​sim_arm_drives_node.py Refreshes encoder-based drive targets.
waybionic_teleop/​waybionic_teleop/​kinematics.py Adds forward/inverse kinematics and bounded jogging.
waybionic_teleop/​waybionic_teleop/​drive_map.py Calculates lookahead targets and drive speeds.
waybionic_teleop/​test/​test_teleop.py Tests Cartesian controller behavior.
waybionic_teleop/​test/​test_straight_cut.py Tests timing and simulated path accuracy.
waybionic_teleop/​test/​test_kinematics.py Tests geometry, inverse solutions and motion constraints.
waybionic_teleop/​config/​xbox_teleop.yaml Configures Cartesian inputs and speeds.
waybionic_teleop/​config/​arm_drives.yaml Increases simulated drive acceleration.
waybionic_bringup/​test/​test_cartesian_launch.py Checks Cartesian motion through UDP and TF.
waybionic_bringup/​CMakeLists.txt Registers the Cartesian launch test.
BuildInstructions.md Documents Cartesian controls and behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

- Start is refused while a tilt button or A is held, like the sticks.
- Homing clears the Cartesian rates, so releasing A can't resume the last move.
- Cartesian roll ramps with the acceleration limit and scales with the accepted step.
- The drives' setpoint one period ahead stays within the URDF joint limits, which the
  drive node now reads from robot_description.
- If one drive would pass max_rpm, every drive slows by the same factor, so they still
  arrive together.
- The roll compensation is documented as stopping the tool spinning about its own axis;
  that keeps a blade's heading only when the tool points straight down.
- The Cartesian launch test is registered where it won't conflict with #22.
Reviewed in #24, which was merged into its stacked base after #23 had
already been squash-merged into main, so it never reached main. This is
the same change, applied to main.

Drive the five joints with an Xbox controller through placeholder MKS
SERVO42D/57D CAN drives, simulated until the real drives are connected.
On Windows, a Python-only XInput bridge sends the controller state to
the new wslg-teleop Compose service over UDP. The RViz camera follows
the tool so the end of the arm stays in view; follow_camera:=false keeps
a fixed view.

teleop and joy_source use And/Or/Equals substitutions, so teleop:=True
works like IfCondition. The new nodes receive use_sim_time, and the UDP
receiver reads at most 100 packets per poll so a flood cannot starve its
other callbacks.
@mujtaba-zia

Copy link
Copy Markdown
Contributor

This joint shouldn't be restricted to 180 degrees
image

On a busy CI runner the teleop node could still be loading the robot description when the test pressed Start, so the press was lost and the arm never moved. The test now sends idle packets until teleop reports its group and fresh controller input.
The tests could press Start before the teleop node had loaded the robot description or received controller input, so the press was lost on a busy machine. They now send idle packets until teleop reports its group and fresh input. Same fix as on #28.
A second robot_description replaced an enabled teleop with a disabled one without sending a hold, so the drives kept their last target.
@yassinsolim

Copy link
Copy Markdown
Member Author

The URDF limits are provisional: joint_1 currently allows +/-180 degrees, while joint_2 through joint_5 allow +/-90 degrees. The pictured part appears to be at the wrist. Which URDF joint should exceed 180 degrees of total travel? Please provide its measured signed travel from the upright zero position, including any cable or gear limit. If the joint rotates continuously, please confirm that instead. I will update the JOINTS source in scripts/cad/build_arm_description.py and regenerate the URDF so teleop uses the measured limit. I am leaving the provisional limit unchanged until then.

scratch and others added 2 commits October 8, 2026 11:24
absolute_axis rejected -0x800000, which the manual's 3-byte signed coordinate
encodes. The node also capped the elapsed time it handed the drives at 100 ms,
so a scheduler stall longer than the heartbeat never stopped a moving drive the
way hardware would. The drive splits a long step into 10 ms motion steps and
counts all of it toward the heartbeat.
@yassinsolim
yassinsolim changed the base branch from feature/xbox-teleop to feature/xbox-teleop-main October 8, 2026 21:40
@yassinsolim

Copy link
Copy Markdown
Member Author

Retargeted this PR to the main-bound #28 branch after merging its current head into 17494c1. The merge preserves the Cartesian joint-limit and synchronized drive path while including #28 signed-int24 and full-elapsed-time heartbeat fixes. The pinned ROS Jazzy build and test stage passed 762 tests. A direct simulated drive-node check loaded the real URDF, reached the joint_1 limit target of 8,192 encoder counts, then observed one heartbeat stop after a two-second paused host tick before that limit was reached. No powered hardware was tested. The measured travel requested above is still needed before changing any provisional URDF limit, and #28 still needs its independent code-owner approval before this stack reaches main.

Advance simulated heartbeat time before accepting new targets. Use MKS F5 zero-speed frames to stop moving drives and stop all drives on invalid targets. Handle ROS shutdown races without accepting failed node exits. Add controller, CAN, and launch regressions.
@yassinsolim

Copy link
Copy Markdown
Member Author

Moved Malik's four emergency-stop commits (33bba0f to b43441a) off this branch to feature/estop-status-malik, so they get their own PR and review. Nothing was lost; this branch is back at 1935e04.

@mujtaba-zia

mujtaba-zia commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

it's joint_3, the elbow (where the white bend meets the grey tube), not the wrist. can you open it up past -/+90 so it goes as far as it can until it would hit the other part of the arm? it shouldn't be restricted to 180 like it is now.

@yassinsolim
yassinsolim changed the base branch from feature/xbox-teleop-main to main October 10, 2026 18:31
@yassinsolim
yassinsolim merged commit 3ef01c8 into main Oct 10, 2026
1 check was pending
yassinsolim added a commit that referenced this pull request Oct 10, 2026
# Conflicts:
#	BuildInstructions.md
#	waybionic_teleop/waybionic_teleop/joy_udp_receiver.py
#	waybionic_teleop/waybionic_teleop/xbox_teleop_node.py
@yassinsolim

Copy link
Copy Markdown
Member Author

Thanks @mujtaba-zia. The elbow is opened up in #44: joint_3 now goes to 147 degrees each way, 1 degree short of where the forearm meets the shoulder in the CAD. The other joints also stop just short of real contact, and where the limit depends on the shoulder angle, a CAD-measured table gives it. Could you review it?

@yassinsolim
yassinsolim deleted the feature/cartesian-teleop branch November 14, 2026 12:07
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