Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import rospy
- from car_test.msg import Encoder_type
- def talker():
- pub = rospy.Publisher('chatter', Encoder_type, queue_size = 1)
- rospy.init_node('encoder')
- rate = rospy.Rate(30.0)
- while not rospy.is_shutdown():
- state_of_machine = Encoder_type()
- state_of_machine.left_encoder = int(raw_input("Input the encoder's value: "))
- state_of_machine.right_encoder = state_of_machine.left_encoder
- pub.publish(state_of_machine)
- rate.sleep()
- if __name__ == '__main__':
- try:
- talker()
- except rospy.ROSInterruptException:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement