def test_disarm(self): iros_task = Task("my name", Task.TYPE_DISARM, Point(), 0, # degrees [12.1], 42) oros_task = pythontask_to_rostask(rostask_to_pythontask(iros_task)) self.assertEquals(iros_task, oros_task, "input and output ros_task equals")
def test_target(self): iros_task = Task("my name", Task.TYPE_TARGET, Point(1,2,3), 1, # degrees [0.1,0.2,0.3], 42) oros_task = pythontask_to_rostask(rostask_to_pythontask(iros_task)) self.assertEquals(iros_task, oros_task, "input and output ros_task equals")
def pythontask_to_rostask(python_task): if (python_task.getType() == "target"): return Task(python_task.name, Task.TYPE_TARGET, python_task.target, rad2degf(python_task.orientation), [ python_task.precision.x, python_task.precision.z, python_task.precisionYAW ], python_task.ID) elif (python_task.getType() == "loiter"): return Task(python_task.name, Task.TYPE_LOITER, Point(0, 0, 0), 0, [python_task.waitTime], python_task.ID) elif (python_task.getType() == "takeoff"): return Task(python_task.name, Task.TYPE_TAKEOFF, Point(0, 0, 0), 0, [python_task.precision], python_task.ID) elif (python_task.getType() == "land"): return Task(python_task.name, Task.TYPE_LAND, Point(0, 0, 0), 0, [python_task.precision], python_task.ID) elif (python_task.getType() == "grab"): return Task(python_task.name, Task.TYPE_GRAB, Point(0, 0, 0), 0, [python_task.state], python_task.ID) elif (python_task.getType() == "init_UAV"): return Task(python_task.name, Task.TYPE_INIT_UAV, Point(0, 0, 0), 0, [float(python_task.sleep)], python_task.ID) elif (python_task.getType() == "arm"): return Task(python_task.name, Task.TYPE_ARM, Point(0, 0, 0), 0, [float(python_task.timeout)], python_task.ID) elif (python_task.getType() == "disarm"): return Task(python_task.name, Task.TYPE_DISARM, Point(0, 0, 0), 0, [float(python_task.timeout)], python_task.ID) else: return Task("null", Task.TYPE_NULL, Point(0, 0, 0), 0, [], python_task.ID)