Neue Version
This commit is contained in:
parent
4d9a3eaa93
commit
66a87dd140
55
robot.py
Normal file → Executable file
55
robot.py
Normal file → Executable file
@ -24,6 +24,7 @@ robot2 = Kran(40, 38, 37, 36, 35, 33, 32, 31)
|
||||
|
||||
dev = InputDevice('/dev/input/event0')
|
||||
|
||||
print("waiting for inputs")
|
||||
def robot1func(event1):
|
||||
|
||||
# handgelenk on
|
||||
@ -31,7 +32,7 @@ def robot1func(event1):
|
||||
|
||||
if event1.code == 25:
|
||||
robot1.move("H", 1)
|
||||
print(event.code,"H")
|
||||
print(event1.code,"H")
|
||||
return 1
|
||||
|
||||
# handgelenk off
|
||||
@ -39,15 +40,15 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 39:
|
||||
robot1.move("H", 2)
|
||||
print(event.code,"H"
|
||||
) return 1
|
||||
print(event1.code,"H")
|
||||
return 1
|
||||
|
||||
# ellenbogen on
|
||||
# taste ü
|
||||
|
||||
elif event1.code == 26:
|
||||
robot1.move("E", 1)
|
||||
print(event.code,"E")
|
||||
print(event1.code,"E")
|
||||
return 1
|
||||
|
||||
# ellenbogen off
|
||||
@ -55,7 +56,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 40:
|
||||
robot1.move("E", 2)
|
||||
print(event.code,"E")
|
||||
print(event1.code,"E")
|
||||
return 1
|
||||
|
||||
# armgelenk on
|
||||
@ -63,7 +64,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 27:
|
||||
robot1.move("A", 1)
|
||||
print(event.code,"A")
|
||||
print(event1.code,"A")
|
||||
return 1
|
||||
|
||||
# armgelenk off
|
||||
@ -71,7 +72,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 43:
|
||||
robot1.move("A", 2)
|
||||
print(event.code,"A")
|
||||
print(event1.code,"A")
|
||||
return 1
|
||||
|
||||
# basis off
|
||||
@ -79,7 +80,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 52:
|
||||
robot1.move("B", 2)
|
||||
print(event.code,"B")
|
||||
print(event1.code,"B")
|
||||
return 1
|
||||
|
||||
# basis on
|
||||
@ -87,7 +88,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 53:
|
||||
robot1.move("B", 1)
|
||||
print(event.code,"B")
|
||||
print(event1.code,"B")
|
||||
return 1
|
||||
|
||||
# greifer off
|
||||
@ -95,7 +96,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 24:
|
||||
robot1.move("G", 2)
|
||||
print(event.code,"G")
|
||||
print(event1.code,"G")
|
||||
return 1
|
||||
|
||||
# greifer on
|
||||
@ -103,7 +104,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 38:
|
||||
robot1.move("G", 1)
|
||||
print(event.code,"G")
|
||||
print(event1.code,"G")
|
||||
return 1
|
||||
|
||||
# licht on
|
||||
@ -111,7 +112,7 @@ def robot1func(event1):
|
||||
|
||||
elif event1.code == 51:
|
||||
robot1.move("L", 1)
|
||||
print(event.code,"L")
|
||||
print(event1.code,"L")
|
||||
return 1
|
||||
|
||||
# taste m
|
||||
@ -119,7 +120,7 @@ def robot1func(event1):
|
||||
elif event1.code == 50:
|
||||
robot1.cleanup()
|
||||
robot2.cleanup()
|
||||
print(event.code,"cleanup")
|
||||
print(event1.code,"cleanup")
|
||||
return 1
|
||||
|
||||
|
||||
@ -130,7 +131,7 @@ def robot2func(event2):
|
||||
|
||||
if event2.code == 17:
|
||||
robot2.move("H", 1)
|
||||
print(event.code,"H")
|
||||
print(event2.code,"H")
|
||||
return 1
|
||||
|
||||
# handgelenk off
|
||||
@ -138,7 +139,7 @@ def robot2func(event2):
|
||||
|
||||
if event2.code == 31:
|
||||
robot2.move("H", 2)
|
||||
print(event.code,"H")
|
||||
print(event2.code,"H")
|
||||
return 1
|
||||
|
||||
# ellenbogen on
|
||||
@ -146,14 +147,14 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 18:
|
||||
robot2.move("E", 1)
|
||||
print(event.code,"E")
|
||||
print(event2.code,"E")
|
||||
return 1
|
||||
|
||||
# ellenbogen off
|
||||
# taste d
|
||||
elif event2.code == 32:
|
||||
robot2.move("E", 2)
|
||||
print(event.code,"E")
|
||||
print(event2.code,"E")
|
||||
return 1
|
||||
|
||||
# arm on
|
||||
@ -161,7 +162,7 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 19:
|
||||
robot2.move("A", 1)
|
||||
print(event.code,"A")
|
||||
print(event2.code,"A")
|
||||
return 1
|
||||
|
||||
# arm off
|
||||
@ -169,7 +170,7 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 33:
|
||||
robot2.move("A", 2)
|
||||
print(event.code,"A")
|
||||
print(event2.code,"A")
|
||||
return 1
|
||||
|
||||
# basis off
|
||||
@ -177,7 +178,7 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 45:
|
||||
robot2.move("B", 2)
|
||||
print(event.code,"B")
|
||||
print(event2.code,"B")
|
||||
return 1
|
||||
|
||||
# basis on
|
||||
@ -185,7 +186,7 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 46:
|
||||
robot2.move("B", 1)
|
||||
print(event.code,"B")
|
||||
print(event2.code,"B")
|
||||
return 1
|
||||
|
||||
# greifer off
|
||||
@ -193,7 +194,7 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 16:
|
||||
robot2.move("G", 2)
|
||||
print(event.code,"G")
|
||||
print(event2.code,"G")
|
||||
return 1
|
||||
|
||||
# greifer on
|
||||
@ -201,7 +202,7 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 30:
|
||||
robot2.move("G", 1)
|
||||
print(event.code,"G")
|
||||
print(event2.code,"G")
|
||||
return 1
|
||||
|
||||
# licht on
|
||||
@ -209,14 +210,14 @@ def robot2func(event2):
|
||||
|
||||
elif event2.code == 44:
|
||||
robot2.move("L", 1)
|
||||
print(event.code,"L")
|
||||
print(event2.code,"L")
|
||||
return 1
|
||||
|
||||
# taste v
|
||||
|
||||
elif event2.code == 47:
|
||||
robot2.cleanup()
|
||||
print(event.code,"cleanup")
|
||||
print(event2.code,"cleanup")
|
||||
return 1
|
||||
|
||||
|
||||
@ -231,10 +232,14 @@ def runInParallel(*fns):
|
||||
|
||||
|
||||
def manuell():
|
||||
print("manuell")
|
||||
flag1 = 0
|
||||
flag2 = 0
|
||||
for event in dev.read_loop():
|
||||
print("reading events")
|
||||
#time.sleep
|
||||
if event.type == ecodes.EV_KEY:
|
||||
print("ev_key detected")
|
||||
if event.value == 1:
|
||||
if flag1 == 0:
|
||||
flag1 = robot1func(event)
|
||||
|
Loading…
Reference in New Issue
Block a user