-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a script to manually request the topics fro the arm or other si…
…mple communication
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/python | ||
from serial import * | ||
import time | ||
import sys | ||
import termios | ||
|
||
def output_data(filedev, ignore = '\r'): | ||
'''Outputs data from serial port to sys.stdout.''' | ||
|
||
while True: | ||
byte = filedev.read(1) | ||
if not byte: | ||
break | ||
if byte in ignore: continue | ||
sys.stdout.write(byte) | ||
|
||
if __name__ == "__main__": | ||
# Open device with RTS pin low | ||
port = Serial('/dev/ttyUSB0', 38400, timeout=0.5) | ||
|
||
# reset the robot arm | ||
port.setRTS(True) | ||
time.sleep(0.3) | ||
port.setRTS(False) | ||
|
||
port.flushInput() | ||
port.write("\xff\xff\x00\x00\x00\x00\xff") | ||
|
||
try: | ||
while 1 : | ||
x = port.read(1) | ||
sys.stdout.write(x) | ||
|
||
except KeyboardInterrupt: | ||
print 'Keyboard interrupt, closing.' | ||
|
||
port.close() | ||
print '--- Done ---' | ||
|
||
|
||
|
||
|