Skip to content
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

ControlBoardCouplingHandler: a device for publishing phyisical joints quantities in under-actuated system #3085

Merged
merged 11 commits into from
Mar 16, 2024

Conversation

Nicogene
Copy link
Member

This is a first draft of the device that will expose the publishing phyisical joints quantities in under-actuated system using the new IJointCoupling interface.

This PR is super draft, it just compiles, I opened the PR for agreeing w/ @traversaro @randaz81 @elandini84 on:

  • The device name
  • The interfaces that implement
  • The interfaces that has as private attribute members

Please ignore both the test folder (that has been copied from controlBoardRemapper) and the implementation in the .cpp, I will write it once we agree on the points above.

cc @pattacini

@Nicogene Nicogene requested a review from elandini84 February 14, 2024 15:14
Copy link

update-docs bot commented Feb 14, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update the release notes by adding a file in doc/release/<target_branch>, based on your changes.

@randaz81
Copy link
Member

  • The device name
  • The interfaces that implement
  • The interfaces that has as private attribute members

Name is ok for me. IEncodersTimed and IAxisInfo interfaces are ok.
Will the device also perform some internal computation (e.g. for differential joints) or it is just a remapping of encoders data?

For the implementation, remember to use the new parser generator #3081, I'm already going to replace all manual implementation in all devices in yarp 3.10 #3084

@Nicogene
Copy link
Member Author

Will the device also perform some internal computation (e.g. for differential joints) or it is just a remapping of encoders data?

My idea was to get the actuated axis quantities via the private attributes interfaces and perform the transformations for getting the physical joints quantities (positions, velocities, accelerations) but I am open to other possibilities

@Nicogene
Copy link
Member Author

  • The device name
  • The interfaces that implement
  • The interfaces that has as private attribute members

Name is ok for me. IEncodersTimed and IAxisInfo interfaces are ok. Will the device also perform some internal computation (e.g. for differential joints) or it is just a remapping of encoders data?

For the implementation, remember to use the new parser generator #3081, I'm already going to replace all manual implementation in all devices in yarp 3.10 #3084

Hi @randaz81, I was trying to use this nice new feature, but if I got it correctly it does support only these types of params:

Parameter type c++ type yarp::os::Value call
"bool" bool .asBool()
"string" std::string .asString()
"int" int .asInt64()
"size_t" size_t .asInt64()
"float" float .asFloat32()
"double" double .asFloat64()

How can we handle the vector/lists ? I generated the parser and then I change by hand using the vectors/lists?
Lists are often used as parameters for devices, are you planning to add it ?

cc @elandini84

@Nicogene
Copy link
Member Author

  • The device name
  • The interfaces that implement
  • The interfaces that has as private attribute members

Name is ok for me. IEncodersTimed and IAxisInfo interfaces are ok. Will the device also perform some internal computation (e.g. for differential joints) or it is just a remapping of encoders data?
For the implementation, remember to use the new parser generator #3081, I'm already going to replace all manual implementation in all devices in yarp 3.10 #3084

Hi @randaz81, I was trying to use this nice new feature, but if I got it correctly it does support only these types of params:
Parameter type c++ type yarp::os::Value call
"bool" bool .asBool()
"string" std::string .asString()
"int" int .asInt64()
"size_t" size_t .asInt64()
"float" float .asFloat32()
"double" double .asFloat64()

How can we handle the vector/lists ? I generated the parser and then I change by hand using the vectors/lists? Lists are often used as parameters for devices, are you planning to add it ?

cc @elandini84

Ah ok the vectors will be added in:

See:

@Nicogene Nicogene force-pushed the addJointCouplingDevice branch 2 times, most recently from 1ebd2f3 to 16a76f7 Compare March 4, 2024 14:53
@Nicogene Nicogene marked this pull request as ready for review March 7, 2024 14:44
@Nicogene Nicogene requested a review from traversaro as a code owner March 7, 2024 14:44
@Nicogene
Copy link
Member Author

Nicogene commented Mar 7, 2024

An important update on this, I managed to finish the first working version of controlBoardCouplingHandler device.

In the end I sorted out that this device just needs the coupling_device parameter in which the is specified which underlying coupling device has to be opened (e.g. couplingXCubHandMk5), then all other parameters specified in the xml file are forwarded to the parsing of coupling_device that may change in function of which coupling we are using.

/**
* This class is the parameters parser for class ControlBoardCouplingHandler.
*
* These are the used parameters:
* | Group name | Parameter name  | Type   | Units | Default Value | Required | Description                                  | Notes |
* |:----------:|:---------------:|:------:|:-----:|:-------------:|:--------:|:--------------------------------------------:|:-----:|
* | -          | coupling_device | string | -     | -             | 1        | Name of the device that handles the coupling | -     |
*
* The device can be launched by yarpdev using one of the following examples:
* \code{.unparsed}
* yarpdev --device controlBoardCouplingHandler --coupling_device <mandatory_value>
* \endcode
*
* \code{.unparsed}
* yarpdev --device controlBoardCouplingHandler --coupling_device <mandatory_value>
* \endcode
*
*/

Here are the xml files I used for testing on ergoCub hand V1_1 (in simulation)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE devices PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<device xmlns:xi="http://www.w3.org/2001/XInclude" name="left_hand-coupling_handler" type="controlBoardCouplingHandler">
    <param name="coupling_device"> couplingXCubHandMk5 </param>
    <param name="jointNames"> l_thumb_add l_thumb_prox l_thumb_dist l_index_add l_index_prox l_index_dist l_middle_prox l_middle_dist l_ring_prox l_ring_dist l_pinkie_prox l_pinkie_dist </param>
    <group name="LIMITS">
        <param name="jntVelMax"> 100.0   100.0 100.0 100.0 100.0 100.0  100.0 100.0  100.0 100.0   100.0 100.0 </param>
        <param name="jntPosMax"> 100.0   90.0  101.4 15.0  90.0  103.1  90.0  103.1  90.0  103.1   90.0  98.7  </param>
        <param name="jntPosMin"> -100.0 -90.0 -101.4 -15.0 -90.0 -103.1 -90.0 -103.1 -90.0  -103.1 -90.0 -98.7 </param>
    </group>
    <group name="COUPLING">
        <param name="actuatedAxesNames"> l_thumb_add l_thumb_oc l_index_add l_index_oc l_middle_oc l_ring_pinky_oc </param>
        <param name="actuatedAxesPosMin"> 0.0 0.0 0.0 0.0 0.0 0.0 </param>
        <param name="actuatedAxesPosMax"> 100.0 90.0 15.0 90.0 90.0 90.0 </param>
    </group>
    <group name="COUPLING_PARAMS">
        <param name="L0x"> -0.0050 -0.0050 -0.0050 -0.0050 -0.0050 </param>
        <param name="L0y"> 0.0040 0.0040 0.0040 0.0040 0.0040 </param>
        <param name="q2bias"> -173.35 -173.35 -173.35 -173.35 -170.53 </param>
        <param name="q1off"> 2.45 2.15 2.15 2.15 2.46 </param>
        <param name="k"> 0.03415 0.03913 0.03913 0.03913 0.03418 </param>
        <param name="d"> 0.03503 0.04003 0.04003 0.04003 0.03503 </param>
        <param name="l"> 0.00604 0.00604 0.00604 0.00604 0.00608 </param>
        <param name="b"> 0.00640 0.00640 0.00640 0.00640 0.00640 </param>
    </group>
    <action phase="startup" level="10" type="attach">
        <param name="device"> left_hand_hardware_device </param>
    </action>
    <action phase="shutdown" level="15" type="detach" />
</device>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE devices PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<device xmlns:xi="http://www.w3.org/2001/XInclude" name="left_hand-mc_nws_yarp" type="controlBoard_nws_yarp">
    <param name="name"> ${portprefix}/left_hand </param>
    <param name="period">0.01</param>
    <action phase="startup" level="10" type="attach">
        <param name="device"> left_hand-coupling_handler </param>
    </action>
    <action phase="shutdown" level="15" type="detach" />
</device>

controlBoardCouplingHandler can be attached by controlBoardRemapper, controlBoard_nws_yarp, controlBoard_nws_ros2, controlBoard_nws_ros and will publish the physical joint data, e.g:

immagine

fyi @PeterBowman @mebbaid @traversaro @randaz81 @maggia80 @pattacini @PasMarra @martinaxgloria

Copy link

sonarqubecloud bot commented Mar 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
33.7% Coverage on New Code (required ≥ 80%)
3.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@randaz81
Copy link
Member

randaz81 commented Mar 8, 2024

To all readers, please note that the example .xml shown in #3085 (comment) is using a deprecated format and it should not be considered a good example to take inspiration from.

All lists of parameters MUST be always parenthisized i.e.:

THIS IS AN INVALID LINE:
<param name="jntVelMax"> 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 </param>
THIS IS THE CORRECT LINE:
<param name="jntVelMax"> (100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 ) </param>

the old format is currently supported because of yarp bug which might be fixed in a future release!

In this specific example, couplingXCubHandMk5 parser, which is not related to this PR, is not correct and it needs to be fixed together with this xml file

@randaz81 randaz81 force-pushed the addJointCouplingDevice branch from f3ee24a to f74bfe6 Compare March 9, 2024 09:07
@randaz81 randaz81 merged commit 2e513a6 into robotology:master Mar 16, 2024
48 of 50 checks passed
@Nicogene Nicogene deleted the addJointCouplingDevice branch March 18, 2024 08:40
Nicogene added a commit to icub-tech-iit/ergocub-software that referenced this pull request Mar 18, 2024
Nicogene added a commit to icub-tech-iit/ergocub-software that referenced this pull request Mar 18, 2024
Nicogene added a commit to icub-tech-iit/ergocub-software that referenced this pull request Apr 4, 2024
Nicogene added a commit to icub-tech-iit/ergocub-software that referenced this pull request Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants