[JTC] Add goal_timeout parameter to abort action when total trajectory time exceeds limit#2360
[JTC] Add goal_timeout parameter to abort action when total trajectory time exceeds limit#2360kamal2730 wants to merge 7 commits into
Conversation
…y time exceeds limit
|
Hello @christophfroehlich , this PR is ready for review. Kindly review it when you have time. |
MarqRazz
left a comment
There was a problem hiding this comment.
What happens when a user specifies it in the goal request and it started disabled? Will that enable it with those settings from that point on? (Like a parameter change would)
# If the joints are not within goal_tolerance after "trajectory finish
# time" + goal_time_tolerance, the goal aborts with error_code set to
# GOAL_TOLERANCE_VIOLATED
JointTolerance[] goal_tolerance
JointComponentTolerance[] component_goal_tolerance
builtin_interfaces/Duration goal_time_tolerance
|
Can you detail better how this is different than the constraints:goal_time parameter? I've used that and it works as expected. The only thing I don't like about it is that you can't make it a function of the trajectory sent (its just a fixed number). I would like functionality like MoveIt where it does commanded trajectory + percentage. So you can say |
|
Hello @MarqRazz , Thanks for the review
The goal_timeout parameter is independent from the action goal's goal_time_tolerance field. Setting goal_time_tolerance in the goal request has no effect on goal_timeout .
|
MarqRazz
left a comment
There was a problem hiding this comment.
Thanks for taking the time to describe the difference!
Do you think this new parameter should be part of the constraints namespace?
I think keeping it top-level makes more sense for consistency , cmd_timeout is also a timeout and lives at the top level, not under constraints. The constraints namespace is primarily for per-joint tolerances (trajectory, goal, max_deceleration) plus goal_time and stopped_velocity_tolerance, which are all about checking deviation between desired and actual state. goal_timeout is a different concept , it's a hard execution deadline, not a tolerance check. So constraints would be a bit misleading. |
MarqRazz
left a comment
There was a problem hiding this comment.
The code changes look good, thanks for adjusting it to tell the user what is happening!
christophfroehlich
left a comment
There was a problem hiding this comment.
Main changes LGTM, one thing: please add a note here.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2360 +/- ##
==========================================
+ Coverage 85.61% 85.64% +0.02%
==========================================
Files 148 148
Lines 15837 15899 +62
Branches 1339 1344 +5
==========================================
+ Hits 13559 13616 +57
- Misses 1792 1795 +3
- Partials 486 488 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@christophfroehlich Added release notes. Could you please review? |
saikishor
left a comment
There was a problem hiding this comment.
@kamal2730 @christophfroehlich if the goal_time_tolerance is zero, and then if the position is not reached within the duration specified in the goal or the published message. Then, it should abort immediately after the time is passed right?. Do we really need a parameter here? Or Am i missing something?
|
problem is that with goal_time being zero that the action never gets cancelled. at least this is what I understood from the issue. |
Yes me too, that's what I understood, but then it is a bug. I would solve it properly instead of adding yet another new parameters |
Hello @saikishor, Thanks for the review. You're right - fixing the However, the current documented and intended behavior of That's the main reason I chose to introduce a new parameter rather than change the existing behavior. That said, if the maintainers are comfortable with the breaking change, I'm happy to take that approach instead. |
I don't think waiting an infinite amount of time is the right approach. I don't think we should allow it. For the action, the user will have to cancel it himself right? |
Yes, you are correct. However, In most real-world scenarios, the robot simply needs a little more time to settle. Maybe the motor is slightly slower than expected, or there is some friction, and the robot will eventually reach the goal if given additional time. That's the normal case, and I believe this is the reason the current behavior was intentionally designed this way. If we change The real problem is the edge case where the robot can never reach the goal or satisfy the goal tolerances. That's where the new |
|
I'm fine with both approaches. We can't just break current behavior on distros other than rolling. so maybe we merge this only in distros from jazzy backwards |
Description
Implements a
goal_timeoutparameter forjoint_trajectory_controllerthat addresses issue #548: whengoal_time_tolerance = 0.0and the goal position cannot be reached, the action never returns a result and hangs indefinitely.What it does
goal_timeout(double, default 0.0 = disabled)GOAL_TOLERANCE_VIOLATEDif total elapsed time from trajectory start exceeds the timeoutgoal_timeout < constraints.goal_timeFixes #548
Is this user-facing behavior change?
Did you use Generative AI?
NO
Additional Information
TODOs
To send us a pull request, please:
colcon testandpre-commit run(requires you to install pre-commit bypip3 install pre-commit)