Ejemplo n.º 1
0
import time
from math import *
from task_manager_lib.TaskClient import *

rospy.init_node('task_client_uav')

# uav task client
server_node_uav = rospy.get_param("~server", "/uavsim_tasks")
default_period_uav = rospy.get_param("~period", 0.2)
uav = TaskClient(server_node_uav, default_period_uav)
rospy.loginfo("Mission connected to UAV server: " + server_node_uav)

wp = [[0., 0], [2., -2.], [-2., 2.], [-2., -2.], [2., 2.]]
i = 0
try:
    uav.RequestTakeOff()
    uav.Wait(duration=3.0)
    uav.TakeOff()

    while True:

        w4landingBackOrder = uav.WaitForLandingBackOrder(foreground=False)
        w4lowBatteryLevel = uav.WaitForLowBatteryLevel(foreground=False)
        uav.addCondition(
            ConditionIsCompleted("Landing Back Order", uav,
                                 w4landingBackOrder))
        uav.addCondition(
            ConditionIsCompleted("Low Battery Level", uav, w4lowBatteryLevel))

        try:
            while True: