-
Notifications
You must be signed in to change notification settings - Fork 48
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
Fix Control Board wrong joint limits for coupled joints #472
Conversation
As this is a breaking change, can you please target the branch |
Sure! |
…a seperate header
…pControlBoardDriver::setMinMaxPos()
d171fe4
to
12bb969
Compare
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.
Small typo.
One thing I do not get, but probably I am missing something: if https://github.com/robotology/gazebo-yarp-plugins/pull/472/files#diff-a01901eeedeed61dae3fabb62c01e331R689 is just applying the existing position decoupling rules to the min and max vectors, can't we use the existing decouplePos function on two temporary min and max vectors to get the same result, without duplicating the decoupling position code in multiple methods?
I think it is doable. It was implemented with additional methods because that what was agreed in #348 and also to exploit the existing Of course, we can change as you suggested by extracting two temporary vectors from |
12bb969
to
102ddd5
Compare
I was thinking that probably it make sense to do so, instead of having a lot of decouplePosLimits that are not implemented, to be honest I had completly forgotten the discussion in #348 . |
102ddd5
to
f55cb7a
Compare
Fine with me. I will change it then. |
After some checks on the simulator, I am not sure that this solution will work for all the couplings. In particular, I think that there is something wrong with the handling of both the
Hence, I propose to freeze this PR for now. Meanwhile I opened issues #473 and https://github.com/robotology/icub-gazebo/issues/75 to clarify these aspects. |
Great, thanks. |
I wonder if also this discussion is related: #324 . |
In this issue, at some point @triccyx says (taken from #324 (comment)):
where the file is the configuration file associated to the head, i.e. https://github.com/robotology/icub-gazebo/blob/master/icub/conf/gazebo_icub_head.ini If we try to setup an automatic procedure to infer the limits for coupled joints, using the same logic that we use to move from the physical joint space to the controlled DoFs, i.e. using As an example, for the index finger - check the configuration file - we have limits for the index proximal and for the two physical distal joints associated with the unique DoF that on the iCub robot is typically identified as An additional issue is that, given the special nature of the relationships linking version and vergence to left/right pan, I am not sure that applying |
After some tests with eyes version and vergence is seems to me that is not possible to find joint limits by simply applying the decoupling rules to the min and max vectors. I think that with even more complicated coupling rules, e.g. the one implemented in #469, the outcome is the same, i.e. we need specific methods to handle limits decoupling. |
Yes, now that you wrote it explicitly it make totally sense, even for linear coupling it is not true that if (given then for every matrix in particular, this is true only if Given this, I guess we should take a step back, and try to understand in which way are are actually using joint limits. By doing a rough research ( https://github.com/robotology/gazebo-yarp-plugins/search?q=m_jointPosLimits&unscoped_q=m_jointPosLimits ) it seems that the only place in which the limits are used is in the clipping of the generated trajectories:
So, to be honest I do not remember if the trajectory generation is happening at the level of coupled quanties, or using the motor/physical joints (@xEnVrE if you can provide this info it would be great), so there are two cases:
|
Actually that is much problematic then expected, as the solution for a system of inequalities: so it is simply not possible to pass from one to another, unless you explicitly do not consider possible valid configuration. For a quick example, think of: with: and The solution is: |
Hi @traversaro, thank you for the analysis! You are totally right. In fact, for my experiments with eyes, I had to manually find max and mins for eyes left and right pan given limits on eyes vergence and version that we can take from robot hardware configurations. I then inserted the evaluated limits for pans on the configuration file of the plugin, while I had to put limits for eyes version and vergence inside the newly introduced To recap:
Relative to the last point, trajectories limits are configured in two places: gazebo-yarp-plugins/plugins/controlboard/src/ControlBoardDriver.cpp Lines 383 to 386 in 81f7dc1
and gazebo-yarp-plugins/plugins/controlboard/src/ControlBoardDriver.cpp Lines 383 to 386 in 81f7dc1
That is way, in this PR, I proposed to modify method
in order to modify quantities |
I like more this idea than the solution implemented in this PR. This way, the behavior will depend only on the user data that is confined in the configuration file. Instead, at the moment, we might be obliged to have some of the limits in the configuration files and part of the logic in this plugin. Considering that the plugin and the configuration files are in different repositories, I don't really like this solution. |
Ok, thanks @xEnVrE , now everything is crystal clear to me. So the point is that the answer to my question in #472 (review) "can't we use the existing decouplePos function on two temporary min and max vectors to get the same result?" is simply "no", or more in detail: "no, because that works fine only for couplings for which all the coefficients are positive", right? |
Right! Nevertheless, I am more for the solution where the user specifies both limits in the configuration file shipped within a specific repository containing models of a robot. The best solution would be to follow the path you proposed in #470. This way, correct me If I am wrong, we can move code for coupling handlers inside the repository of robots models such that:
|
Exactly, that was the idea. However I think that the modification to correctly handle the limits (either a combination of this PR + modification to load explicitly the coupled axis limits or simply just loading explicitly the coupled axis limits) can be done quite independently from that. If you are interested in working on that proposal and you need help feel free to let me know, thanks! |
@xEnVrE how do you prefer to proceed? We merge this PR for the time being, or you prefer to add instead a new parameter (probably under the |
Sorry @traversaro, I had no time to handle this yesterday. I will address it next week and I will add new parameters for coupled joint limits. |
No hurry, I just wanted to be sure I was not blocking anyone here. |
Hi @xEnVrE, just to understand, are you still interested in work on this in the short term? |
Hi @traversaro, definitively. If you want, just to clean things a bit, we can close this PR and I will open a new one since the solution we agreed on is different from the original one. |
Yes, probably this is a good idea! |
This PR fixes #348
I had to move the private struct
yarp::dev::GazeboYarpControlBoardDriver::Range
in a separate header file as it is required both within classyarp::dev::GazeboYarpControlBoardDriver
and in the signature of a new method in classesBaseCouplingHandler
and derived.cc @randaz81 @kouroshD @traversaro