robotology / whole-body-estimators

YARP devices that implement estimators for humanoid robots.
24 stars 12 forks source link

Error while testing attaching MAS FTs to `wholeBodyDynamics` #163

Closed HosameldinMohamed closed 11 months ago

HosameldinMohamed commented 1 year ago

Here's the config file I used

config file ```xml /icub/torso /wholeBodyDynamics-thrEst/torso /icub/left_arm /wholeBodyDynamics-thrEst/left_arm /icub/right_arm /wholeBodyDynamics-thrEst/right_arm /icub/left_leg /wholeBodyDynamics-thrEst/left_leg /icub/right_leg /wholeBodyDynamics-thrEst/right_leg /icub/head /wholeBodyDynamics-thrEst/head /icub/inertial /wholeBodyDynamics-thrEst/imu /icub/left_arm /wholeBodyDynamics-thrEst/l_arm_ft_sensor /icub/right_arm /wholeBodyDynamics-thrEst/r_arm_ft_sensor /icub/left_leg/analog:o /wholeBodyDynamics-thrEst/l_leg_ft_sensor /icub/right_leg/analog:o /wholeBodyDynamics-thrEst/r_leg_ft_sensor ``` ```xml (torso_pitch,torso_roll,torso_yaw,neck_pitch, neck_roll,neck_yaw,l_shoulder_pitch,l_shoulder_roll,l_shoulder_yaw,l_elbow,r_shoulder_pitch,r_shoulder_roll,r_shoulder_yaw,r_elbow,l_hip_pitch,l_hip_roll,l_hip_yaw,l_knee,l_ankle_pitch,l_ankle_roll,r_hip_pitch,r_hip_roll,r_hip_yaw,r_knee,r_ankle_pitch,r_ankle_roll) model_no-feet-ft.urdf (0,0,-9.81) (root_link,l_sole,r_sole,l_upper_leg,r_upper_leg,l_elbow_1,r_elbow_1) (chest_l_jet_turbine, chest_r_jet_turbine,l_sole,r_sole,l_upper_leg,r_upper_leg,r_arm_jet_turbine,l_arm_jet_turbine) ( pure, pureKnown ,full ,full ,full ,full ,full ,full) (0,0,1 ,0,0,1 ,0,0,1 ,0,0,1 ,0,0,1 ,0,0,1 ,0,0,1 ,0,0,1) ( 0,0,0 ,0,0,0 ,0,0,0 ,0,0,0 ,0,0,0 ,0,0,0 ,0,0,0 ,0,0,0) imu_frame true false true 3.0 3.0 3.0 3.0 (l_foot_ft_sensor,r_foot_ft_sensor) /wholeBodyDynamicsThrustEst false (root_link,1,0) (chest,1,2) (l_upper_arm,3,2) (l_elbow_1, 3, 4) (r_upper_arm,4,2) (r_elbow_1, 4, 4) (l_upper_leg,5,2) (l_lower_leg,5,3) (l_ankle_1,5,4) (r_upper_leg,6,2) (r_lower_leg,6,3) (r_ankle_1,6,4) true root_link (torso_pitch,torso_roll,torso_yaw,neck_pitch,neck_roll,neck_yaw,l_shoulder_pitch,l_shoulder_roll,l_shoulder_yaw,l_elbow,r_shoulder_pitch,r_shoulder_roll,r_shoulder_yaw,r_elbow) (l_ankle_2,l_sole,l_sole) (r_ankle_2,r_sole,r_sole) (chest,chest) (l_elbow_1,l_elbow_1) (r_elbow_1,r_elbow_1) contactWrenches left_leg_mc right_leg_mc torso_mc right_arm_mc left_arm_mc head_mc inertial left-arm-ft-client right-arm-ft-client left_upper_leg_strain right_upper_leg_strain ```

Basically, I replaced 2 analogServer FTs with multipleanalogservers.

I am getting the following error

[ERROR] WholeBodyDynamicsDevice::attachAll Invalid number of MAS FT sensors after remapper

It happens due to this line:

https://github.com/robotology/whole-body-estimators/blob/c46c1852974776038a75b7c0e542ccb2917d7c7f/devices/wholeBodyDynamics/WholeBodyDynamicsDevice.cpp#L1743-L1747

Which is strange because the MAS sensors are detected based on

[DEBUG] wholeBodyDynamicsDevice :: number of ft sensors found in both ft + mas 4 where analog are  2  and mas are  2

From line https://github.com/robotology/whole-body-estimators/blob/c46c1852974776038a75b7c0e542ccb2917d7c7f/devices/wholeBodyDynamics/WholeBodyDynamicsDevice.cpp#L1720

Which means ftSensorList.size() is actually not empty.

What could I be possibly missing?

HosameldinMohamed commented 1 year ago

CC @traversaro

traversaro commented 1 year ago

If I recall correctly the current logic is that you should either have all sensors exposed via IAnalogSensors or all via ISixAxisForceTorqueSensors, you can't mix some sensors exposed via IAnalogSensors and some others via ISixAxisForceTorqueSensors.

HosameldinMohamed commented 1 year ago

If I recall correctly the current logic is that you should either have all sensors exposed via IAnalogSensors or all via ISixAxisForceTorqueSensors, you can't mix some sensors exposed via IAnalogSensors and some others via ISixAxisForceTorqueSensors.

I'm not sure this is the cause of this particular error, anyhow I tried with all FTs exposed via ISixAxisForceTorqueSensors, but still the same error occurs.

The error happens because attach methods in https://github.com/robotology/whole-body-estimators/blob/c46c1852974776038a75b7c0e542ccb2917d7c7f/devices/wholeBodyDynamics/WholeBodyDynamicsDevice.cpp#L1734-L1735

are executed with no errors but still return 0 devices because remappedMASInterfaces.ftMultiSensors->getNrOfSixAxisForceTorqueSensors() returns 0.

I found that I am missing the group multipleAnalogSensorsNames in the config files, which I guess should list the names of the MAS FT sensors, see this logic https://github.com/robotology/whole-body-estimators/blob/c46c1852974776038a75b7c0e542ccb2917d7c7f/devices/wholeBodyDynamics/WholeBodyDynamicsDevice.cpp#L772-L795

But I still can't get it right because I don't know how to properly add this group. CC @CarlottaSartore @GiulioRomualdi

HosameldinMohamed commented 1 year ago

But I still can't get it right because I don't know how to properly add this group.

Adding this configuration worked (we are using 4 FTs in iRonCub):

<group name="multipleAnalogSensorsNames">
            <param name="SixAxisForceTorqueSensorsNames">("l_arm_ft_sensor", "r_arm_ft_sensor", "l_leg_ft_sensor", "r_leg_ft_sensor")</param>
            <param name="TemperatureSensorsNames">("l_arm_ft_sensor", "r_arm_ft_sensor", "l_leg_ft_sensor", "r_leg_ft_sensor")</param>
</group>

Probably we need to document this somewhere..

I was also able to launch the device successfully with mixing attaching multipleanalogservers and analogservers.

CC @traversaro

HosameldinMohamed commented 11 months ago

I think we can close this issue!