Skip to content

[JTC] Accept larger number of joints than command_joints#809

Merged
saikishor merged 29 commits intoros-controls:masterfrom
christophfroehlich:jtc/dof_independent
Mar 16, 2025
Merged

[JTC] Accept larger number of joints than command_joints#809
saikishor merged 29 commits intoros-controls:masterfrom
christophfroehlich:jtc/dof_independent

Conversation

@christophfroehlich
Copy link
Copy Markdown
Member

@christophfroehlich christophfroehlich commented Oct 30, 2023

This PR softens the condition that the number of joints and command_joints have to be equal: JTC now supports having less command_joints than joints.

This gives the opportunity to track the state and error of passive joints, especially joints that are not command_joints but a degree-of-freedom of the physical system.

As an example, see the cart-pole example in the following video (a pendulum on a cart). Now it is possible to send a swing-up trajectory of the pendulum including values of the cart and the pendulum joint, JTC will do the trajectory interpolation and publishes the full state including the desired values for the pendulum joint, but it finally only can command the cart-joint.

swingup_gh.mp4

This PR does not directly address passive joints being part of a closed-loop kinematic chain, i.e., joints not being a degree-of-freedom of the system. One could track the trajectory of all joints being part of the closed loop, but the kinematics need to be solved in the hardware interface, e.g., by means of a transmission interface.

A future PR will propose a possibility to implement different control laws than PID, e.g., a state-space controller, which is in fact necessary to control the pendulum from the example above.

More implementation details

  • command_joints must be a subset of joints if they don't have the same size.
  • If they have the same size, a 1:1 mapping is assumed independent of the values of command_joints. (see check_interface_names_with_command_joints test)
  • ~/controller_state topic uses a single joint_names vector for all fields. Hence, entries of the output field being not included in command_joints will be NaN.

This would break rqt_joint_trajectory_controller, I used now the required state interface instead of claimed hardware interfaces from the contoller_manager msg.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 30, 2023

Codecov Report

Attention: Patch coverage is 99.44444% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.12%. Comparing base (9063d8f) to head (bd39ebb).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ajectory_controller/joint_trajectory_controller.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #809      +/-   ##
==========================================
+ Coverage   84.88%   85.12%   +0.24%     
==========================================
  Files         124      124              
  Lines       11564    11701     +137     
  Branches      985      997      +12     
==========================================
+ Hits         9816     9961     +145     
+ Misses       1433     1428       -5     
+ Partials      315      312       -3     
Flag Coverage Δ
unittests 85.12% <99.44%> (+0.24%) ⬆️

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

Files with missing lines Coverage Δ
...jectory_controller/joint_trajectory_controller.hpp 100.00% <100.00%> (ø)
...include/joint_trajectory_controller/trajectory.hpp 87.50% <ø> (+12.50%) ⬆️
...ory_controller/src/joint_trajectory_controller.cpp 85.63% <100.00%> (+1.00%) ⬆️
...ler/test/test_load_joint_trajectory_controller.cpp 100.00% <100.00%> (ø)
...ectory_controller/test/test_trajectory_actions.cpp 97.10% <ø> (ø)
...ory_controller/test/test_trajectory_controller.cpp 99.78% <100.00%> (+0.03%) ⬆️
...ntroller/test/test_trajectory_controller_utils.hpp 84.17% <100.00%> (+0.05%) ⬆️
...ajectory_controller/joint_trajectory_controller.py 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

saikishor
saikishor previously approved these changes Oct 30, 2023
Copy link
Copy Markdown
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

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Nov 15, 2023

This pull request is in conflict. Could you fix it @christophfroehlich?

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 11, 2024

This pull request is in conflict. Could you fix it @christophfroehlich?

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 22, 2024

This pull request is in conflict. Could you fix it @christophfroehlich?

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 2, 2024

This pull request is in conflict. Could you fix it @christophfroehlich?

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 29, 2024

This pull request is in conflict. Could you fix it @christophfroehlich?

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 7, 2025

This pull request is in conflict. Could you fix it @christophfroehlich?

Copy link
Copy Markdown
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.

In generl, looks very good to me.

Just some nitpicking things

Copy link
Copy Markdown
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.

Thanks for the explanation.

LGTM

@saikishor saikishor merged commit 08384a2 into ros-controls:master Mar 16, 2025
23 of 27 checks passed
@github-project-automation github-project-automation bot moved this from Review to Done in Roadmap / Features Mar 16, 2025
@saikishor saikishor deleted the jtc/dof_independent branch March 16, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants