rospy.service fail
Now that catkin is building my service files OK, I can't run it. The relevant code section is:
rospy.init_node('servo_cmd_server', log_level=rospy.INFO) rospy.loginfo("Started Phidgets Servo Command Server Node") rospy.sleep(2.0) rospy.loginfo("Setting up the command service") rospy.loginfo("Namespace: %s", rospy.get_namespace()) rospy.loginfo("getname: %s", rospy.get_name()) rospy.loginfo("Resolved name: %s", rospy.resolve_name("PhidgetsServoCommand", caller_id="retractor_ros")) s = rospy.Service('retractor_cmd', _PhidgetsServoCommand, handle_servo_cmd) print 'Ready to receive servo commands!!!.' rospy.spin()
And the relevant output is:
[INFO] [WallTime: 1400781040.063425] Namespace: / [INFO] [WallTime: 1400781040.063572] getname: /servo_cmd_server [INFO] [WallTime: 1400781040.063730] Resolved name: /PhidgetsServoCommand Traceback (most recent call last): File "/home/blake/Projects/Ros/catkin_ws/src/pwm_ros/scripts/pwm_servo.py", line 228, in <module> servo_cmd_server() # start the server (doesn't return) File "/home/blake/Projects/Ros/catkin_ws/src/pwm_ros/scripts/pwm_servo.py", line 73, in servo_cmd_server s = rospy.Service('retractor_cmd', _PhidgetsServoCommand, handle_servo_cmd) File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 696, in __init__ super(Service, self).__init__(name, service_class, handler, buff_size) File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 544, in __init__ super(ServiceImpl, self).__init__(name, service_class) File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/service.py", line 59, in __init__ self.request_class = service_class._request_class AttributeError: 'module' object has no attribute '_request_class'
Any ideas?? BTW, catkin has prefixed the MyName.srv file with an underscore to create _MyName.py . without the underscore, you get:
[INFO] [WallTime: 1400781520.326304] Namespace: / [INFO] [WallTime: 1400781520.326438] getname: /servo_cmd_server [INFO] [WallTime: 1400781520.326581] Resolved name: /PhidgetsServoCommand Traceback (most recent call last): File "/home/blake/Projects/Ros/catkin_ws/src/pwm_ros/scripts/pwm_servo.py", line 228, in <module> servo_cmd_server() # start the server (doesn't return) File "/home/blake/Projects/Ros/catkin_ws/src/pwm_ros/scripts/pwm_servo.py", line 73, in servo_cmd_server s = rospy.Service('retractor_cmd', PhidgetsServoCommand, handle_servo_cmd) NameError: global name 'PhidgetsServoCommand' is not defined
Thanks!