Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Benoit ZERR
dartv2_nom1_nom2_nom3
Commits
ba10a877
Commit
ba10a877
authored
Nov 10, 2021
by
Benoit ZERR
Browse files
porting on windows 10
parent
fdcd5744
Changes
12
Hide whitespace changes
Inline
Side-by-side
py/__pycache__/dartv2b.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
py/__pycache__/getkey.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
py/drivers/__pycache__/dartv2b_basis.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
py/drivers/__pycache__/encoders.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
py/drivers/__pycache__/imu9.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
py/drivers/__pycache__/sonars.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
py/drivers/__pycache__/trex.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
py/getkey.py
View file @
ba10a877
class
GetKey
:
def
__init__
(
self
):
import
tty
,
sys
,
termios
# import termios now or else you'll get the Unix version on the Mac
import
platform
self
.
system
=
"Linux"
if
platform
.
system
()
==
"Windows"
:
self
.
system
=
"Windows"
if
self
.
system
==
"Windows"
:
import
msvcrt
# no termios neither tty on Windows10 , use msvcrt instead
elif
self
.
system
==
"Linux"
:
import
tty
,
sys
,
termios
# import termios and sys not tesetd on MacOs
def
__call__
(
self
):
import
sys
,
tty
,
termios
fd
=
sys
.
stdin
.
fileno
()
old_settings
=
termios
.
tcgetattr
(
fd
)
try
:
tty
.
setraw
(
sys
.
stdin
.
fileno
())
ch
=
sys
.
stdin
.
read
(
1
)
finally
:
termios
.
tcsetattr
(
fd
,
termios
.
TCSADRAIN
,
old_settings
)
if
self
.
system
==
"Windows"
:
import
msvcrt
ch
=
chr
(
0
)
if
msvcrt
.
kbhit
():
ch
=
msvcrt
.
getch
()
if
self
.
system
==
"Linux"
:
import
tty
,
sys
,
termios
fd
=
sys
.
stdin
.
fileno
()
old_settings
=
termios
.
tcgetattr
(
fd
)
try
:
tty
.
setraw
(
sys
.
stdin
.
fileno
())
ch
=
sys
.
stdin
.
read
(
1
)
finally
:
termios
.
tcsetattr
(
fd
,
termios
.
TCSADRAIN
,
old_settings
)
return
ch
if
__name__
==
"__main__"
:
import
time
getkey
=
GetKey
()
while
True
:
...
...
@@ -21,7 +34,8 @@ if __name__ == "__main__":
ich
=
ord
(
ch
)
if
ich
>=
32
:
print
(
ch
,
ich
,
"%2.2X"
%
(
ich
))
el
se
:
el
if
ich
>
0
:
print
(
ich
,
"%2.2X"
%
(
ich
))
if
ich
==
27
or
ich
==
3
:
# 3 = CTRL+C
break
time
.
sleep
(
0.05
)
py/manual_control.py
View file @
ba10a877
...
...
@@ -34,39 +34,44 @@ if __name__ == "__main__":
while
True
:
ch
=
getkey
()
ich
=
ord
(
ch
)
if
ich
==
27
or
ich
==
3
:
break
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
print
(
"speed go"
,
tspdgo
[
ispd
],
"speed turn"
,
tspdturn
[
ispd
],
"duration"
,
tdur
[
idur
])
print
(
"cardinal sonars"
)
print
(
mybot
.
get_cardinal_sonars
())
print
(
"diagonal sonars"
)
print
(
mybot
.
get_diagonal_sonars
())
print
(
"front odometers"
)
print
(
mybot
.
get_front_odos
())
print
(
"rear odometers"
)
print
(
mybot
.
get_rear_odos
())
if
ch
!=
0
:
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
"""
print ("speed go",tspdgo[ispd],"speed turn",tspdturn[ispd],"duration",tdur[idur])
print ("cardinal sonars")
print (mybot.get_cardinal_sonars())
print ("diagonal sonars")
print (mybot.get_diagonal_sonars())
print ("front odometers")
print (mybot.get_front_odos())
print ("rear odometers")
print (mybot.get_rear_odos())
"""
time
.
sleep
(
0.05
)
mybot
.
end
()
# clean end of the robot mission
vDartV2/__pycache__/i2csim.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
vDartV2/__pycache__/vSimVar.cpython-39.pyc
0 → 100644
View file @
ba10a877
File added
vDartV2/vSimVar.py
View file @
ba10a877
...
...
@@ -9,7 +9,7 @@ tSimVar={"vSimTime" : 0.0,
"vMagX"
:
0.0
,
"vMagY"
:
0.0
,
"vMagZ"
:
0.0
,
"vDoLog"
:
1
.0
,
"vDoLog"
:
0
.0
,
# vDoLog = 0.0 because of sometimes permission error occurs when creating log file in Windows
"vCmdSpeedLeft"
:
0.0
,
"vCmdSpeedRight"
:
0.0
,
"vCmdSpeedNew"
:
0.0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment