Exemple #1
0
    def __init__(self, CP):

        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        self.shifter_values = self.can_define.dv["GEAR_PACKET"]['GEAR']
        self.left_blinker_on = 0
        self.right_blinker_on = 0
        self.angle_offset = 0.
        self.init_angle_offset = False

        self.acc_slow_on = False
        self.pcm_acc_status = False
        self.setspeedoffset = 34.0
        self.Angles = np.zeros(250)
        self.Angles_later = np.zeros(250)
        self.Angle_counter = 0
        self.Angle = [0, 5, 10, 15, 20, 25, 30, 35, 60, 100, 180, 270, 500]
        self.Angle_Speed = [
            255, 160, 100, 80, 70, 60, 55, 50, 40, 33, 27, 17, 12
        ]
        if BASEDIR == "/data/openpilot" or BASEDIR == "/data/openpilot.arne182":
            self.traffic_data_sock = messaging.pub_sock(
                service_list['liveTrafficData'].port)
        # initialize can parser
        self.car_fingerprint = CP.carFingerprint

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = KF1D(x0=[[0.0], [0.0]],
                             A=[[1.0, dt], [0.0, 1.0]],
                             C=[1.0, 0.0],
                             K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0
Exemple #2
0
    def __init__(self, CP):
        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        self.shifter_values = self.can_define.dv["GEARBOX"]["GEAR_SHIFTER"]

        self.user_gas, self.user_gas_pressed = 0., 0
        self.brake_switch_prev = 0
        self.brake_switch_ts = 0

        self.cruise_buttons = 0
        self.cruise_setting = 0
        self.v_cruise_pcm_prev = 0
        self.blinker_on = 0

        self.left_blinker_on = 0
        self.right_blinker_on = 0

        self.stopped = 0

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = KF1D(x0=[[0.0], [0.0]],
                             A=[[1.0, dt], [0.0, 1.0]],
                             C=[1.0, 0.0],
                             K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0
Exemple #3
0
    def __init__(self, CP):

        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        print("DBC PARSED: %s" % DBC[CP.carFingerprint]['pt'])
        self.shifter_values = 'D'  #self.can_define.dv["GEAR_PACKET"]['GEAR']

        self.ENGAGED = False
        self.UDP_IP = "192.168.200.20"
        self.UDP_PORT = 5005

        self.sock = socket.socket(
            socket.AF_INET,  # Internet
            socket.SOCK_DGRAM)  # UDP
        self.sock.bind((self.UDP_IP, self.UDP_PORT))

        # initialize can parser
        self.car_fingerprint = CP.carFingerprint

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = KF1D(x0=[[0.0], [0.0]],
                             A=[[1.0, dt], [0.0, 1.0]],
                             C=[1.0, 0.0],
                             K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0
        self.pcm_acc_status = 0
        self.pcm_acc_active = False
Exemple #4
0
    def __init__(self, CP):

        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        self.shifter_values = self.can_define.dv["GEAR_PACKET"]['GEAR']
        self.left_blinker_on = 0
        self.right_blinker_on = 0
        self.angle_offset = 0.
        self.init_angle_offset = False

        self.distance_toggle_prev = 2
        self.read_distance_lines_prev = 3
        self.lane_departure_toggle_on_prev = True
        self.lane_departure_toggle_on = False
        self.cstm_btns_tr = 0

        # initialize can parser
        self.car_fingerprint = CP.carFingerprint

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = KF1D(x0=[[0.0], [0.0]],
                             A=[[1.0, dt], [0.0, 1.0]],
                             C=[1.0, 0.0],
                             K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0
Exemple #5
0
    def __init__(self, CP, canbus):
        # initialize can parser
        self.CP = CP
        self.car_fingerprint = CP.carFingerprint
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])

        self.shifter_values = self.can_define.dv["Getriebe_11"]['GE_Fahrstufe']

        self.buttonStates = BUTTON_STATES.copy()

        # vEgo Kalman filter
        dt = 0.01
        self.v_ego_kf = KF1D(x0=[[0.], [0.]],
                             A=[[1., dt], [0., 1.]],
                             C=[1., 0.],
                             K=[[0.12287673], [0.29666309]])
Exemple #6
0
    def __init__(self, CP):
        #self.kegman = kegman_conf()
        #self.trMode = int(self.kegman.conf['lastTrMode'])     # default to last distance interval on startup
        #self.trMode = 1
        self.lkMode = True
        self.read_distance_lines_prev = 4
        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        self.shifter_values = self.can_define.dv["GEARBOX"]["GEAR_SHIFTER"]
        self.brake_pressed = 0

        self.user_gas, self.user_gas_pressed = 0., 0
        self.brake_switch_prev = 0
        self.brake_switch_ts = 0
        self.lead_distance = 255
        self.hud_lead = 0

        self.cruise_buttons = 0
        self.cruise_setting = 0
        self.v_cruise_pcm_prev = 0
        self.blinker_on = 0
        self.lead_distance = 255
        self.prev_steering_counter = 0
        self.steer_data_reused = 0
        self.steer_good_count = 0
        self.steer_data_skipped = 0
        self.left_blinker_on = 0
        self.right_blinker_on = 0
        self.cruise_mode = 0
        self.steer_advance = 0.

        self.stopped = 0

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = 0  #KF1D(x0=[[0.0], [0.0]],
        #   A=[[1.0, dt], [0.0, 1.0]],
        #   C=[1.0, 0.0],
        #   K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0
Exemple #7
0
    def __init__(self, CP):

        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        self.shifter_values = self.can_define.dv["GEAR_PACKET"]['GEAR']
        self.left_blinker_on = 0
        self.right_blinker_on = 0

        # initialize can parser
        self.car_fingerprint = CP.carFingerprint

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = KF1D(x0=[[0.0], [0.0]],
                             A=[[1.0, dt], [0.0, 1.0]],
                             C=[1.0, 0.0],
                             K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0
Exemple #8
0
    def __init__(self, CP):
        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        self.shifter_values = self.can_define.dv["GEARBOX"]["GEAR_SHIFTER"]
        self.steer_status_values = defaultdict(
            lambda: "UNKNOWN",
            self.can_define.dv["STEER_STATUS"]["STEER_STATUS"])

        self.user_gas, self.user_gas_pressed = 0., 0
        self.brake_switch_prev = 0
        self.brake_switch_ts = 0

        self.cruise_buttons = 0
        self.cruise_setting = 0
        self.v_cruise_pcm_prev = 0
        self.blinker_on = 0

        self.left_blinker_on = 0
        self.right_blinker_on = 0

        self.cruise_mode = 0
        self.stopped = 0

        ### START OF MAIN CONFIG OPTIONS ###
        ### Do NOT modify here, modify in /data/honda_openpilot.cfg and reboot
        self.useTeslaRadar = False
        self.radarVIN = "                 "
        self.radarOffset = 0
        #read config file
        read_config_file(self)
        ### END OF MAIN CONFIG OPTIONS ###

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = KF1D(x0=[[0.0], [0.0]],
                             A=[[1.0, dt], [0.0, 1.0]],
                             C=[1.0, 0.0],
                             K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0
Exemple #9
0
    def __init__(self, CP):
        #labels for buttons
        self.btns_init = [["alca","ALC",["MadMax","Normal","Wifey"]], \
                          ["","",[""]], \
                          ["","",[""]], \
                          ["sound","SND",[""]], \
                          ["", "",[""]], \
                          ["", "", [""]]]
        #if (CP.carFingerprint == CAR.MODELS):
        # ALCA PARAMS
        # max REAL delta angle for correction vs actuator
        self.CL_MAX_ANGLE_DELTA_BP = [10., 44.]
        self.CL_MAX_ANGLE_DELTA = [1.8, .3]

        # adjustment factor for merging steer angle to actuator; should be over 4; the higher the smoother
        self.CL_ADJUST_FACTOR_BP = [10., 44.]
        self.CL_ADJUST_FACTOR = [16., 8.]

        # reenrey angle when to let go
        self.CL_REENTRY_ANGLE_BP = [10., 44.]
        self.CL_REENTRY_ANGLE = [5., 5.]

        # a jump in angle above the CL_LANE_DETECT_FACTOR means we crossed the line
        self.CL_LANE_DETECT_BP = [10., 44.]
        self.CL_LANE_DETECT_FACTOR = [1.5, 1.5]

        self.CL_LANE_PASS_BP = [10., 20., 44.]
        self.CL_LANE_PASS_TIME = [40., 10., 3.]

        # change lane delta angles and other params
        self.CL_MAXD_BP = [10., 32., 44.]
        self.CL_MAXD_A = [
            .358, 0.084, 0.042
        ]  #delta angle based on speed; needs fine tune, based on Tesla steer ratio of 16.75

        self.CL_MIN_V = 8.9  # do not turn if speed less than x m/2; 20 mph = 8.9 m/s

        # do not turn if actuator wants more than x deg for going straight; this should be interp based on speed
        self.CL_MAX_A_BP = [10., 44.]
        self.CL_MAX_A = [10., 10.]

        # define limits for angle change every 0.1 s
        # we need to force correction above 10 deg but less than 20
        # anything more means we are going to steep or not enough in a turn
        self.CL_MAX_ACTUATOR_DELTA = 2.
        self.CL_MIN_ACTUATOR_DELTA = 0.
        self.CL_CORRECTION_FACTOR = 1.

        #duration after we cross the line until we release is a factor of speed
        self.CL_TIMEA_BP = [10., 32., 44.]
        self.CL_TIMEA_T = [0.7, 0.30, 0.20]

        #duration to wait (in seconds) with blinkers on before starting to turn
        self.CL_WAIT_BEFORE_START = 1
        #END OF ALCA PARAMS

        self.CP = CP
        self.can_define = CANDefine(DBC[CP.carFingerprint]['pt'])
        self.shifter_values = self.can_define.dv["GEAR_PACKET"]['GEAR']
        self.left_blinker_on = 0
        self.right_blinker_on = 0
        self.angle_offset = 0.
        self.init_angle_offset = False

        # initialize can parser
        self.car_fingerprint = CP.carFingerprint

        # vEgo kalman filter
        dt = 0.01
        # Q = np.matrix([[10.0, 0.0], [0.0, 100.0]])
        # R = 1e3
        self.v_ego_kf = KF1D(x0=[[0.0], [0.0]],
                             A=[[1.0, dt], [0.0, 1.0]],
                             C=[1.0, 0.0],
                             K=[[0.12287673], [0.29666309]])
        self.v_ego = 0.0