3 import roslib; roslib.load_manifest(
'flexbe_input')
9 from flexbe_msgs.msg
import BehaviorInputAction, BehaviorInputFeedback, BehaviorInputResult, BehaviorInputGoal
10 from .complex_action_server
import ComplexActionServer
14 @author: Philipp Schillinger, Brian Wright 24 self.
_as = ComplexActionServer(
'flexbe/behavior_input', BehaviorInputAction, execute_cb=self.
execute_cb, auto_start =
False)
27 rospy.loginfo(
"Ready for data requests...")
30 rospy.loginfo(
"--> Got a request!")
31 rospy.loginfo(
'"%s"' % goal.msg)
37 relay_ocs_client_.wait_for_server()
41 relay_ocs_client_.send_goal(goal)
42 print(
"waiting for result")
43 relay_ocs_client_.wait_for_result()
46 result = BehaviorInputResult()
47 result = relay_ocs_client_.get_result()
49 data_str = result.data
52 if(result.result_code == BehaviorInputResult.RESULT_OK):
53 self._as.set_succeeded(BehaviorInputResult(result_code=BehaviorInputResult.RESULT_OK, data=data_str),
"ok",goal_handle)
55 elif(result.result_code == BehaviorInputResult.RESULT_FAILED):
57 self._as.set_succeeded(BehaviorInputResult(result_code=BehaviorInputResult.RESULT_FAILED, data=data_str),
"failed",goal_handle)
58 rospy.loginfo(
"<-- Replied with FAILED")
60 elif(result.result_code == BehaviorInputResult.RESULT_ABORTED ):
61 self._as.set_succeeded(BehaviorInputResult(result_code=BehaviorInputResult.RESULT_ABORTED, data=data_str),
"Aborted",goal_handle)
62 rospy.loginfo(
"<-- Replied with ABORT")