def main():
    # Assumed order: waypts, search
    filename = 'data.csv'
    #(op_area, search_area, waypoints_list) = read_file(filename)

    # given a takeoff point
    # generate path to go over waypts
    # generate search path within search_area
    pt1 = coordinate.GeoCoord(38.145278, -76.428889)
    pi = math.pi
    pt2 = search_path.coord_with_dist_from_pt(pt1, 10.0, pi / 4.0)
    print('----------')
    pt1 = coordinate.GeoCoord(38.145278, -76.428889, 20)
    pt2 = coordinate.GeoCoord(38.145278, -76.428850, 20)
    pt3 = coordinate.GeoCoord(38.145278, -76.428820, 20)
    pt4 = coordinate.GeoCoord(38.145278, -76.428800, 20)
    pt5 = coordinate.GeoCoord(38.145278, -76.428780, 20)
    test = mission.Mission()
    item1 = mission.MissionItem(pt1, 22)
    test.add_mission_item(item1)
    item2 = mission.MissionItem(pt2, 16)
    test.add_mission_item(item2)
    item3 = mission.MissionItem(pt3, 16)
    test.add_mission_item(item3)
    item4 = mission.MissionItem(pt4, 16)
    test.add_mission_item(item4)
    item5 = mission.MissionItem(pt5, 21)
    test.add_mission_item(item5)

    f = open('output.txt', 'w')
    f.write(str(test))
    f.close()
Exemple #2
0
 def __init__(self, mission_name, video_name, start, length, cropping_rect,
              gui):
     self.mission = mission.Mission(mission_name)
     self.video_name = video_name
     self.gui = gui
     self.start = start
     self.length = length
     self.cropping_rect = cropping_rect
     self.work()
Exemple #3
0
def main():
    # Read the File
    filename = 'data.csv'
    (op_area, search_area, waypoints_list) = file_parser.read_file(filename)

    m1 = mission.Mission()
    f1 = mission.Fence()

    # Given a takeoff point
    takeoff_pt = coordinate.GeoCoord(38.145495, -76.428166, 200)
    item1 = mission.MissionItem(takeoff_pt, 22)
    m1.add_mission_item(item1)

    # Generate path to go over waypts
    waypt_path = path.generate_waypt_path(path_info, takeoff_pt,
                                          waypoints_list, op_area)
    for pt in waypt_path:
        item1 = mission.MissionItem(pt, 16)
        m1.add_mission_item(item1)

    # Generate search path within search_area
    search_area_path = []
    #search_area_path = path.generate_search_path(path_info, waypt_path[-1], search_area, op_area, 30)
    search_area_path = path.generate_search_path_spiral(
        path_info, waypt_path[-1], search_area, op_area, 30)
    for pt in search_area_path:
        item1 = mission.MissionItem(pt, 16)
        m1.add_mission_item(item1)

    # Add Landing point, assume to be takeoff point as well
    item1 = mission.MissionItem(takeoff_pt, 21)
    m1.add_mission_item(item1)

    # Generate Fence from the operational area
    for pt in op_area:
        f1.add_boundary_point(pt)

    # Output the mission into file
    f = open('output.mission', 'w')
    f.write(str(m1))
    f.close()

    # Output the fence into file
    f = open('output.fence', 'w')
    f.write(str(f1))
    f.close()
    def __init__(self):
        url = "https://everydayastronaut.com/prelaunch-previews/"
        page = requests.get(url)
        page_content = html.fromstring(page.content)

        tale_rows = page_content.xpath('//tr')
        i = 0

        for row in tale_rows:
            string = row.text_content()
            if len(string) > 200:
                data = string.split("|")
                mission_name = data[0] + "|" + data[1]
                mission_name = mission_name.split()
                mission_name = " ".join(
                    sorted(set(mission_name), key=mission_name.index))

                location = re.findall("Location(.*)LSP", string)[0].strip()
                lsp = re.findall("LSP(.*)Rocket", string)[0].strip()
                rocket = mission_name.split("|")[0].strip()

                window_start = re.findall("Window start(.*)UTCWindow",
                                          string)[0].strip()
                window_end = re.findall("Window end(.*)UTC", string)[0].strip()

                start_date = re.findall(
                    "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]",
                    window_start)[0]
                start_time = re.findall("[0-9][0-9]:[0-9][0-9]:[0-9][0-9]",
                                        window_start)[0]
                end_time = re.findall("[0-9][0-9]:[0-9][0-9]:[0-9][0-9]",
                                      window_end)[0]

                mission = ms.Mission(mission_name, location, lsp, rocket,
                                     start_date, start_time, end_time)
                self.missions.append(mission)
            elif string.strip() == "Mission NameDate and Time" and i > 1:
                break
            i += 1
def main():
    fullscreen = False
    width, height = 960, 600
    level_path = None

    i = 1
    while i < len(sys.argv):
        if sys.argv[i] == '--fullscreen':
            fullscreen = True
        elif sys.argv[i] == '--window':
            try:
                width, height = map(int, sys.argv[i + 1].split('x'))
            except:
                Usage()
            i += 1
        elif level_path:
            Usage()
        else:
            level_path = sys.argv[i]
        i += 1

    pygame.init()

    flags = pygame.OPENGL | pygame.DOUBLEBUF | pygame.HWSURFACE
    if fullscreen:
        width, height = 0, 0
        flags |= pygame.FULLSCREEN

    pygame.display.set_caption('Moon')

    screen = pygame.display.set_mode((width, height), flags)

    render = renderer.Render(screen)
    snds = sounds.Sounds()

    if level_path:
        print 'Debugging map %s.' % level_path
        m = mission.Mission(level_path)
        g = game.Game(render, snds, m)
        result = g.Run()
        print 'Result: %i, took %0.1f seconds' % (result, g.play_time)
    else:
        levels = ('data/c0_m0.txt', 'data/c1_m0.txt', 'data/c1_m1.txt',
                  'data/c1_m2.txt')
        par_times = (72.5, 29.2, 89.6, 88.4)
        play_times = [None] * len(levels)
        i = 0
        while i < len(levels):
            level_path = levels[i]
            m = mission.Mission(level_path)
            g = game.Game(render, snds, m)
            result = g.Run()
            if result == game.Game.ABORTED:
                break
            if result == game.Game.VICTORY:
                play_times[i] = g.play_time
                i += 1

        if i > 0:
            print 'Your times:'
            for i, (play_time,
                    par_time) in enumerate(zip(play_times, par_times)):
                if play_time is None:
                    continue
                print('Mission %i: %5.1fs    Par time: %5.1fs' %
                      (i + 1, play_time, par_time))
Exemple #6
0
    def __init__(self):
        # Set up the user interface from Designer.
        super(mywindow, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # Modifications to interface
        """ add vlc interfaces for ip cameras"""

        # Create all required objects
        self.drone = drone.Drone()
        self.map = map.Map()
        self.mission = mission.Mission()

        # TODO add mission_planner_map_image initialisations here
        self.ui.mission_planner_map_image.setContentsMargins(0, 0, 0, 0)

        # TODO load default values here
        self.load_default_values()

        self.map_image.mousePressEvent = self.get_mouse_click_pos

        self.camera_1 = camera.Camera()
        self.camera_1.update_ip_address("192.168.1.1")
        self.camera_2 = camera.Camera()
        self.camera_2.update_ip_address("192.168.1.1")
        self.camera_3 = camera.Camera()
        self.camera_3.update_ip_address("192.168.1.1")
        self.camera_4 = camera.Camera()
        self.camera_4.update_ip_address("192.168.1.1")

        # set up video feeds
        self.media_player_1 = QtMultimedia.QMediaPlayer(self)
        self.media_player_1.setVideoOutput(
            self.ui.launchpad_monitoring_videofeed_1)
        # fileName = "/path/of/your/local_file"
        # url = QtCore.QUrl.fromLocalFile(fileName)
        url_1 = QtCore.QUrl(
            "http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8"
        )
        self.media_player_1.setMedia(QtMultimedia.QMediaContent(url_1))
        self.media_player_1.play()

        self.media_player_2 = QtMultimedia.QMediaPlayer(self)
        self.media_player_2.setVideoOutput(
            self.ui.launchpad_monitoring_videofeed_2)
        # fileName = "/path/of/your/local_file"
        # url = QtCore.QUrl.fromLocalFile(fileName)
        url_2 = QtCore.QUrl(
            "http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8"
        )
        self.media_player_2.setMedia(QtMultimedia.QMediaContent(url_2))
        self.media_player_2.play()

        self.media_player_3 = QtMultimedia.QMediaPlayer(self)
        self.media_player_3.setVideoOutput(
            self.ui.launchpad_monitoring_videofeed_3)
        # fileName = "/path/of/your/local_file"
        # url = QtCore.QUrl.fromLocalFile(fileName)
        url_3 = QtCore.QUrl(
            "http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8"
        )
        self.media_player_3.setMedia(QtMultimedia.QMediaContent(url_3))
        self.media_player_3.play()

        self.media_player_4 = QtMultimedia.QMediaPlayer(self)
        self.media_player_4.setVideoOutput(
            self.ui.launchpad_monitoring_videofeed_4)
        # fileName = "/path/of/your/local_file"
        # url = QtCore.QUrl.fromLocalFile(fileName)
        url_4 = QtCore.QUrl(
            "http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8"
        )
        self.media_player_4.setMedia(QtMultimedia.QMediaContent(url_4))
        self.media_player_4.play()

        # CONNECT BUTTONS

        #configuration buttons
        self.ui.remove_waypoint_btn.clicked.connect(
            self.mission.remove_waypoint)

        self.ui.config_camera_update_btn.clicked.connect(
            self.config_update_camera_parameters)
        self.ui.map_select_file_btn.clicked.connect(self.select_map_file)
        self.ui.config_map_update_btn.clicked.connect(
            self.config_update_map_parameters)
        self.ui.config_launchpad_update_btn.clicked.connect(
            self.config_update_launchpad_parameters)
        self.ui.config_uas_update_btn.clicked.connect(
            self.config_update_uas_parameters)

        # TODO TEST CODE

        # self.load_default_values()

        # TODO introduce queue processing here
        self.station_connection = connection.Connection('localhost', 100)
Exemple #7
0
    pos_target = (target_x, target_y)

    def map_to_world(pos: helper.Position2D) -> helper.Position2D:
        map_x, map_y = pos
        world_x = map_x - 40.0
        world_y = map_y + 26.5
        return (world_x, world_y)

    # build the mission
    # TODO: parameterise
    dir_catkin = '/home/mars/catkin_ws'
    dir_turtlebot_gazebo = os.path.join(dir_catkin,
                                        'src/turtlebot_simulator/turtlebot_gazebo')
    map_file = os.path.join(dir_turtlebot_gazebo,
                            'maps/playground.yaml')
    world_file = os.path.join(dir_turtlebot_gazebo,
                              'worlds/playground.world')
    base_launch_file = os.path.join(os.path.dirname(__file__),
                                    'robotest.launch')

    mission = mission.Mission(map_position_initial=pos_start,
                              map_position_end=pos_target,
                              base_launch_file=base_launch_file,
                              map_to_world=map_to_world,
                              map_file=map_file,
                              world_file=world_file,
                              time_limit=60)

    # execute!
    print(mission.execute())
Exemple #8
0
def generate_context(file):
    with mission.Mission(file):
        pass