50 lines
1.1 KiB
Python
Executable File
50 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import sys, time
|
|
import carcomm
|
|
|
|
if __name__ == "__main__":
|
|
|
|
try:
|
|
# voorlopig vast
|
|
port = "/dev/ttyUSB0"
|
|
baudrate = 28800
|
|
parity = 'N'
|
|
rtscts = False
|
|
xonxoff = False
|
|
echo = False
|
|
convert_outgoing = carcomm.CONVERT_CRLF
|
|
repr_mode = 0
|
|
|
|
carcon = carcomm.CarControl(
|
|
port,
|
|
baudrate,
|
|
parity,
|
|
rtscts,
|
|
xonxoff,
|
|
echo,
|
|
convert_outgoing,
|
|
repr_mode,
|
|
)
|
|
time.sleep(2) # de nexus robot is niet zo snel..
|
|
carcon.sendpacket(20,0)
|
|
carcon.getinfopacket()
|
|
|
|
for x in range(0, 200):
|
|
carcon.setspeed( 2.5, 0.0)
|
|
# carcon.getinfopacket()
|
|
time.sleep(0.05)
|
|
carcon.setspeed( 2.5, 0.0)
|
|
# carcon.getinfopacket()
|
|
time.sleep(0.05)
|
|
carcon.setspeed( 0, 0)
|
|
|
|
except carcomm.serial.SerialException as e:
|
|
sys.stderr.write("could not open port %r: %s\n" % (port, e))
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|