inputs steering throttle and brake do not become global when declared global it seems. they do not update when printed in a list
from inputs import get_gamepad global steeringout global throttleout global brakeout while True: events = get_gamepad() for event in events:
if event.code == 'ABS_X':
steering = event.state
steeringin = 50+(50*steering/32767)
steeringout = round(steeringin)
print(steeringout)
if event.code == 'ABS_RZ':
throttle = event.state
throttlein = 50+(50*throttle/255)
throttleout = round(throttlein)
print(throttleout)
if event.code == 'ABS_Z':
brake = event.state
brakein = 50-(50*brake/255)
brakeout = round(brakein)
print(brakeout)
controller = [steeringout, throttleout, brakeout] print(controller)
i would like to print steering, throttle, brake using controller variable
Aucun commentaire:
Enregistrer un commentaire