test.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 '''
4 Copyright (c) 2016, Aumann Florian, Borella Jocelyn, Karrenbauer Oliver, Meissner Pascal, Trautmann Jeremias
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8 
9 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10 
11 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 
13 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 '''
17 
18 import roslib
19 import rospy
20 import json
21 import random
22 import shutil
23 import csv
24 import time
25 import tf
26 import numpy
27 
28 from actionlib import *
29 from actionlib.msg import *
30 import sensor_msgs.msg
31 import math
32 import signal
33 import subprocess
34 from asr_direct_search_manager.msg import asr_direct_search_manager
35 import geometry_msgs.msg
36 
37 if __name__ == '__main__':
38  # register closing callback
39  try:
40  rospy.init_node('test_asr_direct_search_manager')
41  remainingRobotPoses = 10
42  while remainingRobotPoses > 0 :
43  rospy.loginfo('GetGoalCameraPose action server call')
44  client = actionlib.SimpleActionClient('asr_direct_search_manager', asr_direct_search_manager.msg.directSearchAction)
45  client.wait_for_server()
46  goal = asr_direct_search_manager.msg.gridGoal(command="GetGoalCameraPose", searchedObjectTypes=["Smacks"])
47  client.send_goal(goal)
48  client.wait_for_result()
49  result = client.get_result()
50  remainingRobotPoses = result.remainingRobotPoses
51  quaternion = (
52  result.goalRobotPose.orientation.x,
53  result.goalRobotPose.orientation.y,
54  result.goalRobotPose.orientation.z,
55  result.goalRobotPose.orientation.w)
56  euler = tf.transformations.euler_from_quaternion(quaternion)
57  roll = euler[0]
58  pitch = euler[1]
59  yaw = euler[2]
60  yawDeg = euler[2]*57.2958
61  rospy.loginfo("got orienation " + str(yawDeg) + "for pose (" + str(result.goalRobotPose.position) + ")")
62  except rospy.ROSInterruptException: pass
63 


asr_direct_search_manager
Author(s): Borella Jocelyn, Karrenbauer Oliver, Mei├čner Pascal
autogenerated on Wed Jan 8 2020 03:15:41