-
Notifications
You must be signed in to change notification settings - Fork 41
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
[WIP][pr2eus/robot-interface.l] Add method waiting until last sent motion is finished or given function returns t #444
base: master
Are you sure you want to change the base?
Conversation
Neat feature! However, I don't really like the Wouldn't it be better to have different return values for when it finishes by :wait-interpolation and for when it finishes by func? |
@Affonso-Gui Thank you for your comment.
I changed to a callable function and changed name
I think the default return value should be a list of On the other hand, I understand your request, so I enabled to return another value by passing an additional argument
As for |
da8debb
to
322d379
Compare
Are you sure that it isn't better to just return the interpolatingp list and leave the post processing to the caller code? The Just to be clear, my recommendation would be something like this: (if (some #'identity (send *ri* :wait-interpolation-until-fn fn))
(do-smt-when-interrupted)
(do-smt-when-not-interrupted)) @knorth55 @Naoki-Hiraoka Any comments are appreciated. |
@Affonso-Gui Sorry for late.
sometimes doesn't work when we pass specific jsk_pr2eus/pr2eus/robot-interface.l Line 626 in a228cc7
For instance,
returns
in #444 (comment) is wrong. Sorry... Therefore, in order to execute the stopping motion without
I think both are troublesome. As for |
Extract interesting Anyways, would still like to hear opinions from other people on this topic. |
Considering the use case of this function, (send *ri* :angle-vector-until-finc #F(. . .) 5000 :rarm-controller 0 :func func)
;; Send joint angle to robot.
;; Then, wait until sent motion is finished or given function (func) returns t.
;; If func returns t, the motion stops.
;; If func returns t, return value is t. Otherwise return value is nil. may be sufficient. Users who want to perform advanced processing will write their own control function, so they will not use this function. This function should be simple, because one of the roles of this function is to be referenced by such users as sample code. |
Generalization of advanced processing is difficult. |
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 agree with @Naoki-Hiraoka point of making this method as simple as possible for standard use cases.
To sum up:
- Remove
post-process
andreturn-post-process-ret
key arguments - Instead, use t/nil return values which allow for the user to define custom post processes outside the function body
- Always stop the motion after func returns t (would personally prefer using the :stop-motion method, which give us a smoother stop and can probably be overwritten by :cancel-angle-vector (?) if speed is needed)
Regarding the return value, if necessary the standard :interpolatingp value can be easily accessed by another method call, but whether the function was interrupted or not can only be accessed from within this method.
@Affonso-Gui @Naoki-Hiraoka I started to think that the function introduced in this PR should not be So I started to think about a new name now. |
You have a point. (if (send *ri* :wait-interpolation-until fn)
(send *ri* :stop-motion)) But if we want to include the stop motion into the function then maybe something like (I think you can abbreviate the -fn and -func because it enters as an argument. Kinda like it is |
We sometimes want to do
:wait-interpolation
just until some condition is satisfied (e.g., a sensor value becomes under a threshold).In that case, we usually also want to stop robot motion just after that condition is satisfied.
This PR adds
:wait-interpolation-until-func
method able to be commonly used in that case.Example usage with Gazebo:
This PR also includes test code of
:wait-interpolation-until-func
.@Kanazawanaoaki Does this PR meet your requirement? If you have time, please test this and give your feedback comment.