yarp icon indicating copy to clipboard operation
yarp copied to clipboard

Desired torque decimals are not displayed in the motorgui if the torque control mode is set

Open LoreMoretti opened this issue 1 year ago • 10 comments
trafficstars

Describe the bug I noticed that the desired torque are treated as integer in the motorgui To Reproduce Start the motorgui and set on joint in torque Expected behavior It would be nice to have three decimal as the position control Screenshots image

Configuration (please complete the following information):

  • OS:
  • yarp version:
  • compiler:

Additional context cc @GiulioRomualdi

LoreMoretti avatar Jun 26 '24 10:06 LoreMoretti

yarp version: YARP version 3.9.0+8-20240206.2+git27242fd41

GiulioRomualdi avatar Jun 26 '24 10:06 GiulioRomualdi

If someone can point me the code I should check I can try to fix it

GiulioRomualdi avatar Jun 26 '24 17:06 GiulioRomualdi

If someone can point me the code I should check I can try to fix it

I guess somewhere around https://github.com/robotology/yarp/blob/bde9cd2b1069d207a77a845935b2c3063c74c58d/src/yarpmotorgui/jointitem.cpp#L1145-L1176 .

traversaro avatar Jun 26 '24 17:06 traversaro

Reading the code, I guess there is already a similar functionality if you go in Slider ---> Torque Options.

traversaro avatar Jun 26 '24 18:06 traversaro

Screenshot 2024-06-26 202353

traversaro avatar Jun 26 '24 18:06 traversaro

Cool! Still, according to your picture, the number of slider decimal digits seems to be available oly for position control

GiulioRomualdi avatar Jun 27 '24 06:06 GiulioRomualdi

So I checked the code and there are three possible solutions:

The easiest solution

Modify the following line

https://github.com/robotology/yarp/blob/bde9cd2b1069d207a77a845935b2c3063c74c58d/src/yarpmotorgui/sliderWithTarget.h#L23

intermediate solution

add a function to change the slide for the torque (and velocity at this point) and modify

void PartItem::onSetVelSliderOptionPI(int mode, double step)

and

   void PartItem::onSetTrqSliderOptionPI(int mode, double step)

to set the decimal number to an hardcoded value

complex solution

modify the GUI and all the signal slots to have the possibility to set the number of digits. Indeed they are set only for position control in

https://github.com/robotology/yarp/blob/bde9cd2b1069d207a77a845935b2c3063c74c58d/src/yarpmotorgui/jointitem.cpp#L1050

GiulioRomualdi avatar Jun 27 '24 11:06 GiulioRomualdi

Hi @traversaro,

Do you have any updates or ideas on how to proceed with this task?

isorrentino avatar Nov 06 '24 16:11 isorrentino

Hi @traversaro,

Do you have any updates or ideas on how to proceed with this task?

I think the easy solution proposed by Giulio Romualdi make sense. I think it make sense to have 1 or 2 as default number of decimal (rather then 0), can you try if that works?

traversaro avatar Nov 06 '24 16:11 traversaro

PR here https://github.com/robotology/yarp/pull/3151

isorrentino avatar Nov 29 '24 16:11 isorrentino

Fixed in Yarp4.

randaz81 avatar Sep 01 '25 09:09 randaz81