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

Fix the discrepancy of the output IAnalogSensor device between real robot and gazebo-yarp-plugins #476

Closed
kouroshD opened this issue Mar 31, 2020 · 9 comments
Assignees

Comments

@kouroshD
Copy link

Currently, the outputs of the IAnalogSensor Device from the real robot are the raw values, i.e., 0-255 values. However, the output of simulated robot are in radians. This behavior has been observed for the values of the analog sensors of the hand joints.

CC @traversaro

@traversaro
Copy link
Member

Note that IAnalogSensor interface is actually exposed by several plugins. I think that @kouroshD refers to the gazebo_yarp_maissensor plugin, see https://github.com/robotology/gazebo-yarp-plugins/tree/master/plugins/maissensor` .

@traversaro traversaro changed the title Fix the discrepancy of the output IAnalogSensor device between real robot and yarp-gazebo-plugins Fix the discrepancy of the output IAnalogSensor device between real robot and gazebo-yarp-plugins Apr 1, 2020
@xEnVrE
Copy link
Contributor

xEnVrE commented Apr 2, 2020

Currently, the outputs of the IAnalogSensor Device from the real robot are the raw values, i.e., 0-255 values.

Another difference we need to handle is that, on the real robot, 255 is what we get when the finger is fully open (and 0 when is fully closed), i.e. it decreases while the finger closes.

@pattacini
Copy link
Member

pattacini commented Jul 15, 2020

@traversaro just to let you know that this issue would be a blocker for our 2020.08 application demo.

@traversaro
Copy link
Member

Hi @kouroshD @pattacini @xEnVrE ,
can you provide the (nominal) relation that should exist between the measurements of the model joints positions and the readings provided by the MAIS sensor to be aligned with the real robot? So we can try to understand how to implement this relation in the gazebo_yarp_maissensor plugin.

@pattacini
Copy link
Member

pattacini commented Jul 17, 2020

Hi @traversaro

Relevant info is provided in this post: robotology/community#152 (comment).

TL;DR

  • 255 ➡️ fully extended.
  • 0 ➡️ fully bent.

The law is:

joints[i] = (1.0-std::min(1.0,std::max(0.0,analogs[2+i]/255.0))) * (chain[i].getMax()-chain[i].getMin()) + chain[i].getMin();

@traversaro
Copy link
Member

traversaro commented Jul 17, 2020

Thanks. Given that the plugin is extremely specific (it is explicitly named gazebo_yarp_maissensor, after all) we can directly encode the inverse of the law presented by @pattacini directly in the code. Clearly it would be then of fundamental importance that the ordering of the joints passed to the plugin in https://github.com/robotology/icub-gazebo/blob/v1.16.0/icub/conf/gazebo_icub_right_hand_mais.ini#L10 and https://github.com/robotology/icub-gazebo/blob/v1.16.0/icub/conf/gazebo_icub_left_hand_mais.ini is exactly the same the one published by MAIS sensors and described in robotology/community#152 (comment), and the joint limits in the hand model are correct.

@traversaro
Copy link
Member

In particular, the place that needs to be modified is https://github.com/robotology/gazebo-yarp-plugins/blob/master/plugins/maissensor/src/MaisSensorDriver.cpp#L211 , the joint hw limits can also be readed from Gazebo.

@pattacini
Copy link
Member

Fixed, isn't it?

@traversaro
Copy link
Member

Yes, fixed by #502, thanks @xEnVrE .

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

No branches or pull requests

4 participants