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] Use time of the last command for set_point_before_trajectory_msg in open-loop mode #780

Conversation

destogl
Copy link
Member

@destogl destogl commented Sep 26, 2023

This PR tackles the issues that happen in open-loop mode where on replacing trajectories the last command is repeated.
The figures below show the results of the output trajectories before and after this functionality. The trajectory that uses the time of the last command as point before trajectory messages gets smoother output.

Functionality right now:
When using current time

Functionality with this PR:
With using previous time with previous command

P.S. The similar thing would be useful for trajectory replacement in closed loop mode, but then we would need to know exactly when the state is read from the hardware. This is just something to think about in the future.

P.P.S. I will add tests too.

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

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

Project coverage is 84.64%. Comparing base (623dc5d) to head (d2ca6aa).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...ory_controller/src/joint_trajectory_controller.cpp 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #780      +/-   ##
==========================================
- Coverage   84.66%   84.64%   -0.02%     
==========================================
  Files         123      123              
  Lines       11419    11425       +6     
  Branches      961      964       +3     
==========================================
+ Hits         9668     9671       +3     
  Misses       1449     1449              
- Partials      302      305       +3     
Flag Coverage Δ
unittests 84.64% <90.90%> (-0.02%) ⬇️

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% <ø> (ø)
...ory_controller/test/test_trajectory_controller.cpp 99.74% <100.00%> (ø)
...ory_controller/src/joint_trajectory_controller.cpp 85.13% <80.00%> (-0.06%) ⬇️

... and 4 files with indirect coverage changes

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Looks good for me (even more if the mentioned tests are added)
concerning closed-loop mode: I'm not sure if this is necessary, shouldn't the trajectory generator be aware of the current state? But I guess there might be configurations where this could improve something.

@destogl
Copy link
Member Author

destogl commented Oct 3, 2023

concerning closed-loop mode: I'm not sure if this is necessary, shouldn't the trajectory generator be aware of the current state? But I guess there might be configurations where this could improve something.

This is important only when trajectory replacement is done. My comment was along: "if strange behavior happens when replacing trajectories - it might be that the state of is too

@christophfroehlich
Copy link
Contributor

I'm asking myself if it is desirable at all to interpolate from measured state instead of the last command with closed-loop config. but that really depends on the algorithm generating the trajectory

@muritane muritane force-pushed the jtc-smoothen-interplation-in-open-loop branch from 4a85ca0 to 8fc35dc Compare November 13, 2023 16:52
Copy link
Contributor

mergify bot commented Nov 15, 2023

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

henrygerardmoore pushed a commit to henrygerardmoore/ros2_controllers that referenced this pull request Jul 19, 2024
Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

test_no_jump_when_state_tracking_error_not_updated fails

Copy link
Contributor

mergify bot commented Dec 18, 2024

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

@christophfroehlich christophfroehlich changed the title [JTC] When replacing trajectories in open-loop mode use time of the last command when setting point of trajectory before msg. [JTC] Use time of the last command for set_point_before_trajectory_msg in open-loop mode Feb 12, 2025
Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

LGTM, I fixed the test now.

Copy link

@Thieso Thieso left a comment

Choose a reason for hiding this comment

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

Looks good to me, just need to change open-loop to be interpolate_from_desired_state according to #1525 but I do not have the permissions for this

@christophfroehlich
Copy link
Contributor

for this PR it is fine with open-loop, if you approve we can merge that immediately. we then can change that in your PR, where we have to wait for a review of another maintainer anyways

@christophfroehlich christophfroehlich merged commit fc20a27 into ros-controls:master Feb 14, 2025
18 of 25 checks passed
@saikishor saikishor deleted the jtc-smoothen-interplation-in-open-loop branch February 15, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants