Remove margin name from geomdist sensors.

PiperOrigin-RevId: 811775910
Change-Id: I4d265d4ad0206ea2d92c6c4b659f509a17f12baa
This commit is contained in:
Kyle Bayes
2025-09-26 05:22:59 -07:00
committed by Copybara-Service
parent 9a5acbd662
commit 8de86c9944
2 changed files with 5 additions and 5 deletions
+4 -5
View File
@@ -551,11 +551,10 @@ void mj_sensorPos(const mjModel* m, mjData* d) {
case mjSENS_GEOMNORMAL: // normal direction between two geoms
case mjSENS_GEOMFROMTO: // segment between two geoms
{
// use cutoff for collision margin
mjtNum margin = m->sensor_cutoff[i];
mjtNum cutoff = m->sensor_cutoff[i];
// initialize outputs
mjtNum dist = margin; // collision distance
mjtNum dist = cutoff; // collision distance
mjtNum fromto[6] = {0}; // segment between geoms
// get lists of geoms to collide
@@ -580,7 +579,7 @@ void mj_sensorPos(const mjModel* m, mjData* d) {
for (int geom1=id1; geom1 < id1+n1; geom1++) {
for (int geom2=id2; geom2 < id2+n2; geom2++) {
mjtNum fromto_new[6] = {0};
mjtNum dist_new = mj_geomDistance(m, d, geom1, geom2, margin, fromto_new);
mjtNum dist_new = mj_geomDistance(m, d, geom1, geom2, cutoff, fromto_new);
if (dist_new < dist) {
dist = dist_new;
mju_copy(fromto, fromto_new, 6);
@@ -626,7 +625,7 @@ void mj_sensorPos(const mjModel* m, mjData* d) {
m->sensor_objid[i+1] == objid &&
m->sensor_reftype[i+1] == reftype &&
m->sensor_refid[i+1] == refid &&
m->sensor_cutoff[i+1] == margin;
m->sensor_cutoff[i+1] == cutoff;
// if signature matches, increment external loop variable i
if (write_sensor) {
+1
View File
@@ -485,6 +485,7 @@ mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2,
}
}
// call collision function with distmax as margin
int num = func(m, d, con, g1, g2, distmax);
// find smallest distance