control_laser.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 PKG = "pr2_mechanism_controllers"
4 
5 import roslib; roslib.load_manifest(PKG)
6 
7 import sys
8 import os
9 import string
10 
11 import rospy
12 from std_msgs import *
13 
15 
16 def print_usage(exit_code = 0):
17  print '''Usage:
18  control.py <controller> sine <period> <amplitude> <offset>
19  - Defines a sine sweep for the laser controller
20 '''
21  sys.exit(exit_code)
22 
23 if __name__ == '__main__':
24  if len(sys.argv) < 6:
25  print_usage()
26  if sys.argv[2] == 'sine' :
27  profile_type = 4 # Implies a sine sweep
28  controller = sys.argv[1]
29  period = float (sys.argv[3])
30  amplitude = float (sys.argv[4])
31  offset = float (sys.argv[5])
32 
33  print 'Sending Command: '
34  print ' Profile Type: Sine'
35  print ' Period: %f Seconds' % period
36  print ' Amplitude: %f Radians' % amplitude
37  print ' Offset: %f Radians' % offset
38 
39  rospy.wait_for_service(controller + '/set_profile')
40  s = rospy.ServiceProxy(controller + '/set_profile', SetProfile)
41  resp = s.call(SetProfileRequest(0.0, 0.0, 0.0, 0.0, profile_type, period, amplitude, offset))
42 
43  print 'Command Sent'
44  print ' Response: %s' % str(resp.time)
45  else :
46  print 'Unknown profile type [%s]' % sys.argv[2]
47 
def print_usage(exit_code=0)


pr2_mechanism_controllers
Author(s): Sachin Chita, John Hsu, Melonee Wise
autogenerated on Mon Jun 10 2019 14:26:33