-
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
Implement limits for coupled joints #499
Conversation
0655637
to
763ebc8
Compare
Thanks a lot @xEnVrE ! The CI is currently failing, but this will be fixed by #500 . I went through the code and it seems to be fine, I have two major comments:
That is a good point, thanks for bringing it up. I guess @plinioMoreno may be interested on this, and I think it is a good reason to keep backward compatibility, if possible.
Is this related to #474 ? Where did you got/how did you obtained the formula that are implemented now? |
I don't really like the mechanism exploiting these words that I implemented since, while the That said, I will rename to
I think that is doable and will remove the necessity to update all the configuration files. I'll update the PR. It will require some more logic in the methods
Yes it is related to that issue. the way I got the formula was by reasoning on it a bit and I will try to explain here. The joint Hand finger adduction/abduction controls the adduction/abduction of the fingers and, on a real iCub, tipically ranges from 0 to 60 degrees. When it is 0, there is maximum abduction and, viceversa, when it is near 60 there is maximum adduction (i.e. fingers are each close one to the other). From the actuation standpoint, on the real robot, I think that there is only one tendon which is moved by a motor that determines the overall motion (I might be wrong). What I am sure of is that the middle finger is not involved in this motion, i.e. only the index, ring and little move. On Gazebo, instead, there are 4 joints to be controlled, namely
Then, if we assume that Finally, in order to have maximum abduction for 0, and maximum adduction for 60, we need to add a One thing that I don't like is that the offset is hardcoded in the code. In case we want to simulate a different maximum value than 60, the user should be able to decide it somehow. But I think I can take it from the coupling handler itself, now that we added support for limits inside of it. Moving from the Gazebo feedback to the trajectory feedback is done here
We use the motion of one of the finger to determine the value that the adduction/abduction DoF should have. This is similar to the old behavior
except for the offset and for the fact that a different finger was used. I want to recall that the loop is closed around each joint singularly using the values provided by |
I was thinking to just set the limits for the handler to the physical limits if the conf file is the old one, so that all the legacy logic is just concentrated in the parser and it is easier to eventually remove it. |
Thanks, this is much more clear. |
@traversaro I checked if this is doable and we can do it only if I move the code for the coupling handler initialization a little bit forward within the method |
Ok! |
763ebc8
to
cd0f953
Compare
I addressed the remaining changes. However, i tested the new abduction handler with the "old" icub-gazebo model with hands and is not working properly because of a mismatch with the joint axes direction (basically I need to understand which is the right one on the real robot in order to understand if the model in icub-gazebo is right or wrong). What is happening is that, for positive angles, the joint associated to the index joint is moving in what seems to be the wrong direction. I would say we can discuss this f2f. Hence, I am going to remove the changes to abduction coupling handler from this PR in order to address it separately in another one. |
…o a dedicated header ControlBoardDriverRange.h
…gyp_invalid' in BaseCouplingHandler::getCoupledJointName() to avoid naming clashes
…s BaseCouplingHandler and derived The constructor awaits a new parameter std::vector<Range> coupled_joint_limits which contains a list of Range ranges corresponding to all the joints whose name, within coupled_joint_names, is different from 'reserved' Methods BaseCouplingHandler::{get, set}CoupledJointLimit allows getting/setting the limits
…::isValidUserDOF The method return true if the joint is a normal joint, i.e. no coupling involved, or if the joint is part of a coupled group and its name is different from 'reserved'
…r::{set, get}UserDOFLimit They allows to set and get limits associated to DoFs that the user can effectively control, i.e., normal joints or joints belonging to the subset of a coupled group that can be effectively controlled
…ontrolBoardDriver::gazebo_init
…rdDriver::resetPositionsAndTrajectoryGenerators()
…rdDriver::changeControlMode
…rdDriver::changeInteractionMode
…rdDriver::{set, get}Limits
…rdDriver::positionMove
…ndler such that abduction is minimum when the associated DoF is commanded to 60.0 and maximum when commanded to 0.0 as on the real robot
cd0f953
to
7585bcb
Compare
After rebasing to the latest devel, I had also to adapt the new coupling handler proposed in #469 in order to account for the limits. Before merging this PR i think it would be safer to test it against
and, if required, add the proper limits in configuration files (this also holds for models in Regarding the finger abduction, I concluded that whatever model we use, the handling of the abduction for the index finger is "problematic". Indeed
the only way to have a proper motion for both hands is to invert the axis direction of the index abduction joint of the left hand OR of the right hand in the sdf. This solution was already applied to the model in If there are no other changes to be done, I will update the changelog with a last commit. |
Note that if it is the best solution, we can also add two separate coupling handlers for left and right, however the solution that you proposed seems to be fine for me.
Thanks, I think you can update the CHANGELOG, thanks!
I will mention a few users that may be interested on this: @randaz81 @vvasco @miccol
It is not directly the URDF, but FYI the generation logic is being added in the PR https://github.com/robotology/icub-model-generator/pull/132/files .
As we are merging in |
@xEnVrE I have updated the previous comment. |
the thing that I really don't like is that if we arbitrarily change the direction of an axis then, when using libraries like iDynTree for making computations along the chain, say up to a frame on the finger, you need to fix the sign of the encoder reading that you might obtain from the encoders readings preprocessed with icub-main Still, I think it is ok to stick with one handler only and extend the behavior in the future (like two handlers or one handler with a parameter for left/right behavior AND not reversing the axis direction on the SDF). |
Done! |
Thanks @xEnVrE ! |
Limits for coupled joints
This PR aims at adding support for limits for joints having coupling within the
controlboard
plugin.A bit of context: at the moment, a sample configuration file of a part to be controlled with the
controlboard
is as followsIn this example there are 6 joints. Joints with indexes from 3 to 5 are coupled and the user can only control the joint
name_3
andname_4
which couples joints 4 and 5 (hence the stringreserved
).Limits are specified in the section
LIMITS
and correctly used within thecontrolboard
in some parts, e.g., to enforce torque limits ingazebo-yarp-plugins/plugins/controlboard/src/ControlBoardDriver.cpp
Line 1382 in 927874b
The same limits are used to specify the boundaries of the trajectory generators and to implement
ControlBoardWrapper::getLimits
. However, the limits required in these two features, corresponding to the DoFs that the user can effectively control, are different from the limits indicated in[LIMITS]
if some joints are coupled. Indeed, trajectories are not generated for all the joints actually controlled by Gazebo but only for their coupled counterparts and then the trajectories are converted according to the behavior coded in thename_coupling_handler
code.This PR proposes to change the
[COUPLING]
section of the configuration file toI.e. the user needs to specify the limits for the DoF that they can actually control excluding those indicated as
reserved
. For the remaining joints, that are not part of the coupling section, the limits specified in[LIMITS]
are used as in the past. The reasons why limits must be specified by the user and cannot be evaluated automatically can be find in the closed PR #472, #472 (comment)In order to simplify the review, a summary of the changes required to implement this behavior:
Range
is moved fromControlBoardDriver.h
toControlBoardDriverRange.h
so that it is available in other parts of the codeBaseCouplingHandler
accepts a new mandatory parameter containing the limits of the coupled jointsGazeboYarpControlBoardDriver::isValidUserDOF
is implemented in order to clearly identify DoFs for which a trajectory generator has to be configured (i.e. to skip useless computation forreserved
joints)GazeboYarpControlBoardDriver::{set, get}UserDOFLimit
are implemented in order to set/get the right limit for each joint, being it normal or coupled and avoiding glue codeGazeboYarpControlBoardDriver::gazebo_init
GazeboYarpControlBoardDriver::{resetPositionsAndTrajectoryGenerators, changeControlMode, changeInteractionMode, setLimits, getLimits, positionMove}
CHANGELOG
still needs to be changed (waiting for the review of the PR)In order to implement these changes, it is required that configuration files in
https://github.com/robotology/icub-gazebo/tree/master/icub/conf
,https://github.com/robotology/icub-models/tree/master/iCub/conf
andhttps://github.com/robotology/cer-sim/tree/master/gazebo/cer/conf
are reviewed. Other robots likehttps://github.com/vislab-tecnico-lisboa/vizzy
might be involved as well.In some parts of the code I had to limit the implementation with the assumption that at most one coupling handler is available. This is why it is not clear to me/I think it is better to discuss how to handle limits for coupled joints if more than one handler per controlled part is present. By looking at the configuration files I only found multiple coupling handlers in https://github.com/robotology/icub-gazebo/blob/master/icub/conf/gazebo_icub_left_hand_fingers.ini. However, this is not used in any of the model as the solution of having multiple plugins for each finger has been preferred over that of having of a single plugin for all the fingers.
New behavior of coupling handler FingersAbductionCouplingHandler
Within this PR the behavior of the coupling handler
FingersAbductionCouplingHandler
is changed in order to reflect that the , on the real robot, abduction is minimum when the associated DoF is commanded to60.0
and maximum when commanded to0.0
(while, at the moment, the reversed behavior is implemented).Fixes #348 #474