3 from nav_msgs.msg
import Odometry
4 import termios, fcntl, sys, os
8 from std_srvs.srv
import Empty
12 twist_topic=
"/uwsim/g500_A/dataNavigator_A" 17 fd = sys.stdin.fileno()
18 oldterm = termios.tcgetattr(fd)
19 newattr = termios.tcgetattr(fd)
20 newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO
21 termios.tcsetattr(fd, termios.TCSANOW, newattr)
22 oldflags = fcntl.fcntl(fd, fcntl.F_GETFL)
23 fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
26 pub = rospy.Publisher(twist_topic, Odometry,queue_size=1)
27 rospy.init_node(
'keyboardCommandOdom_A')
31 while not rospy.is_shutdown():
33 msg.pose.pose.position.x=0.0
34 msg.pose.pose.position.y=0.0
35 msg.pose.pose.position.z=0.0
36 msg.pose.pose.orientation.x=0.0
37 msg.pose.pose.orientation.y=0.0
38 msg.pose.pose.orientation.z=0.0
39 msg.pose.pose.orientation.w=1
48 msg.twist.twist.angular.y=-baseVelocity
50 msg.twist.twist.angular.y=baseVelocity
52 msg.twist.twist.angular.z=baseVelocity
54 msg.twist.twist.angular.z=-baseVelocity
56 msg.twist.twist.linear.x = baseVelocity
58 msg.twist.twist.linear.x = -baseVelocity
60 msg.twist.twist.linear.y = baseVelocity
62 msg.twist.twist.linear.y = -baseVelocity
64 msg.twist.twist.linear.z = baseVelocity
66 msg.twist.twist.linear.z = -baseVelocity
68 print 'wrong key pressed' 79 termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
80 fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)