Skip to content

removed admittance_transforms_ struct and relevant functions as it acts just as a intermediary storage #1668

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

mgeethik
Copy link

Resolves #505

Description

After thorough investigation of the issue raised by @destogl in #505 , it was found that the admittance_transforms_ structure introduced unnecessary duplication of frame transformation data already derivable at runtime. This PR removes admittance_transforms_ and instead computes all necessary transforms directly within the update() function, storing only the relevant ones in admittance_state_ where needed.

This change simplifies the codebase and avoids duplicated state between admittance_state_ and admittance_transforms_, improving clarity, modularity, and maintainability.

Changes made

  • Removed get_all_transforms() and the admittance_transforms_ member.
  • Moved all frame transform calculations (world→base, base→sensor, base→control, base→CoG) directly into the update() function.
  • Reused temporary local variables (Eigen::Isometry3d) instead of storing redundant transforms.

Testing

Ran the existing controller tests to verify correctness.
This is the output of the test:

build/admittance_controller/Testing/20250430-1058/Test.xml: 2 tests, 0 errors, 0 failures, 0 skipped
build/admittance_controller/test_results/admittance_controller/test_admittance_controller.gtest.xml: 36 tests, 0 errors, 0 failures, 0 skipped
build/admittance_controller/test_results/admittance_controller/test_load_admittance_controller.gtest.xml: 1 test, 0 errors, 0 failures, 0 skipped

Summary: 39 tests, 0 errors, 0 failures, 0 skipped

Please let me know if this is fine or any changes are required

Copy link

codecov bot commented May 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.81%. Comparing base (945a360) to head (55b07ac).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1668      +/-   ##
==========================================
- Coverage   84.81%   84.81%   -0.01%     
==========================================
  Files         127      127              
  Lines       12114    12108       -6     
  Branches     1036     1036              
==========================================
- Hits        10275    10269       -6     
  Misses       1501     1501              
  Partials      338      338              
Flag Coverage Δ
unittests 84.81% <100.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
.../include/admittance_controller/admittance_rule.hpp 100.00% <ø> (ø)
...ude/admittance_controller/admittance_rule_impl.hpp 92.62% <100.00%> (-0.20%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mgeethik and others added 4 commits May 2, 2025 13:32
…_rule.hpp

Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
…_rule_impl.hpp

Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
…_rule_impl.hpp

Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

@mgeethik I've added some comments

// transform wrench_world_ into base frame
// --- control/base frame to base frame (rotation only) ---
success &= kinematics_->calculate_link_transform(
current_joint_state.positions, parameters_.kinematics.base, tf);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
current_joint_state.positions, parameters_.kinematics.base, tf);
current_joint_state.positions, parameters_.control.frame.id, tf);

Shouldn't it be this?

success &= kinematics_->calculate_link_transform(
current_joint_state.positions, parameters_.control.frame.id,
admittance_transforms_.base_control_);

measured_wrench,
// pass rotations into sensor and CoG:
rot_world_base * admittance_state_.ref_trans_base_ft.rotation(),
rot_world_base * /* CoG rotation */ tf.rotation());
Copy link
Member

Choose a reason for hiding this comment

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

In place of tf.rotation shouldn't it use parameters_.gravity_compensation.frame.id transform?

Copy link
Author

Choose a reason for hiding this comment

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

true. I will change this.

@mgeethik mgeethik requested a review from saikishor May 6, 2025 20:00
mgeethik and others added 2 commits May 8, 2025 01:28
made the newly requested changes

Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
saikishor
saikishor previously approved these changes May 7, 2025
Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

LGTM

@mgeethik mgeethik requested a review from saikishor May 8, 2025 07:12
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.

[AdmittanceController] Do we really need admittance_tranforms_ structure
2 participants