Skip to content

Commit

Permalink
Merge pull request #11 from MatthijsBurgh/patch-1
Browse files Browse the repository at this point in the history
Correct exception handling; Python3 print compatible
  • Loading branch information
trainman419 authored May 2, 2018
2 parents 735fe40 + 9018d61 commit d2ddfbe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions teleop_twist_keyboard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env python

from __future__ import print_function

import roslib; roslib.load_manifest('teleop_twist_keyboard')
import rospy

Expand Down Expand Up @@ -88,8 +91,8 @@ def vels(speed,turn):
status = 0

try:
print msg
print vels(speed,turn)
print(msg)
print(vels(speed,turn))
while(1):
key = getKey()
if key in moveBindings.keys():
Expand All @@ -101,9 +104,9 @@ def vels(speed,turn):
speed = speed * speedBindings[key][0]
turn = turn * speedBindings[key][1]

print vels(speed,turn)
print(vels(speed,turn))
if (status == 14):
print msg
print(msg)
status = (status + 1) % 15
else:
x = 0
Expand All @@ -118,8 +121,8 @@ def vels(speed,turn):
twist.angular.x = 0; twist.angular.y = 0; twist.angular.z = th*turn
pub.publish(twist)

except:
print e
except Exception as e:
print(e)

finally:
twist = Twist()
Expand Down

0 comments on commit d2ddfbe

Please sign in to comment.