23 from simple_script_server
import *
24 from cob_script_server.msg
import ScriptAction, ScriptGoal
25 from std_srvs.srv
import Trigger, TriggerResponse
26 from move_base_msgs.msg
import MoveBaseAction, MoveBaseResult
31 super(TestActionInterface, self).
__init__(*args)
32 rospy.init_node(
'test_action_interface')
40 goal.function_name =
"init" 41 goal.component_name =
"arm" 46 goal.function_name =
"stop" 47 goal.component_name =
"arm" 52 goal.function_name =
"recover" 53 goal.component_name =
"arm" 57 rospy.Service(
"/" + goal.component_name +
"_controller/" + goal.function_name, Trigger, self.
cb)
62 if not client.wait_for_server(rospy.Duration(10)):
63 self.fail(
'Action server not ready')
64 client.send_goal(goal)
65 if not client.wait_for_result(rospy.Duration(10)):
66 self.fail(
'Action didnt give a result before timeout')
69 self.fail(
'Service Server not called. script server error_code: ' + str(client.get_result().error_code))
73 res = TriggerResponse()
110 if goal.mode ==
None or goal.mode ==
"" or goal.mode ==
"omni":
111 as_name =
"/move_base" 113 as_name =
"/move_base_" + goal.mode
115 self.as_server.start()
120 if not client.wait_for_server(rospy.Duration(10)):
121 self.fail(
'Action server not ready')
122 client.send_goal(goal)
123 client.wait_for_result(rospy.Duration(10))
132 result = MoveBaseResult()
133 self.as_server.set_succeeded(result)
138 if __name__ ==
'__main__':
140 rostest.rosrun(
'cob_script_server',
'action_interface', TestActionInterface)
This test checks the correct call to commands from the cob_script_server.
def script_action_trigger(self, goal)
def script_action_move_base(self, goal)