def run(server_name): client = actionlib.SimpleActionClient(server_name, TaskRequestAction) rospy.loginfo("TakeoffLandMission: Waiting for server") client.wait_for_server() rospy.loginfo("TakeoffLandMission: server ready") rospy.sleep(5) request = TaskRequestGoal(action_type="takeoff") client.send_goal_and_wait(request) rospy.logwarn("Success: {}".format(client.get_result().success)) rospy.sleep(2) request = TaskRequestGoal(action_type="go_to_target") client.send_goal(request) rospy.sleep(5.0) request = TaskRequestGoal(action_type="land", preempt=True) client.send_goal_and_wait(request) rospy.logwarn("Success: {}".format(client.get_result().success))
def run(server_name): client = actionlib.SimpleActionClient(server_name, TaskRequestAction) rospy.loginfo('TaskActionClient: Waiting for server') client.wait_for_server() rospy.loginfo('TaskActionClient: server ready') request = TaskRequestGoal(action_type='test_task') client.send_goal_and_wait(request) rospy.logwarn('Success: {}'.format(client.get_result().success)) rospy.loginfo('Testing Cancel') # test cancel request = TaskRequestGoal(action_type='test_task') client.send_goal(request) rospy.sleep(.25) client.cancel_goal() rospy.logwarn('Goal Canceled') rospy.loginfo('Test Preempt') # test preempt request = TaskRequestGoal(action_type='test_task') client.send_goal(request) rospy.sleep(.25) request = TaskRequestGoal(action_type='test_task', preempt=True) client.send_goal_and_wait(request)
def run(server_name): client = actionlib.SimpleActionClient(server_name, TaskRequestAction) rospy.loginfo("TaskServer: Waiting for server") client.wait_for_server() rospy.loginfo("TaskServer: server ready") request = TaskRequestGoal(action_type="takeoff") client.send_goal_and_wait(request) rospy.logwarn("Success: {}".format(client.get_result().success)) request = TaskRequestGoal(action_type="land") client.send_goal_and_wait(request) rospy.logwarn("Success: {}".format(client.get_result().success))
def run(server_name): client = actionlib.SimpleActionClient(server_name, TaskRequestAction) rospy.loginfo('TaskActionClient: Waiting for server') client.wait_for_server() rospy.loginfo('TaskActionClient: server ready') time.sleep(60) request = TaskRequestGoal(action_type='uavTakeOff') """ Give me the takeoff altitude in the pose """ altitude = 1.5 request.pose = getWaypoint(0, 0, altitude) client.send_goal_and_wait(request) rospy.logwarn('Success: {}'.format(client.get_result().success)) #hover for 2 seconds time.sleep(2) """ Waypoint following code """ request = TaskRequestGoal(action_type='uavWaypoint') request.pose = getWaypoint(0.2, 0, altitude, 0) rospy.loginfo(str(request)) client.send_goal_and_wait(request) rospy.logwarn('Success: {}'.format(client.get_result().success)) rospy.loginfo('Testing Cancel') #hover for 2 seconds #time.sleep(2) #request = TaskRequestGoal(action_type='uavWaypoint') #request.pose = getWaypoint(0.2,0.2,altitude,0) #rospy.loginfo(str(request)) #client.send_goal_and_wait(request) #rospy.logwarn('Success: {}'.format(client.get_result().success)) #rospy.loginfo('Testing Cancel') #hover for 2 seconds #time.sleep(2) #request = TaskRequestGoal(action_type='uavWaypoint') #request.pose = getWaypoint(0,0.2,altitude,0) #rospy.loginfo(str(request)) #client.send_goal_and_wait(request) #rospy.logwarn('Success: {}'.format(client.get_result().success)) #rospy.loginfo('Testing Cancel') #hover for 2 seconds time.sleep(2) request = TaskRequestGoal(action_type='uavWaypoint') request.pose = getWaypoint(0, 0, 0.2, 0) rospy.loginfo(str(request)) client.send_goal_and_wait(request) rospy.logwarn('Success: {}'.format(client.get_result().success)) rospy.loginfo('Testing Cancel') #hover for 2 seconds time.sleep(2) """