Repository navigation
Add Cartesian teleop: straight tool moves and tilt about the tip - #27
Conversation
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.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (20)
✨ Finishing Touches
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. Comment |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Joint-limit enforcement, motion interlocks, acceleration handling and coordinated-motion guarantees have unresolved issues.
Review effort: Balanced
Findings: 2
Open (6)
Lookahead extrapolation bypasses joint-limit checks · New Tilt buttons bypass the enable interlock · New Independent RPM clamping breaks coordinated motion · New Blade heading is not preserved for nonvertical poses · New Homing fails to clear cached Cartesian motion rates · New Cartesian roll bypasses acceleration ramping · New
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.
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.
|
The URDF limits are provisional: |
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.
|
Retargeted this PR to the main-bound #28 branch after merging its current head into |
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.
b43441a to
1935e04
Compare
|
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. |
# Conflicts: # BuildInstructions.md # waybionic_teleop/waybionic_teleop/joy_udp_receiver.py # waybionic_teleop/waybionic_teleop/xbox_teleop_node.py
|
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? |



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.synchronizedcomputes 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
1935e043has both the previous PR27 head and published PR28f7b7f64as ancestors, without rewriting either. Isolated ROS Jazzy Composecolcon build/test/test-resultpassed 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
vcanor powered motor was exercised here. Fresh PR27 CI, an independent code-owner approval and the downstream PR31/PR37 integrated tests remain separate gates.