-
Notifications
You must be signed in to change notification settings - Fork 323
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.34% 80.38% +0.03%
==========================================
Files 105 105
Lines 9384 9402 +18
Branches 826 829 +3
==========================================
+ Hits 7540 7558 +18
- Misses 1570 1571 +1
+ Partials 274 273 -1
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
const bool valid_point = traj_external_point_ptr_->sample( | ||
time, interpolation_method_, state_desired_, start_segment_itr, end_segment_itr); | ||
time + update_period_, interpolation_method_, state_desired_, start_segment_itr, | ||
end_segment_itr); |
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.
Above you are doing the initial sampling and immediately overriding with this future one. Is this intended?
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.
Yes. The sample call above is - as the comment says - only to establish the actual start time of the trajectory. However, also in the first control cycle when we started the trajectory we want to sample at
This should be probably refactored in the trajectory representation that the start time would not implicitly be specified by the first sample, but I thought this might not be the right PR to address that...
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
@@ -644,7 +646,7 @@ TEST_P(TrajectoryControllerTestParameterized, position_error_not_angle_wraparoun | |||
size_t n_joints = joint_names_.size(); | |||
|
|||
// send msg | |||
constexpr auto FIRST_POINT_TIME = std::chrono::milliseconds(250); | |||
constexpr auto FIRST_POINT_TIME = std::chrono::milliseconds(300); |
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.
If the control period is 100 milliseconds, shouldn't it be 350?
Am i missing something here?
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.
Why? Would it be desired to set a target time between two control cycles?
With a control period of 100 ms we would call update
at
Co-authored-by: Sai Kishor Kothakota <[email protected]>
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.
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.