Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jpo-conflictmonitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-conflictmonitor</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
<packaging>jar</packaging>
<name>jpo-conflictmonitor</name>
<url>http://maven.apache.org</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.validation.map.MapValidationParameters;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.validation.spat.SpatValidationParameters;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.validation.spat.SpatValidationStreamsAlgorithmFactory;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior.VehicleMisbehaviorAlgorithm;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior.VehicleMisbehaviorAlgorithmFactory;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior.VehicleMisbehaviorParameters;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.*;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.minimum_data.MapMinimumDataEventAggregation;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.minimum_data.SpatMinimumDataEventAggregation;
Expand Down Expand Up @@ -232,6 +235,10 @@ public class ConflictMonitorProperties implements EnvironmentAware {
private String eventAlgorithm;
private EventParameters eventParameters;

private VehicleMisbehaviorAlgorithmFactory vehicleMisbehaviorAlgorithmFactory;
private String vehicleMisbehaviorAlgorithm;
private VehicleMisbehaviorParameters vehicleMisbehaviorParameters;

// Confluent Properties
private boolean confluentCloudEnabled = false;
private String confluentKey = null;
Expand Down Expand Up @@ -364,13 +371,22 @@ public void setIntersectionEventAlgorithmFactory(IntersectionEventAlgorithmFacto
this.intersectionEventAlgorithmFactory = intersectionEventAlgorithmFactory;
}



@Value("${intersection.event.algorithm}")
public void setIntersectionEventAlgorithm(String intersectionEventAlgorithm) {
this.intersectionEventAlgorithm = intersectionEventAlgorithm;
}

@Autowired
public void setBsmMisbehaviorParameters(VehicleMisbehaviorParameters vehicleMisbehaviorParameters) {
this.vehicleMisbehaviorParameters = vehicleMisbehaviorParameters;
this.vehicleMisbehaviorAlgorithm = vehicleMisbehaviorParameters.getAlgorithm();
}

@Autowired
public void setVehicleMisbehaviorAlgorithmFactory(VehicleMisbehaviorAlgorithmFactory factory) {
this.vehicleMisbehaviorAlgorithmFactory = factory;
}

@Autowired
public void setMapValidationParameters(MapValidationParameters mapBroadcastRateParameters) {
this.mapValidationParameters = mapBroadcastRateParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.validation.spat.SpatValidationAlgorithm;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.validation.spat.SpatValidationParameters;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.validation.spat.SpatValidationStreamsAlgorithmFactory;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior.VehicleMisbehaviorAlgorithm;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior.VehicleMisbehaviorAlgorithmFactory;
import us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior.VehicleMisbehaviorParameters;
import us.dot.its.jpo.conflictmonitor.monitor.models.map.MapIndex;
import us.dot.its.jpo.conflictmonitor.monitor.topologies.config.ConfigInitializer;
import us.dot.its.jpo.conflictmonitor.monitor.topologies.config.ConfigTopology;
Expand Down Expand Up @@ -355,7 +358,10 @@ public MonitorServiceController(final ConflictMonitorProperties conflictMonitorP
startSpatMessageCountProgressionAlgorithm();

//Bsm Message Count Progression Topology
startBsmMessageCountProgressionAlgorithm();
startBsmMessageCountProgressionAlgorithm();

//Vehicle Misbehavior Topology
startVehicleMisbehaviorAlgorithm();

// Combined Event Topology
final String event = "event";
Expand Down Expand Up @@ -587,6 +593,26 @@ private void startBsmMessageCountProgressionAlgorithm() {
bsmMessageCountProgressionAlgo.start();
}

private void startVehicleMisbehaviorAlgorithm() {
final String vehicleMisbehavior = "vehicleMisbehavior";
final VehicleMisbehaviorAlgorithmFactory vehicleMisbehaviorAlgoFactory = conflictMonitorProps.getVehicleMisbehaviorAlgorithmFactory();
final String vehicleMisbehaviorAlgorithm = conflictMonitorProps.getVehicleMisbehaviorAlgorithm();
final VehicleMisbehaviorAlgorithm vehicleMisbehaviorAlgo = vehicleMisbehaviorAlgoFactory.getAlgorithm(vehicleMisbehaviorAlgorithm);
final VehicleMisbehaviorParameters vehicleMisbehaviorParams = conflictMonitorProps.getVehicleMisbehaviorParameters();
configTopology.registerConfigListeners(vehicleMisbehaviorParams);
if (vehicleMisbehaviorAlgo instanceof StreamsTopology) {
final var streamsAlgo = (StreamsTopology)vehicleMisbehaviorAlgo;
streamsAlgo.setStreamsProperties(conflictMonitorProps.createStreamProperties(vehicleMisbehavior));
streamsAlgo.registerStateListener(new StateChangeHandler(kafkaTemplate, vehicleMisbehavior, stateChangeTopic, healthTopic));
streamsAlgo.registerUncaughtExceptionHandler(new StreamsExceptionHandler(kafkaTemplate, vehicleMisbehavior, healthTopic));
algoMap.put(vehicleMisbehavior, streamsAlgo);
}
vehicleMisbehaviorAlgo.setParameters(vehicleMisbehaviorParams);

Runtime.getRuntime().addShutdownHook(new Thread(vehicleMisbehaviorAlgo::stop));
vehicleMisbehaviorAlgo.start();
}

private MapTimestampDeltaAlgorithm getMapTimestampDeltaAlgorithm() {
final var factory = conflictMonitorProps.getMapTimestampDeltaAlgorithmFactory();
final String algorithmName = conflictMonitorProps.getMapTimestampDeltaAlgorithm();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior;



import us.dot.its.jpo.conflictmonitor.monitor.algorithms.Algorithm;

public interface VehicleMisbehaviorAlgorithm
extends Algorithm<VehicleMisbehaviorParameters>{

// void setAggregationAlgorithm(BsmMessageCountProgressionAggregationAlgorithm aggregationAlgorithm);

}






Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior;

public interface VehicleMisbehaviorAlgorithmFactory {
VehicleMisbehaviorAlgorithm getAlgorithm(String algorithmName);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.config.ServiceLocatorFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class VehicleMisbehaviorAlgorithms {
@Bean
public FactoryBean<?> vmServiceLocatorFactoryBean() {
var factoryBean = new ServiceLocatorFactoryBean();
factoryBean.setServiceLocatorInterface(VehicleMisbehaviorAlgorithmFactory.class);
return factoryBean;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior;

public class VehicleMisbehaviorConstants {
public static final String DEFAULT_VEHICLE_MISBEHAVIOR_ALGORITHM = "defaultVehicleMisbehaviorAlgorithm";
public static final String DEBUG_VEHICLE_MISBEHAVIOR_ALGORITHM = "debugVehicleMisbehaviorAlgorithm";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior;

import static us.dot.its.jpo.conflictmonitor.monitor.models.config.UpdateType.DEFAULT;
import static us.dot.its.jpo.conflictmonitor.monitor.models.config.UpdateType.READ_ONLY;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import lombok.Data;
import lombok.Generated;
import us.dot.its.jpo.conflictmonitor.monitor.models.config.ConfigData;
import us.dot.its.jpo.conflictmonitor.monitor.models.config.ConfigDataClass;
import us.dot.its.jpo.conflictmonitor.monitor.models.config.UnitsEnum;


@Data
@Generated
@Component
@ConfigurationProperties(prefix = "vehicle.misbehavior")
@ConfigDataClass
public class VehicleMisbehaviorParameters {

@ConfigData(key = "vehicle.misbehavior.algorithm",
description = "Algorithm to use for Vehicle Misbehavior",
updateType = READ_ONLY)
String algorithm;

// Whether to log diagnostic information for debugging
@ConfigData(key = "vehicle.misbehavior.debug",
description = "Whether to log diagnostic information for debugging",
updateType = DEFAULT)
boolean debug;

@ConfigData(key = "vehicle.misbehavior.acceleration_lateral_range",
units = UnitsEnum.FEET_PER_SECOND_SQUARED,
description = "Threshold for generating an event due to an unrealistic acceleration. Measured in Feet per second squared.",
updateType = DEFAULT)
double accelerationRangeLateral;

@ConfigData(key = "vehicle.misbehavior.acceleration_longitudinal_range",
units = UnitsEnum.FEET_PER_SECOND_SQUARED,
description = "Threshold for generating an event due to an unrealistic acceleration. Measured in Feet per second squared.",
updateType = DEFAULT)
double accelerationRangeLongitudinal;

@ConfigData(key = "vehicle.misbehavior.acceleration_vertical_range",
units = UnitsEnum.FEET_PER_SECOND_SQUARED,
description = "Threshold for generating an event due to an unrealistic acceleration. Measured in Feet per second squared.",
updateType = DEFAULT)
double accelerationRangeVertical;

@ConfigData(key = "vehicle.misbehavior.speed_range",
units = UnitsEnum.MILES_PER_HOUR,
description = "Threshold for generating an event do to unrealistic speed. Measured in Miles Per Hour.",
updateType = DEFAULT)
double speedRange;

@ConfigData(key = "vehicle.misbehavior.yaw_rate_range",
units = UnitsEnum.DEGREES_PER_SECOND,
description = "Threshold for generating an event do to unrealistic change in heading. Measured in Degrees per second",
updateType = DEFAULT)
double yawRateRange;

@ConfigData(key = "vehicle.misbehavior.allowable_max_speed",
units = UnitsEnum.MILES_PER_HOUR,
description = "Maximum allowable Speed. Measured in Miles per Hour",
updateType = DEFAULT)
double allowableMaxSpeed;

@ConfigData(key = "vehicle.misbehavior.allowable_max_heading_delta",
units = UnitsEnum.DEGREES_PER_SECOND,
description = "Maximum allowable change in heading. Measured in Degrees per second",
updateType = DEFAULT)
double allowableMaxHeadingDelta;

@ConfigData(key = "vehicle.misbehavior.processedBsmStateStoreName",
description = "Name of the versioned state store for the jitter buffer",
updateType = READ_ONLY)
volatile String processedBsmStateStoreName;

@ConfigData(key = "vehicle.misbehavior.bsmInputTopicName",
description = "The name of the topic to read BSMs from",
updateType = READ_ONLY)
String bsmInputTopicName;

@ConfigData(key = "vehicle.misbehavior.vehicleMisbehaviorEventOutputTopicName",
description = "The name of the topic to write Vehicle Misbehavior events to",
updateType = READ_ONLY)
String vehicleMisbehaviorEventOutputTopicName;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package us.dot.its.jpo.conflictmonitor.monitor.algorithms.vehicle_misbehavior;


import us.dot.its.jpo.conflictmonitor.monitor.algorithms.StreamsTopology;

public interface VehicleMisbehaviorStreamsAlgorithm
extends VehicleMisbehaviorAlgorithm, StreamsTopology {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

import java.util.List;

/**
* SignalStateAssessment - Assessment object containing a list describing how far vehicles are from the centerline as they drive through a lane.
/*
* This class has been deprecated and should no longer be used. Use StopLinePassageAssessment instead.
*/
@Getter
@Setter
@Generated
@Deprecated
public class SignalStateAssessment extends Assessment{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@Getter
@Setter
@Generated
@Deprecated
public class SignalStateAssessmentGroup {


Expand Down
Loading
Loading