icub-main icon indicating copy to clipboard operation
icub-main copied to clipboard

embObjFTsensor: SensorName and SensorFrameName should be different parameters

Open randaz81 opened this issue 2 years ago • 5 comments

Bug description

In embObjFTsensor device driver: https://github.com/robotology/icub-main/blob/6a5922c7d6ef15e864486217b7ae4638805bd0d2/src/libraries/icubmod/embObjFTsensor/embObjFTsensor.cpp#L448-L458

The two parameters name and frameName should not be assigned to the same value. Indeed:

  • sensor name is the UNIQUE name of the sensor.
  • frame name is the name of the robot link to which the sensor is attached. Many sensors can be attached to the same frame link. The parameter is typically used in ROS message headers and should match a valid frame link name defined in the robot model (.sdf / .urdf). If wrongly assigned, ROS will not work properly.

Steps to reproduce


Expected behavior

The parser should handle two different parameters:

  • SensorName should be a mandatory parameter (id is currently used in our robot .xml files. It's acceptable but, if possible, i'd recommend changing it in the future to SensorId or SensorName because parameters like id or name can be used in different contexts by other attached devices (wrappers, remappers) and it's preferable to have unique names).
  • FrameName should be preferably mandatory, but optional is acceptable with a warning message and a default value of "unknown_frame_name".

Example repository

No response

Additional context

The embObjFTsensor device is wrapped by:

  • yarp: https://github.com/robotology/yarp/tree/master/src/devices/multipleanalogsensorsserver
  • ros: https://github.com/robotology/yarp/tree/master/src/devices/multipleAnalogSensorsRosPublishers

randaz81 avatar Jul 01 '22 10:07 randaz81

We should also get embObjMultipleFTsensors covered.

cc @marcoaccame @triccyx

pattacini avatar Jul 01 '22 12:07 pattacini

We will have time to review and correct this bug during PI12.

pattacini avatar Jul 02 '22 08:07 pattacini

/remind July 25 plan on this

pattacini avatar Jul 02 '22 08:07 pattacini

Reminder Monday, July 25, 2022 10:00 AM (GMT+02:00)

plan on this

octo-reminder[bot] avatar Jul 02 '22 08:07 octo-reminder[bot]

🔔 @pattacini

plan on this

octo-reminder[bot] avatar Jul 25 '22 16:07 octo-reminder[bot]

@randaz81 I have a couple of questions for you:

  • I have searched in robotConfiguration for frameName but at the moment the keyword is not used. Is this the correct name?
  • I suppose that my new XML under hardware/FT for FtSensor will become from
...
<group name="SENSORS">
                <param name="id">                   test_ft_sensor          </param>
                <param name="type">                 eoas_strain             </param>
                <param name="location">             CAN2:13                 </param>
</group>
...

to

...
<group name="SENSORS">
                <param name="id">                   test_ft_sensor          </param>
                <param name="framename">            myframename             </param>
                <param name="type">                 eoas_strain             </param>
                <param name="location">             CAN2:13                 </param>
</group>
...

triccyx avatar Sep 09 '22 09:09 triccyx

1- yes, framename is not currently present in xml files, and will be introduced by your modification 2 -yes, your xml is correct, the name of the frame can be chosen arbitrarily by you but I recommend matching the name defined in the gazebo sdf model (either of the sensor or the attached link)

randaz81 avatar Sep 09 '22 14:09 randaz81

ok perfect

triccyx avatar Sep 09 '22 14:09 triccyx

I agree in general that it could be useful in some cases to separate SensorName and FrameName, but in the case of the icub can't we use the same string for both (i.e. just align URDF files and yarprobotinterface XML files)?

This is quite of important from the point of view of multipleanalogsensorremapper: the remapper uses the sensorname to permit users to remap devices (a bit like for controlboard we use joint names), but if you use different sensor names in simulated and real robots, we would need to mantain different configuration files for real and simulated robots, that I am afraid they will be a bit confusing to mantain.

traversaro avatar Sep 10 '22 11:09 traversaro

but if you use different sensor names in simulated and real robots, we would need to mantain different configuration files for real and simulated robots, that I am afraid they will be a bit confusing to maintain.

I would aim to avoid this 👍🏻

pattacini avatar Sep 10 '22 13:09 pattacini

I agree too, simulated and real robot must be consistent. But this does not imply that framename and sensorname should be identical. It depends on your convenience and the current status of your urdf. The only constraint is that the frame name must be an existing frame of the transform tree, while the sensor name can be chosen arbitrarily (you can even keep your current one). However, I suspect that a revision of the urdf is necessary. NB: This issue was opened because wrong names are currently preventing ROS to work properly on icub.

randaz81 avatar Sep 12 '22 13:09 randaz81

NB: This issue was opened because wrong names are currently preventing ROS to work properly on icub.

Gotcha 👍🏻

At any rate, what we're doing now is just applying a fix to the SW in order to be able to manage the two parameters separately.

How we're going to update the URDF and/or the XML files can come at a later convenience after the PR is merged.

pattacini avatar Sep 12 '22 13:09 pattacini

@randaz81 the result XML section for multiple FT is something like this

  <group name="SENSORS">
                <param name="id">                   l_foot_ft1      l_foot_ft2      l_foot_ft3  </param>
                <param name="board">                strain2         strain2         strain2      </param>
                <param name="location">             CAN2:13         CAN1:13         CAN2:11     </param>
                <param name="framename">            myframename1    myframename2    myframename3 </param>
            </group>

triccyx avatar Sep 14 '22 12:09 triccyx