server_client.py 444 B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. """
  3. Sample code to use with ServiceClient.pde
  4. """
  5. import roslib; roslib.load_manifest("rosserial_arduino")
  6. import rospy
  7. from rosserial_arduino.srv import *
  8. def callback(req):
  9. print "The rt-thread is calling! Please send it a message:"
  10. t = TestResponse()
  11. t.output = raw_input()
  12. return t
  13. rospy.init_node("service_client_test")
  14. rospy.Service("test_srv", Test, callback)
  15. rospy.spin()