Skip to content

Conversation

@vedh1234
Copy link

@vedh1234 vedh1234 commented Dec 1, 2025

This PR adds support for passing target frames as positional CLI arguments to wrench_transformer_node, similar to tf2_echo. ( Issue #2027 ) Positional arguments override the existing target_frames parameter when both are provided.

Includes:

  • CLI parsing for non-ROS arguments
  • Parameter override logic
  • Updated documentation
  • Test for positional arguments

Copy link
Contributor

@thedevmystic thedevmystic left a comment

Choose a reason for hiding this comment

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

Phenomenal job on adding this features. Appreciate it, @vedh1234

Comment on lines +47 to 61
The wrench transformer can be launched with target frames passed directly as positional arguments:

.. code-block:: bash
ros2 run force_torque_sensor_broadcaster wrench_transformer_node
ros2 run force_torque_sensor_broadcaster wrench_transformer_node frame1 frame2
Target frames may also be set via the ``target_frames`` parameter:

.. code-block:: bash
ros2 run force_torque_sensor_broadcaster wrench_transformer_node \
--ros-args -p target_frames:="['frame1','frame2']"
Positional arguments override the parameter value when both are provided.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest why don't we keep the standalone executable comment too, and introduce tf2_echo frames option as an "option". So that previous usage of the controller can be still used. And the previous documentation is still valid.

Copy link
Author

Choose a reason for hiding this comment

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

The node cannot run without specifying target_frames (it throws an initialization error). I saw the tf2_echo doc which also mentions frame usage, that's why I thought of adding it and removing the older comment. So do you think it's still valid to keep the standalone executable comment or we are supposed to add what successfully runs ?

Copy link
Contributor

@thedevmystic thedevmystic Dec 2, 2025

Choose a reason for hiding this comment

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

If the older implementation of force_torque_sensor_broadcaster can run without specifying the tf_echo argument.

Then, I think we shouldn't throw an error if it is missing.

We should introduce tf_echo as an "option", not a requirement. To keep the backward compatibility, when tf_echo wasn't introduced.

We should make it optional, by providing a default value when none is provided, but currently it is a requirement. This will break the usage of old existing users.

Am I missing something, if so, feel free to inform me.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the clarification!

Just to confirm — the previous implementation of wrench_transformer_node also required target_frames to be non-empty. The parameter had a not_empty<> validator, so launching the node without specifying target_frames already resulted in a parameter validation error.

So the node was never runnable without frames — only the documentation implied it.

This PR doesn’t change that requirement, it just adds an additional way (positional args) to provide the same frames. The parameter-based approach is still fully supported and backward compatible.

Copy link
Contributor

@thedevmystic thedevmystic Dec 2, 2025

Choose a reason for hiding this comment

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

Thanks for clarification.

But this means the not_empty<> is incorrect, as the original documentation explicitly said, it can be used as an standalone executable, without specifying the target frames. As also target frames is initialized as empty list (default value). I think it is a long run inconsistency.

Because, something that is forbidden to be empty, can't have a default value.


Orginal documentation:

The package provides a standalone ROS 2 node wrench_transformer_node that transforms wrench messages published by the ForceTorqueSensorBroadcaster controller to different target frames using TF2. This is useful when applications need force/torque data in coordinate frames other than the sensor frame.

The node subscribes to wrench messages from the broadcaster (either raw or filtered) and publishes transformed versions to separate topics for each target frame.

Usage
The wrench transformer node can be launched as a standalone executable:

ros2 run force_torque_sensor_broadcaster wrench_transformer_node

As we can see, we don't need to specify target frames, do we?

So, I think wrench_transformer_node was intended to be used without explicit target_frames. And tf_echo is a option, not an requirement.

So, i think we should remove the validation, as default value is provided, if it is empty.

force_torque_wrench_transformer:
  target_frames: {
    type: string_array,
    default_value: [],
    description: "...",
    # validation: {
    #   not_empty<>: null
    # }
  }

What do you say, @vedh1234?

Copy link
Member

Choose a reason for hiding this comment

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

what would be the usage of the wrench_transformer_node without target frames? that was not the original intention. The current state of the documentation fixes this, thanks!

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.93%. Comparing base (36cfca8) to head (07857d5).

Files with missing lines Patch % Lines
...ensor_broadcaster/test/test_wrench_transformer.cpp 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2040      +/-   ##
==========================================
+ Coverage   84.91%   84.93%   +0.01%     
==========================================
  Files         148      148              
  Lines       14367    14389      +22     
  Branches     1230     1233       +3     
==========================================
+ Hits        12200    12221      +21     
  Misses       1740     1740              
- Partials      427      428       +1     
Flag Coverage Δ
unittests 84.93% <95.65%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rque_sensor_broadcaster/src/wrench_transformer.cpp 80.00% <100.00%> (+1.33%) ⬆️
...ensor_broadcaster/test/test_wrench_transformer.cpp 91.43% <94.11%> (+0.16%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Thanks a lot, LGTM!

Comment on lines +47 to 61
The wrench transformer can be launched with target frames passed directly as positional arguments:

.. code-block:: bash
ros2 run force_torque_sensor_broadcaster wrench_transformer_node
ros2 run force_torque_sensor_broadcaster wrench_transformer_node frame1 frame2
Target frames may also be set via the ``target_frames`` parameter:

.. code-block:: bash
ros2 run force_torque_sensor_broadcaster wrench_transformer_node \
--ros-args -p target_frames:="['frame1','frame2']"
Positional arguments override the parameter value when both are provided.

Copy link
Member

Choose a reason for hiding this comment

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

what would be the usage of the wrench_transformer_node without target frames? that was not the original intention. The current state of the documentation fixes this, thanks!

@christophfroehlich christophfroehlich added backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted. backport-humble Triggers PR backport to ROS 2 humble. labels Dec 3, 2025
@christophfroehlich christophfroehlich enabled auto-merge (squash) December 3, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-humble Triggers PR backport to ROS 2 humble. backport-jazzy Triggers PR backport to ROS 2 jazzy. backport-kilted Triggers PR backport to ROS 2 kilted.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[force_torque_sensor_broadcaster] wrench_transformer_node handles target frames as positional arguments

3 participants