mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-23 06:52:07 +08:00
e323b8ef0e
======================== * Based on latest openpilot 0.7.6.1 devel. * Optimized and integrated several dp services. (Settings have been renamed, please re-config all settings) * Completely disabled steer ratio learner. * Removed Accel Profile. * Added Honda Breeze Hybrid FPv1. (Thanks to @劉駿) * Added Taiwan Toyota Prius 4.5 FPv1. (Thanks to @jeekid)
29 lines
909 B
Python
29 lines
909 B
Python
#!/usr/bin/env python3.7
|
|
import subprocess
|
|
from cereal import car
|
|
from common.params import Params
|
|
params = Params()
|
|
|
|
def is_online():
|
|
try:
|
|
return not subprocess.call(["ping", "-W", "4", "-c", "1", "117.28.245.92"])
|
|
except ProcessLookupError:
|
|
return False
|
|
|
|
def common_controller_ctrl(enabled, dragon_lat_ctrl, dragon_enable_steering_on_signal, blinker_on, steer_req):
|
|
if enabled:
|
|
if (dragon_enable_steering_on_signal and blinker_on) or not dragon_lat_ctrl:
|
|
steer_req = 0 if isinstance(steer_req, int) else False
|
|
return steer_req
|
|
|
|
def common_interface_atl(ret, atl):
|
|
# dp
|
|
enable_acc = ret.cruiseState.enabled
|
|
if atl and ret.cruiseState.available:
|
|
enable_acc = True
|
|
if ret.gearShifter in [car.CarState.GearShifter.reverse, car.CarState.GearShifter.park]:
|
|
enable_acc = False
|
|
if ret.seatbeltUnlatched or ret.doorOpen:
|
|
enable_acc = False
|
|
return enable_acc
|