Skip to content

Add retargeting of the finger joints #224

Merged
life1ess merged 6 commits intomainfrom
kchinniah/add-retargeting-of-finger-joints
Mar 10, 2026
Merged

Add retargeting of the finger joints #224
life1ess merged 6 commits intomainfrom
kchinniah/add-retargeting-of-finger-joints

Conversation

@kajananchinniahNV
Copy link
Collaborator

@kajananchinniahNV kajananchinniahNV commented Mar 6, 2026

Summary by CodeRabbit

  • New Features

    • Publishes finger joint states for left and right hands during teleoperation.
    • Broadcasts wrist transforms from a configurable world frame to left/right wrist frames.
    • Adds configurable parameters for world, right wrist, left wrist frames and finger joints topic.
    • Exposes finger joint outputs in the teleoperation pipeline and publishes consolidated JointState messages.
  • Documentation

    • Updated README to document the new finger joints topic, parameters, and published modes.

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds retargeted finger-joint JointState publishing and wrist Transform broadcasting to the teleop ROS2 publisher node; introduces world/right/left wrist frame parameters, TriHand retargeters for left/right hands, finger_joints topic and publishers, and exposes finger joint outputs in the node pipeline.

Changes

Cohort / File(s) Summary
Teleop publisher implementation
examples/teleop_ros2/python/teleop_ros2_publisher.py
Adds retargeted finger joint publishing as sensor_msgs/JointState on a new finger_joints_topic; declares world_frame, right_wrist_frame, left_wrist_frame, finger_joints_topic params; adds _pub_finger_joints, _tf_broadcaster; wires TriHandMotionControllerRetargeter for left/right; exposes finger_joints_left/finger_joints_right outputs; adds _TRIHAND_JOINT_NAMES, _FINGER_JOINT_NAMES, _make_transform, _build_wrist_tfs; publishes wrist TFs.
Documentation
examples/teleop_ros2/README.md
Documents the new finger_joints_topic in Published Topics and Available parameters, updates the modes table to mention finger joints, and includes /xr_teleop/finger_joints in example topic echoes.

Sequence Diagram

sequenceDiagram
    participant Node as TeleopRos2PublisherNode
    participant ControllerSource as ControllersSource
    participant RetargeterR as TriHandMotionControllerRetargeter (right)
    participant RetargeterL as TriHandMotionControllerRetargeter (left)
    participant Combiner as OutputCombiner
    participant TF as TransformBroadcaster
    participant FJPub as FingerJoints Publisher

    ControllerSource->>Node: controller inputs (left/right)
    Node->>RetargeterR: forward right controller input
    Node->>RetargeterL: forward left controller input
    RetargeterR-->>Node: right hand finger joints + wrist pose
    RetargeterL-->>Node: left hand finger joints + wrist pose
    Node->>Combiner: expose finger_joints_left / finger_joints_right
    Combiner-->>Node: combined pipeline outputs
    Node->>FJPub: publish JointState (names=_FINGER_JOINT_NAMES, positions=left+right, frame=world_frame)
    Node->>TF: build wrist TransformStamped (world_frame -> wrist frames)
    TF-->>Node: broadcast wrist TFs
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through frames and jointed tunes,

Left and right, retargeted runes,
Finger states on topics sing,
Wrists broadcast beneath the spring,
A teleop hop for everyone!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add retargeting of the finger joints' directly and concisely describes the main change: implementing finger joint retargeting with TriHand integration and publishing capabilities.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kchinniah/add-retargeting-of-finger-joints

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

@kajananchinniahNV kajananchinniahNV force-pushed the kchinniah/add-retargeting-of-finger-joints branch from c185931 to 2fd7ffe Compare March 6, 2026 01:01
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/teleop_ros2/python/teleop_ros2_publisher.py`:
- Around line 485-497: Validate and guard the retargeter outputs before building
and publishing finger_joints_msg: check result contains "finger_joints_left" and
"finger_joints_right", coerce them to numpy arrays and verify their
shapes/lengths match the expected counts implied by _FINGER_JOINT_NAMES (or half
each if names are split), and handle mismatches by logging a warning and either
skipping publish or filling with safe defaults (e.g. zeros) so that
finger_joints_msg.position always has the correct length; update the code around
finger_joints_msg, left_joints/right_joints, and the publish call to perform
these checks and safe fallback behavior.

In `@examples/teleop_ros2/README.md`:
- Line 74: The README's parameter list omitted the declared parameter
finger_joints_topic; update the documented "Available parameters" string to
include `finger_joints_topic` alongside `hand_topic`, `twist_topic`, etc., so
the README matches the node's actual parameters (the node named
/teleop_ros2_publisher and its parameter `finger_joints_topic`).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e4ae86d1-1adb-4578-af50-ce75854cb856

📥 Commits

Reviewing files that changed from the base of the PR and between cf8558b and 2fd7ffe.

📒 Files selected for processing (2)
  • examples/teleop_ros2/README.md
  • examples/teleop_ros2/python/teleop_ros2_publisher.py

@kajananchinniahNV kajananchinniahNV force-pushed the kchinniah/add-retargeting-of-finger-joints branch from 2fd7ffe to 126837c Compare March 9, 2026 07:31
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/teleop_ros2/python/teleop_ros2_publisher.py`:
- Around line 586-599: The wrist TFs are being built from the AIM pose instead
of the controller grip pose; change the wrist frame construction so
_build_wrist_tfs uses the controllers' ControllerInputIndex.GRIP_POSITION and
ControllerInputIndex.GRIP_ORIENTATION (or pass explicit grip pose objects)
rather than the aim pose produced by _build_ee_msg_from_controllers, updating
the call site that currently passes ee_msg and the boolean checks for
right_ctrl.is_none/left_ctrl.is_none to supply the grip poses (or change
_build_wrist_tfs to read grip fields), and keep the TF names
right_wrist_frame/left_wrist_frame as-is (or rename if you intentionally want
aim-based frames).
- Around line 397-406: Add a deprecated alias parameter "frame_id" that maps to
the existing "world_frame" so legacy --ros-args -p frame_id:=... continues to
work: declare a second parameter using declare_parameter("frame_id", "world",
ParameterDescriptor(description="DEPRECATED: use 'world_frame' instead",
additional_description_or_deprecation_flag_if_available)) and, wherever the node
reads the frame name (e.g., code that calls get_parameter or accesses
"world_frame"), prefer an explicit precedence rule that checks "frame_id" first
and falls back to "world_frame" (or default "world") so both declarations are
accepted; apply the same change for the other occurrence block referenced (lines
449-475).

In `@examples/teleop_ros2/README.md`:
- Around line 36-38: Add documentation for the new publisher by updating the
"Published Topics" list to include the topic name xr_teleop/finger_joints with
message type sensor_msgs/JointState and a short description that it publishes
retargeted finger joint angles for the robot; mention which modes publish it
(controller_teleop and hand_teleop) and note that it contains joint names and
position arrays corresponding to the robot finger joints so users know to
subscribe for finger-joint retargeting data (reference the topic name
xr_teleop/finger_joints and message type sensor_msgs/JointState when editing
README.md).
- Around line 94-95: The README table row for the `controller_teleop` mode is
missing the `finger_joints` output; update the `controller_teleop` row to list
`finger_joints` alongside the existing outputs (e.g., `ee_poses`, `root_twist`,
`root_pose`, `tf`) so the table correctly reflects that `controller_teleop`
publishes the new `finger_joints` topic.
- Line 112: Add a line showing how to echo the finger joint JointState so users
can validate retargeting: include an example command to inspect the
xr_teleop/finger_joints topic (sensor_msgs/msg/JointState) in the README near
the existing `/tf` example, e.g., mirror the `/tf` example by adding a `ros2
topic echo /xr_teleop/finger_joints sensor_msgs/msg/JointState` entry so readers
can view finger joint messages.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 15f37740-eed7-40be-935f-8c00458eca1b

📥 Commits

Reviewing files that changed from the base of the PR and between 2fd7ffe and 126837c.

📒 Files selected for processing (2)
  • examples/teleop_ros2/README.md
  • examples/teleop_ros2/python/teleop_ros2_publisher.py

@kajananchinniahNV kajananchinniahNV force-pushed the kchinniah/add-retargeting-of-finger-joints branch from 126837c to 5d6c7d9 Compare March 9, 2026 17:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/teleop_ros2/python/teleop_ros2_publisher.py`:
- Around line 623-637: In the controller_teleop branch (where self._mode ==
"controller_teleop"), change the publishing logic so finger joints are published
when either left_joints or right_joints is available (use OR, not AND) and build
the position array from whichever side(s) exist; specifically, update the
condition that checks left_joints and right_joints, use list(left_joints) /
list(right_joints) (or list(TensorGroup)) when converting to numpy to honor
sequence protocol, and concatenate the available arrays (treat missing side as
an empty sequence) before setting finger_joints_msg.position and calling
self._pub_finger_joints.publish; keep references to the same symbols:
left_joints, right_joints, finger_joints_msg, _pub_finger_joints, and
_FINGER_JOINT_NAMES.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c2f9b6f1-5000-4487-8421-1d6aa505ce49

📥 Commits

Reviewing files that changed from the base of the PR and between 37a8de1 and 254e384.

📒 Files selected for processing (1)
  • examples/teleop_ros2/python/teleop_ros2_publisher.py

@life1ess life1ess enabled auto-merge (squash) March 10, 2026 05:56
@life1ess life1ess merged commit e8b682c into main Mar 10, 2026
57 of 60 checks passed
@life1ess life1ess deleted the kchinniah/add-retargeting-of-finger-joints branch March 10, 2026 15:23
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.

2 participants