-
Notifications
You must be signed in to change notification settings - Fork 334
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] Fix state offset tests #797
[JTC] Fix state offset tests #797
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #797 +/- ##
==========================================
- Coverage 45.40% 44.92% -0.49%
==========================================
Files 40 40
Lines 3649 3642 -7
Branches 1723 1716 -7
==========================================
- Hits 1657 1636 -21
- Misses 810 834 +24
+ Partials 1182 1172 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's wait for @destogl to reply too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small proposal for optimization since we are discussing those functions.
Answers to comments
- Why should we set
state_desired_
to the value ofread_state_from_command_interfaces
? If there is no active trajectory (start_with_holding
is false), this value will only be published on the state-topic. If there is a new trajectory, it will be overwritten by the sampled trajectory.
Can it be that we change this when fixing the “hold on start” feature? I think the reason was that we have immediate output to the command interface even if there is no reference. If we can achieve that by using start_with_holding
this is also fine with me. Nevertheless, I would not add additional if, even if we set the value “unnecessary”. Or do you think that this could be confusing?
- Setting
state_current
to the command read from the hardware interface is fine: It is only used for setting the set_hold_position ifstart_with_holding
is set. It will be overwritten by the first call ofupdate
.
OK, you are right. Then we probably should not set state_desired
in that case.
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/include/joint_trajectory_controller/joint_trajectory_controller.hpp
Outdated
Show resolved
Hide resolved
I'll think that trough again if this is achieved with the hold-on-start in a fresh moment. Optional override is already inside an if, for me it is clearer to have it in the else branch instead (but that's only my personal preference). |
The current way with this PR is:
Notes:
@destogl What do you think? |
This pull request is in conflict. Could you fix it @christophfroehlich? |
Co-authored-by: Dr. Denis <[email protected]>
8937354
to
5a111e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks!
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]> (cherry picked from commit b13ae5b) # Conflicts: # joint_trajectory_controller/test/test_trajectory_controller_utils.hpp
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
Squashed commit of the following: commit 0a9f4b0 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu Nov 16 23:17:20 2023 +0000 Bump ros-tooling/action-ros-ci from 0.3.4 to 0.3.5 (ros-controls#833) commit 3fc0f50 Author: Christoph Fröhlich <[email protected]> Date: Wed Nov 15 20:03:40 2023 +0100 [JTC] Activate update of dynamic parameters (ros-controls#761) commit b13ae5b Author: Christoph Fröhlich <[email protected]> Date: Wed Nov 15 19:14:09 2023 +0100 [JTC] Fix tests when state offset is used (ros-controls#797) * Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]> commit f1a5397 Author: Christoph Fröhlich <[email protected]> Date: Wed Nov 15 12:18:38 2023 +0100 [JTC] Remove deprecation warnings, set `allow_nonzero_velocity_at_trajectory_end` default false (ros-controls#834) commit 232154d Author: Christoph Fröhlich <[email protected]> Date: Sat Nov 11 15:30:19 2023 +0100 [CI] Update coverage workflows and some cleanup (ros-controls#819) * Add CI coverage jobs for humble and iron * Add all packages to source build * Update repos files * Build ros-control packages from source * use humble job names Co-authored-by: Christoph Fröhlich <[email protected]> --------- Co-authored-by: Bence Magyar <[email protected]> commit 0196eeb Author: Tony Baltovski <[email protected]> Date: Thu Nov 9 17:15:45 2023 -0500 [diff_drive_controller] Fixed typos in diff_drive_controller_parameter.yaml. (ros-controls#822) commit 71ec842 Author: Christoph Fröhlich <[email protected]> Date: Tue Nov 7 13:47:23 2023 +0100 [CI] Re-add humble workflow files and add iron to readme (ros-controls#818) commit 9d4ea6b Author: Bence Magyar <[email protected]> Date: Tue Nov 7 12:01:23 2023 +0000 [diff_drive_controller] Remove non-stamped Twist option (ros-controls#812) commit 5f78fe4 Author: Bence Magyar <[email protected]> Date: Tue Nov 7 12:01:02 2023 +0000 Adjust tests after passing URDF to controllers (ros-controls#817) commit 2c6d7a6 Author: Bence Magyar <[email protected]> Date: Mon Nov 6 18:29:10 2023 +0000 Add iron branch (ros-controls#814) commit f81a82c Author: Christoph Fröhlich <[email protected]> Date: Fri Nov 3 21:18:31 2023 +0100 [CI] Codecov (ros-controls#807) commit c6ecab7 Author: Bence Magyar <[email protected]> Date: Wed Nov 1 21:38:16 2023 +0000 Use pre-commit fork of clang-format instead of local (ros-controls#813) commit 6e46053 Author: Bence Magyar <[email protected]> Date: Tue Oct 31 21:34:10 2023 +0000 3.17.0 commit 822552f Author: Bence Magyar <[email protected]> Date: Tue Oct 31 21:33:40 2023 +0000 Update changelogs commit 8a90b51 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Oct 31 20:27:04 2023 +0000 Bump ros-tooling/action-ros-ci from 0.3.3 to 0.3.4 (ros-controls#810) commit b65314d Author: Christoph Fröhlich <[email protected]> Date: Thu Oct 26 12:09:27 2023 +0200 Cleanup comments and unnecessary checks (ros-controls#803) commit b36b9d2 Author: Christoph Fröhlich <[email protected]> Date: Tue Oct 24 20:17:28 2023 +0200 [CI] Fix coverage build and codecov stats (ros-controls#804) commit 22356e0 Author: Dr. Denis <[email protected]> Date: Mon Oct 16 18:49:47 2023 +0200 [TestNodes] Optimize output about setup of JTC publisher (ros-controls#792) commit ac291ab Author: Christoph Fröhlich <[email protected]> Date: Mon Oct 16 13:00:53 2023 +0200 Steering controllers library: fix open loop mode (ros-controls#793) * set last*velocity variables for open loop odometry * Make function arguments const * Update function in header file too commit c831b6c Author: Christoph Fröhlich <[email protected]> Date: Mon Oct 16 12:58:44 2023 +0200 Update requirements of state interfaces (ros-controls#798)
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
* Simplify initialization of states * Rename read_state_from_hardware method * Don't set state_desired in on_activate --------- Co-authored-by: Dr. Denis <[email protected]>
I tried to write tests for #794 and copied the initialization of
joint_pos_
fromtest_hw_states_has_offset_first_controller_start
/test_hw_states_has_offset_later_controller_start
: This did not work becauseActivateTrajectoryController
always has set it to the constant values from the utils-header -> I fixed that.Tests failed now, and thinking about the test criteria itself, considering #189, I rewrote the tests -> succeed now.
@destogl You have added this part, before it got changed a bit by #340 by @AndyZe and @mechwiz
state_desired_
to the value ofread_state_from_command_interfaces
? If there is no active trajectory (start_with_holding
is false), this value will only be published on the state-topic. If there is a new trajectory, it will be overwritten by the sampled trajectory.state_current
to the command read from the hardware interface is fine: It is only used for setting the set_hold_position ifstart_with_holding
is set. It will be overwritten by the first call ofupdate
.