Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safety updates #357

Merged
merged 5 commits into from
May 20, 2021
Merged
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
20 changes: 20 additions & 0 deletions MapboxVisionSafety/VisionSafetyManager/VisionSafetyManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,24 @@ extension VisionSafetyManager: VisionSafetyDelegate {
public func onForwardCarUpdated(_ forwardCar: CollisionObject?) {
delegate?.visionSafetyManager(self, didUpdateForwardCar: forwardCar)
}

public func onHardAccelerationDetected(_ hardAccelerationDetection: HardAccelerationDetection) {
delegate?.visionSafetyManager(self, didDetectHardAcceleration: hardAccelerationDetection)
}

public func onHardBrakingDetected(_ hardBrakingDetection: HardBrakingDetection) {
delegate?.visionSafetyManager(self, didDetectHardBraking: hardBrakingDetection)
}

public func onHardCorneringDetected(_ hardCorneringDetection: HardCorneringDetection) {
delegate?.visionSafetyManager(self, didDetectHardCornering: hardCorneringDetection)
}

public func onLaneChangeDetected(_ laneChangeDetection: LaneChangeDetection) {
delegate?.visionSafetyManager(self, didDetectLaneChange: laneChangeDetection)
}

public func onRunStopSignDetected(_ runStopSignDetection: RunStopSignDetection) {
delegate?.visionSafetyManager(self, didDetectRunStopSign: runStopSignDetection)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,31 @@ public protocol VisionSafetyManagerDelegate: AnyObject {
`Camera` needs to be calibrated for the event to be triggered.
*/
func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didUpdateForwardCar forwardCar: CollisionObject?)

/**
Tells the delegate that hard acceleration is detected
*/
func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectHardAcceleration: HardAccelerationDetection)

/**
Tells the delegate that hard braking is detected
*/
func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectHardBraking: HardBrakingDetection)

/**
Tells the delegate that turn at high speed which causes big lateral acceleration is detected
*/
func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectHardCornering: HardCorneringDetection)

/**
Tells the delegate that driver maneuver when vehicle moves from one lane to another is detected
*/
func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectLaneChange: LaneChangeDetection)

/**
Tells the delegate that running a stop sign without complete stopping is detected
*/
func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectRunStopSign: RunStopSignDetection)
}

public extension VisionSafetyManagerDelegate {
Expand All @@ -41,4 +66,14 @@ public extension VisionSafetyManagerDelegate {
func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectImpact: ImpactDetection) {}

func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didUpdateForwardCar forwardCar: CollisionObject?) {}

func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectHardAcceleration: HardAccelerationDetection) {}

func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectHardBraking: HardBrakingDetection) {}

func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectHardCornering: HardCorneringDetection) {}

func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectLaneChange: LaneChangeDetection) {}

func visionSafetyManager(_ visionSafetyManager: VisionSafetyManager, didDetectRunStopSign: RunStopSignDetection) {}
}