newton.sensors.ContactSensor#
- class newton.sensors.ContactSensor(model, sensing_obj_bodies=None, sensing_obj_shapes=None, counterpart_bodies=None, counterpart_shapes=None, match_fn=None, include_total=True, prune_noncolliding=False, verbose=None)[source]#
Bases:
object
- __init__(model, sensing_obj_bodies=None, sensing_obj_shapes=None, counterpart_bodies=None, counterpart_shapes=None, match_fn=None, include_total=True, prune_noncolliding=False, verbose=None)#
Add a contact sensor view to the model. Exactly one of sensing_obj_shapes or sensor_body must be specified to define the sensor. If contact partners are specified, each sensor produces separate readings per contact partner; otherwise, the sensor will read the total contact force.
- Parameters:
sensing_obj_shapes (str | list[str] | None) – pattern to match sensor shape names; one entity per matching shape.
sensor_body – pattern to match sensor body names; one entity per matching body.
contact_partners_shape – pattern to match contact partner shape names; one entity per matching shape.
contact_partners_body – pattern to match contact partner body names; one entity per matching body.
match_fn (Callable[[str, str], bool] | None) – function taking a name and a pattern and returning true if the name matches the pattern;
None. (fnmatch.fnmatch is used if match_fn is)
include_total (bool) – If contact partners are defined, include the total contact force as the first reading of each sensor.
prune_noncolliding (bool) – Skip readings that only pertain to non-colliding shape pairs.
verbose (bool | None) – print details