Skip to content

Commit

Permalink
added a script to manually request the topics fro the arm or other si…
Browse files Browse the repository at this point in the history
…mple communication
  • Loading branch information
ulrichard committed Jan 21, 2012
1 parent 3164671 commit 8833a38
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions ros/uc_arm/request_topics.py
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 ---'




0 comments on commit 8833a38

Please sign in to comment.