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 21 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 98.72611% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.43%. Comparing base (694d6f1) to head (0e8f70b).

Files with missing lines Patch % Lines
...ory_controller/src/joint_trajectory_controller.cpp 97.67% 1 Missing ⚠️
...ajectory_controller/joint_trajectory_controller.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #809      +/-   ##
==========================================
+ Coverage   84.19%   84.43%   +0.23%     
==========================================
  Files         123      123              
  Lines       11322    11442     +120     
  Branches      956      966      +10     
==========================================
+ Hits         9533     9661     +128     
+ Misses       1473     1468       -5     
+ Partials      316      313       -3     
Flag Coverage Δ
unittests 84.43% <98.72%> (+0.23%) ⬆️

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%) ⬆️
...ectory_controller/test/test_trajectory_actions.cpp 97.76% <ø> (ø)
...ory_controller/test/test_trajectory_controller.cpp 99.77% <100.00%> (+0.03%) ⬆️
...ntroller/test/test_trajectory_controller_utils.hpp 83.97% <100.00%> (+0.05%) ⬆️
...ory_controller/src/joint_trajectory_controller.cpp 84.82% <97.67%> (+0.93%) ⬆️
...ajectory_controller/joint_trajectory_controller.py 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

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

2 participants