[FEATURE] Add support of link filtering to contact sensors. - #2772
Conversation
|
This feature has already been implemented by #2655 . |
|
@Milotrince What I'm after here is a |
d42940d to
6f1b2ea
Compare
|
I rebased your branch and updated to extend the filtering to ContactDepthProbe and KinematicTaxel as well as ContactProbe! |
6f1b2ea to
1358dea
Compare
82e30bd to
37e6118
Compare
|
|
645ea78 to
d8a6312
Compare
c634870 to
ce4e11d
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce4e11ddf8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
ce4e11d to
7cc560a
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
ContactForceSensor now accepts filter_link_idx, mirroring ContactSensor: contacts with the sensor link whose other participant is one of the listed links are excluded from the reported force. The filter is applied on both ground-truth-update paths -- the vectorized zerocopy path (same 4D contact-vs-filter broadcast as ContactSensor, applied to the per-side contact masks before they are aggregated) and the _kernel_get_contacts_forces kernel (a small per-contact loop over the sensor's filter list). As in ContactSensor, filtered_sensor_idx gates the more expensive comparison so sensors without a filter keep the cheap path. Covers this in test_contact_sensor_filter_link_idx alongside the Contact sensor.
ContactProbe, ContactDepthProbe, and KinematicTaxel now accept filter_link_idx, mirroring the Contact/ContactForce semantics: a contact with the sensor link is dropped when its counterpart link is in the filter list. The three share the counterpart check via a _func_link_is_filtered device helper threaded into both contact-depth query funcs and their kernels, and a FilterableTactileProbeSensorOptionsMixin so the point-cloud tactile sensors (Elastomer/Proximity), which sample a point cloud rather than solver contacts, do not expose the option. Consolidate the existing contact-force filtering while here: - the kernel now uses the shared _func_link_is_filtered helper instead of open-coding the per-contact filter flags; - the zerocopy filter masking (identical in Contact and ContactForce) is factored into _drop_filtered_counterpart_contacts; - the build-time padding is factored into misc.append_filter_links_idx (used by all five sensors) and the range validation into options._validate_filter_link_idx. The filter table keeps at least one column so the no-filter case is still a valid kernel argument. Covers this in test_kinematic_contact_probe_box_sphere_support.
7cc560a to
2107e29
Compare
…aycast path. Builds on the two preceding contributor commits and addresses the review feedback: - Replace the free _validate_filter_link_idx and the separate FilterableTactileProbeSensorOptionsMixin with a single ContactFilterOptionsMixin shared by Contact, ContactForce, and the solver-contact tactile probes, so the generic sensor options no longer reference links. - Replace misc.append_filter_links_idx with a shared ContactFilterMetadataMixin that owns the per-sensor filter table and its fast-path index. - Apply the tactile counterpart filter where each sensor's per-(env, sensor) contact/geom list is built (_kernel_build_sensor_geom_idx for SDF, _kernel_build_sensor_contact_idx for raycast) -- before the per-sensor contact cap, so both contact-depth backends honor it and a large filtered manifold cannot starve an allowed contact, leaving the per-probe hot kernels untouched. - Re-home the tests into tests/sensors/ and add regression coverage, including the prefilter-cap starvation case.
2107e29 to
ec68096
Compare
…sis-Embodied-AI#2772) Genesis upstream added first-class link filtering to the contact sensors (ContactFilterOptionsMixin.filter_link_idx on Contact, ContactForce, and the tactile probes), superseding the local ContactForceSensor filter patch this fork carried. Drop the local patch and take the upstream implementation wholesale: contact_force.py and options.py now match upstream exactly, so the fork no longer diverges and future pulls stop conflicting. The filter_link_idx option name and semantics are unchanged, so downstream callers keep working.
ContactForceSensor now accepts filter_link_idx, mirroring ContactSensor: contacts with the sensor link whose other participant is one of the listed links are excluded from the reported force. The filter is applied on both ground-truth-update paths; the vectorized zerocopy path and the _kernel_get_contacts_forces kernel.
Adds test_contact_force_sensor_filter_link_idx.
Description
ContactForceSensornow acceptsfilter_link_idx(default()), mirroringContactSensorfrom #2655: contacts with the sensor link whose otherparticipant is one of the listed links are excluded from the reported force.
Related Issue
Resolves #2771
Motivation and Context
ContactSensoralready filters its boolean by counterpart link, butContactForceSensoronly reported the total contact force on the link, with no way to scope it (e.g. "force on a foot from the ground, excluding self-contact").How Has This Been / Can This Be Tested?
test_contact_force_sensor_filter_link_idxputs a box on the floor (env 0) / a box on the floor with another box stacked on top (env 1), with twoContactForcesensors on the bottom box — one plain, one withfilter_link_idx (floor.link_start,). It asserts the filtered sensor reads ~0 in env 0 and reads only the top box's downward push in env 1, while the unfiltered sensor reads the net contact force in both.Checklist:
Submitting Code Changessection of CONTRIBUTING document.