-
Notifications
You must be signed in to change notification settings - Fork 327
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] Sample at t + dT instead of the beginning of the control cycle #1306
base: master
Are you sure you want to change the base?
Conversation
Since we changed the sampling point we need to adapt the tests.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1306 +/- ##
==========================================
+ Coverage 80.89% 80.92% +0.02%
==========================================
Files 109 109
Lines 9696 9723 +27
Branches 842 850 +8
==========================================
+ Hits 7844 7868 +24
- Misses 1574 1575 +1
- Partials 278 280 +2
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.
Look good. I've left some questions
I'll continue reviewing after we discuss this part.
Thanks for your great work @fmauch
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
This isn't used anymore and more or less confusing, as actual will not be desired as long as the robot is moving, which it is here.
The changes from ros-controls/ros2_control#1788 require revisiting the tests from this. I expect, that tests on the master branch will fail, as well, however, since I had to set correct rates all over the place within this PR. Well, maybe not. I'll check this one, though. Edit: Things are back to normal now. |
Some tests require an update rate of 100 which isn't possible if the default one is at 10.
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.
LGTM
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.
I just read once more the linked issue #697 and I think he is right in this point:
However JTC in ros_controllers is comparing current state with future state (at T + dt), and this seems wrong. This will always lead to a tracking or goal error what ever perfect robot (mirrored cmd/state ifs) there is.
This is exactly what is done in this PR here?
In 0d00727 I implemented using the trajectory sample point at time |
I think this is a proper way in handling this, and it's a minimal change in the current behavior by now. |
Yes, this may definitively happen, especially once we actually get to time-scaling as it is my overall target with this. I'm not entierly familiar with #1297, so I'll have to read into that. |
Coming back to this: Yes, this is definitively a problem. One solution could be to make the index progression in the Edit: Implemented in 353f664 |
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.
That's fine, I also thought about fixing it like this. ABI break should be fine for the trajectory class.
As mentioned in #1191 (comment) and discussed in #697 the JTC currently samples the trajectory at the time given to the
update(time, period)
method. However, this actually is the beginning of the control cycle and it would make more sense to sample the setpoint for the end of the control cycle, resulting intime + controller_update_period
. This PR implements that.I obviously had to update a couple of tests on the way, since with changing the sampling point, the resulting command can be significantly different.