Commit 56803a15 authored by Benoit ZERR's avatar Benoit ZERR
Browse files

update manual control to have it running on Windows

parent ba10a877
......@@ -28,38 +28,65 @@ def turnright():
if __name__ == "__main__":
mybot = dartv2b.DartV2()
getkey = getkey.GetKey()
get_key = getkey.GetKey()
my_system = get_key.system
mybot.sonars.init_4_sonars (dmax=1.5,mode="sync")
while True:
ch = getkey()
ch = get_key()
ich = ord(ch)
if ch != 0:
print (ch,ich,ch==b'b')
#print (ch,ich,ch==b'b')
if ich==27 or ich==3:
break
if ch=="g":
goforward()
elif ch==b"b":
gobackward()
elif ch=="f":
turnleft()
elif ch=="h":
turnright()
elif ch=="1":
ispd=0
elif ch=="2":
ispd=1
elif ch=="3":
ispd=2
elif ch=="4":
idur=0
elif ch=="5":
idur=1
elif ch=="6":
idur=2
elif ch=="7":
idur=3
if my_system == "Windows":
if ch==b"g":
goforward()
elif ch==b"b":
gobackward()
elif ch==b"f":
turnleft()
elif ch==b"h":
turnright()
elif ch==b"1":
ispd=0
elif ch==b"2":
ispd=1
elif ch==b"3":
ispd=2
elif ch==b"4":
idur=0
elif ch==b"5":
idur=1
elif ch==b"6":
idur=2
elif ch==b"7":
idur=3
elif m_system == "Linux":
if ch=="g":
goforward()
elif ch=="b":
gobackward()
elif ch=="f":
turnleft()
elif ch=="h":
turnright()
elif ch=="1":
ispd=0
elif ch=="2":
ispd=1
elif ch=="3":
ispd=2
elif ch=="4":
idur=0
elif ch=="5":
idur=1
elif ch=="6":
idur=2
elif ch=="7":
idur=3
else:
pass
"""
print ("speed go",tspdgo[ispd],"speed turn",tspdturn[ispd],"duration",tdur[idur])
print ("cardinal sonars")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment