robotology / yarp

YARP - Yet Another Robot Platform
http://www.yarp.it
Other
525 stars 195 forks source link

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

Open LoreMoretti opened 4 months ago

LoreMoretti commented 4 months ago

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):

Additional context cc @GiulioRomualdi

GiulioRomualdi commented 4 months ago

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

GiulioRomualdi commented 4 months ago

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

traversaro commented 4 months ago

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 commented 4 months ago

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

traversaro commented 4 months ago

Screenshot 2024-06-26 202353

GiulioRomualdi commented 4 months ago

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

GiulioRomualdi commented 4 months ago

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

isorrentino commented 1 week ago

Hi @traversaro,

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

traversaro commented 1 week ago

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?