Skip to navigation

Event Mapping Configuration

View as Markdown

The MDX client, mdx_client, consumes the VSS Kafka topics mdx-events and mdx-frames and turns matching messages into Safety Core events. The event mapping, passed with --config, decides which messages match and which event type (EVENT_0 to EVENT_23) each one becomes. The SDM configuration then decides what each event type means to a decision maker: the two must use the same codes.

File format

The mapping is a Protobuf EventMappingConfig message: a list of rules { ... } blocks. The MDX client reads the file as binary Protobuf first and, if that fails, as Protobuf text format. A field name it does not know makes the file fail to load.

rules {
name: "Person restricted area ROI violation"
message_source: "mdx-frames"
alert_type: "roi"
object_type: "person"
rule_id: "roi-id-1"
restricted_area_violation: "true"
output_event: "EVENT_4"
}

Rule fields

FieldEffect
nameLabel used in logs and in --debug output.
message_sourcemdx-events or mdx-frames.
alert_typeThe kind of alert. From mdx-events the MDX client produces tripwire and roi. From mdx-frames it produces roi, social_distancing, object_presence and co_movement. empty_roi is accepted in a rule but never produced, so such a rule never matches.
event_typeDirection or transition, for example IN, OUT, ENTRY, EXIT.
object_typeObject class, for example person or forklift.
rule_idThe tripwire or ROI identifier, or, for a proximity-pair rule, the rule’s own unique identifier.
restricted_area_violation, confined_area_violation, social_distancing_violationViolation filters for mdx-frames. See Violation filters.
object_type_primary, object_type_secondary, proximity_violation, distance_threshold_metersProximity-pair fields. See Proximity-pair rules.
scale_factormdx-frames rules only: report every Nth frame per sensor. A value of 1 or less, or no value, reports every frame.
output_eventThe event type to report: EVENT_0 to EVENT_23.

severity is reserved: a rule that contains it fails to load. rule_id_prefix_match is still in the message but is ignored. Co-movement rules (alert_type: "co_movement" with the comovement_* fields) are accepted, but no shipped mapping uses them.

Matching

  • Rules are tried in file order, and the first matching rule is used. If that rule’s scale_factor skips the current frame, the message is dropped: it does not fall through to later rules.
  • An empty field matches any value. Every other string field must match exactly, ignoring case.
  • rule_id also matches a producer identifier of the form <rule_id>:<suffix>. In that form the <rule_id> part is compared with case.
  • The restricted-area “cleared” events that the MDX client creates itself (see below) compare ROI identifiers with case. Keep rule_id in exactly the case VSS uses.
  • The sensor name in the message is then looked up in the identity file to find its pipelineId: sensor_config.conf in 2D, sensor_pipelines_config.conf in 3D. A message whose sensor is not there is dropped with Dropping event: sensor not in sensor_config, so it has no pipelineID: <name>. See Sensor files.

Use mdx_client --debug to see which rule each message matches. In that mode the MDX client prints [MDX_DEBUG] Matched rule: ... instead of reporting events, and does not register with the SEI daemon.

Violation filters

FilterValuesRequires
restricted_area_violation"true", "false", "any" or empty, in lower casemessage_source: "mdx-frames", alert_type: "roi"
confined_area_violationThe samemessage_source: "mdx-frames", alert_type: "roi"
social_distancing_violationThe samemessage_source: "mdx-frames", alert_type: "social_distancing"
  • A rule may set at most one filter.
  • "any" is not the same as empty: it still restricts the rule to that kind of candidate.
  • For a rule with restricted_area_violation: "true", the MDX client also creates a “cleared” candidate when the area is present in a frame but no violator is in it. A matching rule with restricted_area_violation: "false" turns that into the cleared event, as EVENT_5 does in the forklift mapping.

Proximity-pair rules

A proximity-pair rule reports the distance between two object classes in mdx-frames:

rules {
name: "Forklift-Person 2m >= distance > 1m"
message_source: "mdx-frames"
alert_type: "social_distancing"
rule_id: "forklift_person_lt_2m"
object_type_primary: "Forklift"
object_type_secondary: "Person"
proximity_violation: true
distance_threshold_meters: 2.0
output_event: "EVENT_13"
}

A rule is a pair rule when it sets proximity_violation, distance_threshold_meters, object_type_primary or object_type_secondary. It must then have:

  • message_source: "mdx-frames", alert_type: "social_distancing", a primary type, and proximity_violation present, with no violation filter;
  • for proximity_violation: true, a finite distance_threshold_meters greater than 0; for false, no threshold;
  • a rule_id that is not empty, shorter than 64 characters, and unique (ignoring case);
  • at most one rule per pair and threshold, and at most one “no violation” rule per pair.

The two object types are matched in either order. The distance is the 3D distance between the two objects. The rule with the smallest threshold that is at least the distance wins. The “no violation” rule applies when the frame reports no social-distancing violation.

When a frame reports a violation, a pair whose largest distance_threshold_meters is above the social-distancing threshold reported in that frame is skipped for the frame. Configure the VSS social-distancing threshold to at least the largest threshold in your pair rules.

For binary Protobuf mappings, keep proximity_violation and distance_threshold_meters as present or absent exactly as above: their presence is part of the rule.

Validation and errors

mdx_client validates the mapping at startup and exits if it is unusable:

ProblemMessage
No --configerror: config path is required (use -c or positional argument)
File missing or not ProtobufFailed to load config file: <path>
No rulesNo rules in config or load failed
A rule that cannot be readInvalid event mapping rule
A rule that breaks the filter or pair rules aboveRejected unsafe event mapping rule

message_source, alert_type and output_event are not checked against known values. A typo loads cleanly and the rule never matches. An unknown output_event makes matching messages report EVENT_UNKNOWN, which no SDM can subscribe to. Check new rules with --debug.

Restart the MDX client, or the Safety Core, after changing a mapping.

Shipped mappings

FileUsed by default for --appRules
/opt/nvidia/psf/apps/atl/event_mapping_atl.pb.txtatl, atl,atl, atl_dualForklift safety function, zone 1 (EVENT_0–EVENT_5) and zone 2 (EVENT_6–EVENT_11)
/opt/nvidia/psf/apps/proximity/proximity_event_mapping.pb.txtpxc, pxc,pxc, atl,pxc, pxc,atlBoth forklift zones (EVENT_0–EVENT_11) and four proximity pairs (EVENT_12–EVENT_23)
/opt/nvidia/psf/apps/atl_proximity/event_mapping_atl_proximity.pb.txtatl_proximity (container entrypoint only)Forklift zone 1 (EVENT_0–EVENT_5) and one forklift–person pair (EVENT_8–EVENT_10)

The launchers pass --event-mapping <file> through to the MDX client in place of the default; see Launchers and command-line options. With launch_hoisa.sh --runtime docker the MDX client runs in the container and reads the image’s copy of the default mapping, so editing the host’s copy has no effect; pass your file with --event-mapping instead.

Forklift safety function

Zone 1, as shipped:

rules {
name: "Forklift tripwire OUT"
message_source: "mdx-events"
alert_type: "tripwire"
event_type: "OUT"
object_type: "forklift"
rule_id: "tripwire-id-1"
output_event: "EVENT_0"
}
rules {
name: "Forklift tripwire IN"
message_source: "mdx-events"
alert_type: "tripwire"
event_type: "IN"
object_type: "forklift"
rule_id: "tripwire-id-1"
output_event: "EVENT_1"
}
rules {
name: "Person tripwire OUT"
message_source: "mdx-events"
alert_type: "tripwire"
event_type: "OUT"
object_type: "person"
rule_id: "tripwire-id-1"
output_event: "EVENT_2"
}
rules {
name: "Person tripwire IN"
message_source: "mdx-events"
alert_type: "tripwire"
event_type: "IN"
object_type: "person"
rule_id: "tripwire-id-1"
output_event: "EVENT_3"
}
rules {
name: "Person restricted area ROI violation"
message_source: "mdx-frames"
alert_type: "roi"
object_type: "person"
rule_id: "roi-id-1"
restricted_area_violation: "true"
output_event: "EVENT_4"
}
rules {
name: "Person restricted area ROI violation cleared"
message_source: "mdx-frames"
alert_type: "roi"
object_type: "person"
rule_id: "roi-id-1"
restricted_area_violation: "false"
output_event: "EVENT_5"
}
InputZone 1Zone 2Meaning to atl_sdm (--config key)
Forklift crosses the tripwire OUTEVENT_0EVENT_6Forklift entered the trailer (forklift_entered)
Forklift crosses the tripwire INEVENT_1EVENT_7Forklift left the trailer (forklift_exited)
Person crosses the tripwire OUTEVENT_2EVENT_8Person entered the trailer (person_entered)
Person crosses the tripwire INEVENT_3EVENT_9Person left the trailer (person_exited)
Person in the restricted areaEVENT_4EVENT_10Restricted-area violation (roi_violation)
Restricted-area violation clearedEVENT_5EVENT_11Violation cleared (roi_cleared)

Zone 1 uses tripwire-id-1 and roi-id-1; zone 2 uses tripwire-id-2 and roi-id-2, with rule names prefixed Zone2. The atl_sdm_zone1.conf.sample and atl_sdm_zone2.conf.sample templates bind these codes.

Proximity Monitoring

proximity_event_mapping.pb.txt holds both forklift zones above, and these pair rules. Each is mdx-frames / social_distancing with Person as the secondary type:

Primary typerule_id prefixNo violation2 m or less1 m or less
Forkliftforklift_person_EVENT_12EVENT_13EVENT_14
Agility_Digit_Humanoidagility_digit_person_EVENT_15EVENT_16EVENT_17
Transportertransporter_person_EVENT_18EVENT_19EVENT_20
Fourier_GR1_T2_Humanoidfourier_humanoid_person_EVENT_21EVENT_22EVENT_23

The rule_id suffixes are no_violation, lt_2m and lt_1m. proximity_sdm maps the three codes of each pair to <group>_normal, <group>_reduce and <group>_stop in its --config file. The pxc_sdm_forklift.conf.sample template selects the forklift pair; the pxc_sdm_robots.conf.sample template selects the other three.

Forklift safety function with proximity

event_mapping_atl_proximity.pb.txt holds forklift zone 1 (EVENT_0–EVENT_5) and three pair rules with primary forklift and secondary person: forklift_person_no_violation (EVENT_8), forklift_person_lt_2m (2.0 m, EVENT_9) and forklift_person_lt_1m (1.0 m, EVENT_10). EVENT_6 and EVENT_7 are unused. atl_sdm receives EVENT_0–EVENT_5 and atl_proximity_sdm receives EVENT_8–EVENT_10.

Before you change a mapping

  1. Confirm that the sensor names VSS emits are in the identity file (sensor_config.conf in 2D, sensor_pipelines_config.conf in 3D).
  2. Confirm that object types and tripwire or ROI identifiers match the deployed VSS configuration, including case.
  3. Keep the output_event codes and the SDM --config bindings in step. Two SDMs on one gateway must not share a code.
  4. Run with --debug to see which rule each message matches before you report to the SEI daemon.

Related pages: SEI Configuration, and the decision makers in the Integration Guide.