Advertisement
Guest User

No

a guest
Apr 26th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import rospy
  3. from car_test.msg import Encoder_type
  4.  
  5. def talker():
  6. pub = rospy.Publisher('chatter', Encoder_type, queue_size = 1)
  7. rospy.init_node('encoder')
  8. rate = rospy.Rate(30.0)
  9. while not rospy.is_shutdown():
  10. state_of_machine = Encoder_type()
  11. state_of_machine.left_encoder = int(raw_input("Input the encoder's value: "))
  12. state_of_machine.right_encoder = state_of_machine.left_encoder
  13. pub.publish(state_of_machine)
  14. rate.sleep()
  15.  
  16.  
  17. if __name__ == '__main__':
  18. try:
  19. talker()
  20. except rospy.ROSInterruptException:
  21. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement