Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measured and Commanded Torque From /lbr/state Have Inverted Signs #249

Open
anselmo-parnada opened this issue Feb 19, 2025 · 2 comments
Open

Comments

@anselmo-parnada
Copy link

anselmo-parnada commented Feb 19, 2025

Hi @mhubii,

The torque values broadcasted from the /lbr/state/ topic (e.g., measured_torque and commanded_torque) seem to have inverted signs, i.e., measurements that are expected to be positive are negative, and vice versa.

I noticed this when visualising my published torque command in the /lbr/command/torque topic alongside the corresponding the commanded torque values fetched from FRI, which is publised via the /lbr/state/ topic.

The plot below shows the torque command (published by my node) and the commanded torque (fetched from FRI) over time. My commanding node publishes a gradually ramping torque command. The expected result is that both torque command and commanded torque should ramp up in the same direction, but they ramp up in opposite directions.

Image

The measured_torque values are also negative when they are expected to be positive.

Is this supposed to happen? Has this been fixed in the rolling version? I currently cannot upgrade to rolling as I have to upgrade my OS, so a fix for the humble version would be much appreciated!

Below are details regarding my development environment.

  • ROS2 Distro: Humble
  • OS: Ubuntu 22.04
  • FRI Version: 1.11
@anselmo-parnada anselmo-parnada changed the title Measured and Commanded Torque in negative direction Measured and Commanded Torque From /lbr/state Have Inverted Signs Feb 19, 2025
@anselmo-parnada
Copy link
Author

The temporary fix I found would be to add minus signs in line 80 and line 95 of lbr_state_broadcaster.cpp.

For instance:

rt_state_publisher_ptr_->msg_.commanded_torque[idx] = -state_interface_map_[joint_name][HW_IF_COMMANDED_TORQUE];

and

rt_state_publisher_ptr_->msg_.measured_torque[idx] = -state_interface_map_[joint_name][hardware_interface::HW_IF_EFFORT];

Not sure if this is a good solution, though. Please let me know your thoughts.

Thanks.

@mhubii
Copy link
Member

mhubii commented Feb 26, 2025

sorry for the delay @anselmo-parnada and thanks for reporting this issue. What a strange find indeed and thank you for reporting. I am not quite convinced this an issue with this code. I'll have to investigate.

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

No branches or pull requests

2 participants