10 from actionlib
import *
12 from geometry_msgs.msg
import Pose, PoseWithCovarianceStamped, Point, Quaternion, Twist
13 from asr_flir_ptu_controller.msg
import PTUMovementGoal, PTUMovementAction
17 rospy.init_node(
"ptu_manual_controller_script")
19 rospy.loginfo(
'Trying to communicate with ptu via action msg.')
22 if not client.wait_for_server(rospy.Duration.from_sec(10)):
23 rospy.logwarn(
"Could not connect to ptu action server")
28 visualization_script =
'' 30 opts, args = getopt.getopt(argv,
"v:",[
"visualization="])
32 if opt
in (
"-v",
"--visualization"):
33 visualization_script = arg
34 print 'Using ' + visualization_script +
' for visualization.' 35 except getopt.GetoptError:
36 print 'No visualization script specified.' 39 pan = float(raw_input(
"Pan? "))
40 tilt = float(raw_input(
"Tilt? "))
41 ptu_goal = PTUMovementGoal()
42 ptu_goal.target_joint.header.seq = 0
43 ptu_goal.target_joint.name = [
'pan',
'tilt']
44 ptu_goal.target_joint.velocity = [0, 0]
45 ptu_goal.target_joint.position = [pan, tilt]
46 client.send_goal(ptu_goal)
47 if visualization_script !=
'':
48 subprocess.call(
" python " + visualization_script +
" 1", shell=
True)
52 if __name__ ==
'__main__':
55 except rospy.ROSInterruptException:
pass