-
Notifications
You must be signed in to change notification settings - Fork 372
Scaled jtc #1191
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
base: master
Are you sure you want to change the base?
Scaled jtc #1191
Conversation
This adds a scaling factor between 0 and 1 to the JTC so that the trajectory time inside the controller is extended respectively. A value of 0.5 means that trajectory execution will take twice as long as the trajectory states. The scaling factor itself is read from the hardware for now.
Co-authored-by: Christoph Fröhlich <[email protected]>
This avoids writing the explicit conversion by hand Internally that basically does: static_cast<rcl_duration_value_t>(static_cast<long double>(rcl_duration_.nanoseconds) * scale_ld)
…etting of scaling factor Co-authored-by: Manuel M <[email protected]>
That was changed in a previous commit
used The current implementation only works correctly when a position interface is used. When the hardware in fact slows down the robot (as UR does), also velocity interfaces should be scaled correctly, but that't rather an edge case right now.
It is accessed from the RT thread only, anyway.
Thoughts on tests I should implement:
|
joint_trajectory_controller/include/joint_trajectory_controller/joint_trajectory_controller.hpp
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
hi @fmauch Great to see this being worked on again. I added some comments to the code. Regarding the tests:
Makes sense
Isn't this what we patched in: UniversalRobots/Universal_Robots_ROS2_Driver#882. As far as I can tell you also backported this patch. (And I still think the goal time should be also scaled ;) )
Same as above. From heavily using this controller in our system I have the opinion that in most use cases it makes sense (and is what a user would expect) that the goal time should also be scaled. But perhaps I understood your suggestion wrong. |
Thank you for your input. That's why I put my brain dump on that here, so we can discuss this :-) And that's also why I didn't write the documentation on that, yet. I'll wrap my head around this a little more and try to get a better feeling for the current behavior, then come back to this. |
Co-authored-by: Christoph Fröhlich <[email protected]>
Also run two trajectories
We calculate the state error at the beginning of the control cycle based on the estimated progress in the trajectory (respecting scaling) compared to the current joint state. When we are approaching the final point, that state error might be 0, though we haven't reached our goal, yet. In this case the trajectory would succeed and falsely report success in the case of a strict goal tolerance. This change checks the current state against the command once interpolation reached the last point in the trajectory. This allows the robot to arrive at the final point as long as it is doing so within the configured goal time limit.
when scaled For this, the trajectory is manually sampled at the expected time points and this is compared to what the controller generates.
# Conflicts: # joint_trajectory_controller/src/joint_trajectory_controller.cpp
@fmauch whats the current state of the scaled jtc efforts? |
@RobertWilbrandt would you mind taking a review on this, as well, since you use it yourself AFAIK. |
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.
Thanks for adding more tests, my points of the first review were fixed! @firesurfer @RobertWilbrandt do you have time for another review round soonish?
This is my take2 on #301.
I plan to finish this until Friday, @firesurfer feel free to poke me :-)
Currently missing
Things that will get changed, as discussed in the latest working group meeting
might get postponed to a later point.ros2 topic pub
will not work with this.