Advertisement
Guest User

controller.py

a guest
Jan 22nd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import rospy
  4. from std_msgs.msg import String
  5.  
  6. def controller():
  7. pub = rospy.Publisher('motion_control', String, queue_size=10)
  8. rospy.init_node('controller')
  9. rate = rospy.Rate(10) #10Hz
  10. while not rospy.is_shutdown():
  11. data = raw_input("Command: ")
  12. #print(data)
  13. #hello_str = "Hello world"
  14. rospy.loginfo(data)
  15. pub.publish(data)
  16. rate.sleep()
  17.  
  18. if __name__ == '__main__':
  19. try:
  20. controller()
  21. except rospy.ROSInterruptException:
  22. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement