          curvature = self.vehicle_model.calc_curvature(actuators.steerAngle*3.1415/180., CS.v_ego)
  
          # The use of the toggle below is handy for trying out the various LKAS modes
          if TOGGLE_DEBUG:
            self.lkas_action += int(CS.generic_toggle and not self.generic_toggle_last)
            self.lkas_action &= 0xf
          else:
            self.lkas_action = 5   # 4 and 5 seem the best. 8 and 9 seem to aggressive and laggy
  
          can_sends.append(create_steer_command(self.packer, apply_steer, enabled,
 
</s> remove         curvature = self.vehicle_model.calc_curvature(actuators.steerAngle*3.1415/180., CS.v_ego)
 </s> add         curvature = self.vehicle_model.calc_curvature(actuators.steerAngle*3.1415/180., CS.out.vEgo) </s> remove                                               CS.lkas_state, CS.angle_steers, curvature, self.lkas_action))
        self.generic_toggle_last = CS.generic_toggle
 </s> add                                               CS.lkas_state, CS.out.steeringAngle, curvature, self.lkas_action))
        self.generic_toggle_last = CS.out.genericToggle </s> remove     return ret.as_reader()
 </s> add     self.CS.out = ret.as_reader()

    return self.CS.out </s> remove     self.user_gas = cp.vl["EngineData_14"]['ApedPosScal_Pc_Actl']
    self.brake_pressed = bool(cp.vl["Cruise_Status"]["Brake_Drv_Appl"])
    self.brake_lights = bool(cp.vl["BCM_to_HS_Body"]["Brake_Lights"])
    self.generic_toggle = bool(cp.vl["Steering_Buttons"]["Dist_Incr"])
 </s> add     return ret </s> remove     # speeds
    ret.vEgo = self.CS.v_ego
    ret.vEgoRaw = self.CS.v_ego_raw
    ret.standstill = self.CS.standstill
    ret.wheelSpeeds.fl = self.CS.v_wheel_fl
    ret.wheelSpeeds.fr = self.CS.v_wheel_fr
    ret.wheelSpeeds.rl = self.CS.v_wheel_rl
    ret.wheelSpeeds.rr = self.CS.v_wheel_rr

    # steering wheel
    ret.steeringAngle = self.CS.angle_steers
    ret.steeringPressed = self.CS.steer_override

    # gas pedal
    ret.gas = self.CS.user_gas / 100.
    ret.gasPressed = self.CS.user_gas > 0.0001
    ret.brakePressed = self.CS.brake_pressed
    ret.brakeLights = self.CS.brake_lights

    ret.cruiseState.enabled = not (self.CS.pcm_acc_status in [0, 3])
    ret.cruiseState.speed = self.CS.v_cruise_pcm
    ret.cruiseState.available = self.CS.pcm_acc_status != 0

    ret.genericToggle = self.CS.generic_toggle

 </s> add 
          self.lkas_action += int(CS.out.genericToggle and not self.generic_toggle_last)
          curvature = self.vehicle_model.calc_curvature(actuators.steerAngle*3.1415/180., CS.v_ego)
  
          # The use of the toggle below is handy for trying out the various LKAS modes
          if TOGGLE_DEBUG:
          self.lkas_action += int(CS.out.genericToggle and not self.generic_toggle_last)
            self.lkas_action &= 0xf
          else:
            self.lkas_action = 5   # 4 and 5 seem the best. 8 and 9 seem to aggressive and laggy
  
          can_sends.append(create_steer_command(self.packer, apply_steer, enabled,
keep keep keep keep replace keep keep keep keep keep
 Ford: have carstate update returning capnp struct directly (#1113)

* Before abstraction, adding speed init from VW as well

* strting to abstract carstate class

* fix bug and update lock?

* revert pipfile change

* another bug

* fix linter

* bug fix

* remove a bunch of diplicated kf code

* better to not have class vars. will abstract __init__ anyway later

* abstract common instance vars in carstate init and a generic gear parser static method

* abstract gear parser for chrysler

* abstract gm gear parser too

* remove unnecessary random vars

* Chrysler: carstate returns capnp struct directly

* revert ref commit

* test ref

* WIP

* more WIP

* ops, missed this conflict

* ford as well

* not sure why this got deleted

* no need to copy

* remove copy

* remove copy import

* remove unnecessary intermediate variable

* remove obsolete comments

Co-authored-by: Willem Melching <willem.melching@gmail.com> 
selfdrive/car/ford/carcontroller.py