Beispiel #1
0
def on_gear_shift(gear):
    send_data("gear_lever_position", gear)


g27 = Wheel()

g27.register_steering_wheel(on_angle)
g27.register_pedal(g27.config.ACCELERATOR, on_accelerator)
g27.register_pedal(g27.config.BRAKE, on_brake)
g27.register_pedal(g27.config.CLUTCH, on_clutch)
g27.register_button(g27.config.IGNITION, on_ignition)
g27.register_button(g27.config.PARKING_BRAKE, on_parking_brake)
g27.register_button(g27.config.HEADLAMP, on_headlamp)
g27.register_button(g27.config.HIGH_BEAM, on_high_beam)
g27.register_button(g27.config.WINDSHIELD_WIPER, on_windshied_wiper)
g27.register_gear_shift(on_gear_shift)

try:

    if not is_simulator_running(HOST):
        HOST = None
    else:
        print "Found car on", HOST

    g27.loop()

except Exception as e:
    print e
    print traceback.format_exc()
Beispiel #2
0
def on_windshied_wiper(val):
  send_data(button_names[g27.config.WINDSHIELD_WIPER], str(val).lower())
def on_gear_shift(gear):
  send_data("gear_lever_position", gear)

g27 = Wheel()

g27.register_steering_wheel(on_angle)
g27.register_pedal(g27.config.ACCELERATOR, on_accelerator)
g27.register_pedal(g27.config.BRAKE, on_brake)
g27.register_pedal(g27.config.CLUTCH, on_clutch)
g27.register_button(g27.config.IGNITION, on_ignition)
g27.register_button(g27.config.PARKING_BRAKE, on_parking_brake)
g27.register_button(g27.config.HEADLAMP, on_headlamp)
g27.register_button(g27.config.HIGH_BEAM, on_high_beam)
g27.register_button(g27.config.WINDSHIELD_WIPER, on_windshied_wiper)
g27.register_gear_shift(on_gear_shift)

try: 

  if not is_simulator_running(HOST):
    HOST = None
  else:
    print "Found car on", HOST 

  g27.loop()
  
except Exception as e:
  print e
  print traceback.format_exc()
Beispiel #3
0
    send_data("gear_lever_position", gear)


wheel_o = Wheel()

if wheel_o.wheel_found():
    wheel_cfg = wheel_o.get_wheel_config()
    wheel_o.register_steering_wheel(on_angle)
    wheel_o.register_pedal(wheel_cfg["ACCELERATOR"], on_accelerator)
    wheel_o.register_pedal(wheel_cfg["BRAKE"], on_brake)
    wheel_o.register_pedal(wheel_cfg["CLUTCH"], on_clutch)
    wheel_o.register_button(wheel_cfg["IGNITION"], on_ignition)
    wheel_o.register_button(wheel_cfg["PARKING_BRAKE"], on_parking_brake)
    wheel_o.register_button(wheel_cfg["HEADLAMP"], on_headlamp)
    wheel_o.register_button(wheel_cfg["HIGH_BEAM"], on_high_beam)
    wheel_o.register_button(wheel_cfg["WINDSHIELD_WIPER"], on_windshied_wiper)
    wheel_o.register_gear_shift(on_gear_shift)

    try:

        if not is_simulator_running(HOST):
            HOST = None
        else:
            print("Found car on", HOST)

        wheel_o.loop()

    except Exception as e:
        print(e)
        print(traceback.format_exc())