Change tactile sensor normal component to report penetration depth.

The normal component of the tactile sensor now reports the maximum penetration depth at each taxel, instead of a derived normal force. The depth is negated so that positive values indicate penetration.

PiperOrigin-RevId: 921980899
Change-Id: Ide4103c0aff465e25a81cfdda650f6a0e2da9e0b
This commit is contained in:
Alessio Quaglino
2026-05-27 02:00:00 -07:00
committed by Copybara-Service
parent 583aa5ad4f
commit f6cd0234fd
5 changed files with 18 additions and 27 deletions
+4 -4
View File
@@ -1702,7 +1702,7 @@ TEST_F(SensorTest, TactileSkipTangents) {
EXPECT_EQ(data->time, 0.0);
EXPECT_GT(data->ncon, 0) << "No contacts generated";
// Tactile sensor layout: [normal_forces..., tang1_forces..., tang2_forces...]
// Tactile sensor layout: [depths..., tang1_vel..., tang2_vel...]
int ntaxel = model->nsensordata / 3;
ASSERT_EQ(model->nsensordata % 3, 0) << "Sensor dim should be divisible by 3";
@@ -1712,13 +1712,13 @@ TEST_F(SensorTest, TactileSkipTangents) {
<< "Tangent component at index " << i << " should be 0";
}
// Normal force components: verify count, sign, and magnitude ~-0.8
// Penetration depth components: verify count, sign, and magnitude ~0.2
int nonzero_count = 0;
for (int i = 0; i < ntaxel; i++) {
if (data->sensordata[i] != 0) {
nonzero_count++;
EXPECT_NEAR(data->sensordata[i], -0.8, 0.1)
<< "Normal force at taxel " << i;
EXPECT_NEAR(data->sensordata[i], 0.2, 0.1)
<< "Penetration depth at taxel " << i;
}
}
EXPECT_EQ(nonzero_count, 2) << "Expected 2 taxels in contact";