Skip to content

Bracket ServoJ stream with ServoMoveStart/ServoMoveEnd (~2.1s → ~0.2s latency) - #1

Open
jonathan-fries wants to merge 1 commit into
mainfrom
servo-move-bracketing
Open

Bracket ServoJ stream with ServoMoveStart/ServoMoveEnd (~2.1s → ~0.2s latency)#1
jonathan-fries wants to merge 1 commit into
mainfrom
servo-move-bracketing

Conversation

@jonathan-fries

Copy link
Copy Markdown
Member

What

Bracket the ServoJ command stream with the SDK's ServoMoveStart() / ServoMoveEnd() calls in the ros2_control hardware interface.

  • on_activate(): call ServoMoveStart() after the RPC connect + initial joint sync, before returning SUCCESS (logs the return code; 0 = accepted).
  • on_deactivate(): call ServoMoveEnd() before StopMotion().

Why

write() streams ServoJ(&cmd,&extcmd,0,0,0.008,0,0) at the controller update rate, but the stream was never announced with ServoMoveStart(). robot.h documents these as "Start/End servo motion, used with ServoJ and ServoCart commands." Un-bracketed, the controller appears to treat each ServoJ as a discrete buffered motion, adding a large command→motion latency (~2.1 s).

Downstream (MoveIt Pro / ros2_control joint_trajectory execution) this makes streamed trajectories abort on path tolerance at the start of the move — the commanded position runs ~2 s ahead of the stationary arm, tripping the tolerance (e.g. deviation 0.2007 > tolerance 0.2000) before the arm has moved; the arm then begins moving ~2 s later and stops short. Continuous velocity jogging "works" only because it has no path-tolerance check (it just trails the operator by ~2 s).

Measured result (controlled A/B, same move, same host)

command→motion latency medium/large planned move
before (no bracketing) 2.113 s aborts at start, 0.2007 > 0.2000
after (this PR) 0.158–0.278 s completes at stock 0.2 rad tolerance, 0 errors
  • Robot: Fairino FR5, controller FW 3.98, libfairino 2.3.8 (aarch64), host Qualcomm IQ-9075, ROS 2 Humble, ros2_control at 125 Hz.
  • ServoMoveStart() returns 0 (accepted); no error-14. Latency measured from JTAC controller_state.reference onset vs /joint_states actual-position onset.

Notes

  • ServoJ's acc / vel / filterT / gain are documented "temporarily not available" in robot.h, so they are not viable latency levers — the bracketing is the effective fix.
  • The change is minimal (15 lines, comments included) and behavior-preserving apart from the bracket calls.

Refs FAIR-INNOVATION#39

The hardware interface streamed ServoJ() without first calling
ServoMoveStart() (and never called ServoMoveEnd() on shutdown). The SDK
documents ServoJ as requiring ServoMoveStart/ServoMoveEnd bracketing
(robot.h: "Start/End servo motion, used with ServoJ and ServoCart
commands").

Without the bracket the controller treats each ServoJ as a discrete
buffered motion, adding ~2.1s command->motion latency, which makes
streamed trajectory execution abort on path tolerance (the commanded
position runs ~2s ahead of the arm).

Measured on an FR5 (FW 3.98, libfairino 2.3.8, aarch64): adding the
bracket cut command->motion latency from 2.113s to 0.158-0.278s (~90%)
and planned moves complete at the stock 0.2 rad path tolerance.

Refs FAIR-INNOVATION#39
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.

1 participant