def preflight(args: argparse.Namespace) -> None: assert os.path.isfile(args.roi), f"Invalid file path: '{args.roi}'" with open(args.roi, "r") as f: args.roi = Rect.from_dump(f.read()) if args.env_name is not None: # the --launch option was passed ff.launch_env( *ff.LaunchEnvArgs(args), # settings=ff.settings_str_from_dict( # AirSimSettings( # clock_speed=args.clock, # sim_mode=ff.SimMode.Multirotor, # view_mode=ff.ViewMode.SpringArmChase, # # camera_defaults=AirSimSettings.Camera( # # capture_settings=[AirSimSettings.CaptureSettings()] # # ), # subwindows=[ # AirSimSettings.Subwindow(0, camera_name=ff.CameraName.front_center), # AirSimSettings.Subwindow(1, camera_name=ff.CameraName.back_center), # AirSimSettings.Subwindow(2, camera_name=ff.CameraName.bottom_center), # ], # ).as_dict() # ), ) ff.input_or_exit("\nPress [enter] to connect to AirSim ")
def preflight(args: argparse.Namespace) -> None: assert os.path.isfile(args.roi), f"Invalid file path: '{args.roi}'" with open(args.roi, "r") as f: args.rect = Rect.from_dump(f.read()) if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) ff.input_or_exit("\nPress [enter] to connect to AirSim ")
def preflight(args: argparse.Namespace) -> None: assert os.path.isfile(args.rec), f"Invalid file path: '{args.rec}'" args.color = Rgba(*((0, 0.651, 0.929) if args.color is None else args.color)) args.recording = AirSimRecord.dict_from(rec_file=args.rec) if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) ff.input_or_exit("\nPress [enter] to connect to AirSim ")
def preflight(args: argparse.Namespace) -> None: assert os.path.isfile( args.viewpoints_path), f"Invalid file path: '{args.viewpoints_path}'" with open(args.viewpoints_path, "r") as viewpoints_file: viewpoints = json.load(viewpoints_file) args.viewpoints = zip(viewpoints["positions"], viewpoints["orientations"]) if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) ff.input_or_exit("\nPress [enter] to connect to AirSim ")
def preflight(args: argparse.Namespace) -> None: assert os.path.isfile( args.ply_path), f"Invalid file path: '{args.ply_path}'" # Parse the point cloud into a pandas dataframe and extract its points ply_df = read_ply(args.ply_path) if args.verbose: ff.log(ply_df) args.points = ply_df["points"][["x", "y", "z"]].to_numpy() n_of_points, _ = args.points.shape print(f"The point cloud has {n_of_points} points.") # NOTE avoid plotting all points for large clouds, since Unreal can't handle it k = 0 if args.every_k is None else args.every_k while not k: try: k = int( input_or_exit( "Do you want to plot one every how many points? ")) except KeyboardInterrupt: exit() except: k = 0 print("\nPlease input a valid integer. ", end="") continue answer = input_or_exit( f"This will plot a total of {n_of_points // k} points" f" (i.e. one every {k}).\nDo you want to continue? [Y/n] ") k = 0 if answer.lower().strip() in ["n", "no"] else k args.every_k = k # Check if a uavmvs trajectory was passed in and parse it into points if args.trajectory_path is not None: _, ext = os.path.splitext(args.trajectory_path) assert os.path.isfile(args.trajectory_path ), f"Invalid file path: '{args.trajectory_path}'" assert ext in parse_uavmvs.keys( ), f"Invalid trajectory extension: '{args.trajectory_path}'" args.trajectory = parse_uavmvs[ext](args.trajectory_path) if args.verbose: ff.log(f"The trajectory has {len(args.trajectory)} camera poses") else: args.trajectory = None if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) ff.input_or_exit("\nPress [enter] to connect to AirSim ")
def preflight(args: argparse.Namespace) -> None: assert os.path.isfile(args.sfm), f"Invalid file path: '{args.sfm}'" args.color = Rgba(*((1, 0.706, 0) if args.color is None else args.color)) # TODO get transforms, i.e. poses (position + orientation) from each camera views, poses = MeshroomParser.parse_cameras(cameras_file_path=args.sfm) args.views_dict, args.poses_dict = MeshroomParser.extract_views_and_poses( views, poses) if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) ff.input_or_exit("\nPress [enter] to connect to AirSim ")
def main(args: argparse.Namespace) -> None: if args.verbose: ff.print_airsim_path(airsim.__path__) assert args.env_name is not None, "missing --launch option" ff.launch_env(*ff.LaunchEnvArgs(args)) if not args.skip_connect: ff.input_or_exit("\nPress [enter] to connect to AirSim ") client = connect(ff.SimMode.ComputerVision) time.sleep(1) client.reset() ff.log("Done")
def main(args: argparse.Namespace) -> None: if args.verbose: ff.print_airsim_path(airsim.__path__) if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) input("\nPress [enter] to connect to AirSim ") preflight(args) # setup client = connect_to_airsim() try: fly(client, args) # do stuff except KeyboardInterrupt: client.reset() # avoid UE4 'fatal error' when exiting with Ctrl+C
def main(args: argparse.Namespace) -> None: if args.verbose: path_str = f"'airsim' path: {airsim.__path__[0]}" print("-" * len(path_str), path_str, "-" * len(path_str), sep="\n") if args.env_name is not None: ff.launch_env(args) # the --launch option was passed input("\nPress [enter] to connect to AirSim ") preflight(args) # setup client = connect_to_airsim() try: fly(client, args) # do stuff except KeyboardInterrupt: client.reset( ) # avoid UE4 'fatal error' when exiting the script with Ctrl+C
def preflight(args: argparse.Namespace) -> None: path = args.trajectory_path _, ext = os.path.splitext(path) assert os.path.isfile(path), path assert ext in parse_uavmvs.keys(), path args.trajectory = parse_uavmvs[ext](path) if args.verbose: ff.log(f"The trajectory has {len(args.trajectory)} camera poses") if args.capture_dir: args.capture_dir = os.path.abspath(args.capture_dir) assert os.path.isdir(args.capture_dir), args.capture_dir if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) ff.input_or_exit("\nPress [enter] to connect to AirSim ")
def preflight(args: argparse.Namespace) -> None: if args.env_name is not None: # the --launch option was passed ff.launch_env(*ff.LaunchEnvArgs(args)) ff.input_or_exit("\nPress [enter] to connect to AirSim ")