irsim.world.sensors.contact2d#
Classes#
Contact sensor of one object: what the contact step recorded about it |
Module Contents#
- class irsim.world.sensors.contact2d.Contact2D(state: numpy.ndarray | None = None, obj_id: int = 0, force_scale: float = 0.05, marker_size: float = 6.0, linewidth: float = 1.5, alpha: float = 0.9, **kwargs)[源代码]#
Contact sensor of one object: what the contact step recorded about it (
collision_mode: contactonly), as a contact sensor mounted on the object reports.Every object carries one as
obj.contact, written by the environment and the contact solver, so its readings are always available:obj.contact.in_contact,partners,reports,force,contact_time,air_time,startedandended. Listing it under the object'ssensorsastype: 'contact2d'makes that one the object's sensor and draws it: a marker at each contact point and a line along the contact normal whose length is the contact force timesforce_scale.- 参数:
state (np.ndarray) -- Initial state of the object
[x, y, theta], kept for the common sensor interface; the readings do not depend on it.obj_id (int) -- ID of the associated object.
force_scale (float) -- Length of the drawn force line per newton, in meters. Default 0.05.
marker_size (float) -- Size of the contact point markers. Default 6.
linewidth (float) -- Width of the force lines. Default 1.5.
alpha (float) -- Transparency of the drawing. Default 0.9.
**kwargs --
plotsub-dict (preferred) with the visualization options above andcolor(default: the palettemarkercolor), plus thename/typekey of the YAML entry.
- 变量:
sensor_type (str) --
"contact2d".parent (ObjectBase) -- The object the sensor is mounted on.
in_contact (bool) -- Whether a contact was resolved against
parentin the last step.partners (list) -- The objects
parenttouched in the last step, each once.records (list[Contact]) -- The contact records of the last step, in the solver's order.
force (np.ndarray) -- Net world-frame contact force
(2, 1)onparentin the last step, in newtons.contact_time (float) -- Seconds
parenthas been touching something.air_time (float) -- Seconds
parenthas been free; one of the two timers runs while the other is held at zero.started (bool) -- Whether the last step began a contact.
ended (bool) -- Whether the last step ended one.
- sensor_type = 'contact2d'#
- obj_id = 0#
- parent: irsim.world.object_base.ObjectBase | None = None#
- force_scale#
- marker_size#
- linewidth#
- alpha#
- color#
- in_contact = False#
- partners: list[Any] = []#
- records: list[irsim.lib.algorithm.contact.Contact] = []#
- force#
- contact_time = 0.0#
- air_time = 0.0#
- started = False#
- ended = False#
- property reports: list[irsim.lib.algorithm.contact.ContactReport]#
Last step's contacts seen from
parent's side.
- add(contact: irsim.lib.algorithm.contact.Contact) None[源代码]#
Record a contact the solver resolved against
parent.
- add_force(force_xy: numpy.ndarray) None[源代码]#
Accumulate a world-frame force
(2,)or(2, 1)onparent.
- tick(step_time: float) None[源代码]#
Advance
contact_timeorair_timeby one step and raisestartedorendedfor a step that switched between them.
- step(state: numpy.ndarray) None[源代码]#
Keep the sensor state; the readings are written by the contact step.