Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import rospy
  3. from std_msgs.msg import String
  4. from geometry_msgs.msg import Twist
  5.  
  6. #def getKey():
  7. # tty.setraw(sys.stdin.fileno())
  8. # select.select([sys.stdin], [], [], 0)
  9. # key = sys.stdin.read(1)
  10. #termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings)
  11. #return key
  12.  
  13.  
  14. def talker():
  15. pub = rospy.Publisher('chatter', Twist, queue_size=10)
  16. rospy.init_node('talker', anonymous=True)
  17. rate = rospy.Rate(10) # 10hz
  18. while not rospy.is_shutdown():
  19. msg = Twist()
  20. msg.linear.x = 2
  21. msg.linear.y = 0
  22. msg.linear.z = 0
  23. sg.angular.x = 0
  24. msg.angular.y = 0
  25. msg.angular.z = 0
  26. #key = getkey()
  27. rospy.loginfo(key)
  28. pub.publish(msg)
  29. rate.sleep()
  30.  
  31. if __name__ == '__main__':
  32. try:
  33. talker()
  34. except rospy.ROSInterruptException:
  35. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement