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

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

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

Conversation

christophfroehlich
Copy link
Contributor

@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

codecov bot commented Oct 30, 2023

Codecov Report

Attention: Patch coverage is 91.48936% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 72.61%. Comparing base (0b43291) to head (2456246).

❗ Current head 2456246 differs from pull request most recent head f983bcf. Consider uploading reports for the commit f983bcf to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #809      +/-   ##
==========================================
+ Coverage   71.86%   72.61%   +0.75%     
==========================================
  Files          41       41              
  Lines        3650     3652       +2     
  Branches     1794     1780      -14     
==========================================
+ Hits         2623     2652      +29     
+ Misses        707      686      -21     
+ Partials      320      314       -6     
Flag Coverage Δ
unittests 72.61% <91.48%> (+0.75%) ⬆️

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

Files Coverage Δ
...jectory_controller/joint_trajectory_controller.hpp 100.00% <100.00%> (ø)
...include/joint_trajectory_controller/trajectory.hpp 86.66% <ø> (+13.33%) ⬆️
...ory_controller/src/joint_trajectory_controller.cpp 81.08% <91.11%> (+1.55%) ⬆️

... and 7 files with indirect coverage changes

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

Copy link
Contributor

mergify bot commented Nov 15, 2023

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

Copy link
Contributor

mergify bot commented Jan 2, 2024

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

Copy link
Contributor

mergify bot commented Jan 11, 2024

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

Copy link
Contributor

mergify bot commented Jan 22, 2024

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

Copy link
Contributor

mergify bot commented Mar 2, 2024

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

Copy link
Contributor

mergify bot commented Apr 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

None yet

2 participants