コード例 #1
0
                        format="%(levelname)s %(asctime)s %(message)s",
                        level=logging.DEBUG)

    console = logging.StreamHandler()
    console.setLevel(logging.INFO)
    console.setFormatter(logging.Formatter("%(asctime)s %(message)s"))
    logging.getLogger("").addHandler(console)

    ##########
    # Load the pre-voxelated vehicle model for testing
    b_fldr = r"voxelated_models/vehicles"
    vox_size_str = str(SETTINGS["voxel_size"])
    vox_folder = os.path.join(b_fldr, SETTINGS["run_id"], vox_size_str)
    vox_veh_file = "voxels_{}_vox{}".format(SETTINGS["run_id"], vox_size_str)
    voxel_dat = data_io.load_array(vox_folder, vox_veh_file, True)
    vehicle = Vehicle(voxel_dat)

    ### Hardcoded dummy troop positions that may be meaningless. Uses 3D voxel indices. These
    # values are for testing only, based on the Ricardo master assembly 11/11/2013.
    crew_points = np.array([[40, 40, 25], [40, 80, 25], [20, 145, 40]])

    # Perform exit checks and return combined results
    can_exit, exit_grid, air_inside = main(vehicle, crew_points, debug=True)

    # Print exit status: do all points pass exit check?
    exit_ok = all(v.values() for v in can_exit.values())

    if SETTINGS["debug"]:
        ## Render a 3D image, for debugging purposes only
        from mayavi import mlab
コード例 #2
0
    else:
        logging.info('Commencing voxelization of vehicle model')
        assembly.voxelate_geometry()

        # Voxelate Litter_Open model on a grid of same size
        x_pts, y_pts, z_pts = [
            assembly.voxel_data[k] for k in ("x_grid", "y_grid", "z_grid")
        ]
        valid_litter_found = assembly.voxelate_litter(x_pts, y_pts, z_pts)

        data_io.save_multi_array(vox_veh_folder, vox_veh_file,
                                 assembly.voxel_data)
        logging.info("Vehicle successfully voxelated.")

    # All later operations act on pre-voxelated models. Create voxel objects with redundant info.
    vehicle = Vehicle(assembly.voxel_data,
                      vehicle_csys=assembly.get_vehicle_csys())

    # Find exit points (hatches + where rear doorway and floor intersect)
    # The door and floor may never intersect at all; instead, use the intersection between the
    # voxelated arrays, vehicle_interior w/ door.
    vox_veh_cabin = vehicle.get_vox_from_coord(
        assembly.get_manikin_positions(datum_name="SWRI_H_POINT",
                                       veh_role="troop")[0])

    vehicle_interior = vehicle.get_labels(mask_from_voxel=vox_veh_cabin)
    # Run floor and ceil finding routines to prepare object for later scripts. Finding floor
    # automatically also gets ceiling.
    vehicle.get_floor(vox_veh_cabin)

    logging.info("Vehicle floor, ceiling, and interior successfully labeled")
コード例 #3
0
ファイル: ingress_egress.py プロジェクト: cephdon/meta-core
        logging.info("Vehicle voxel data loaded from preexisting file {}".format(vox_veh_file))

        valid_litter_found = "litter" in assembly.voxel_data  # Does cached geom incl litter?
    else:
        logging.info('Commencing voxelization of vehicle model')
        assembly.voxelate_geometry()

        # Voxelate Litter_Open model on a grid of same size
        x_pts, y_pts, z_pts = [assembly.voxel_data[k] for k in ("x_grid", "y_grid", "z_grid")]
        valid_litter_found = assembly.voxelate_litter(x_pts, y_pts, z_pts)

        data_io.save_multi_array(vox_veh_folder, vox_veh_file, assembly.voxel_data)
        logging.info("Vehicle successfully voxelated.")

    # All later operations act on pre-voxelated models. Create voxel objects with redundant info.
    vehicle = Vehicle(assembly.voxel_data, vehicle_csys=assembly.get_vehicle_csys())

    # Find exit points (hatches + where rear doorway and floor intersect)
    # The door and floor may never intersect at all; instead, use the intersection between the
    # voxelated arrays, vehicle_interior w/ door.
    vox_veh_cabin = vehicle.get_vox_from_coord(
        assembly.get_manikin_positions(datum_name="SWRI_H_POINT", veh_role="troop")[0])

    vehicle_interior = vehicle.get_labels(mask_from_voxel=vox_veh_cabin)
    # Run floor and ceil finding routines to prepare object for later scripts. Finding floor
    # automatically also gets ceiling.
    vehicle.get_floor(vox_veh_cabin)

    logging.info("Vehicle floor, ceiling, and interior successfully labeled")

    if not SETTINGS['debug']:
コード例 #4
0
        save_results(result_folder, file_name, collisions, save_plots=settings["show_2d"])

if __name__ == "__main__":
    #############
    # User specified settings from separate file
    from rpl.tools.api import test_bench_api as tba
    SETTINGS = tba.load_settings("settings.js")

    # Load in vehicle occupied voxels file
    vox_veh_folder = r"voxelated_models/vehicles/{}/{}".format(SETTINGS["run_id"],
                                                               SETTINGS["voxel_size"])
    vox_veh_file = "voxels_{}_vox{}".format(SETTINGS["run_id"], SETTINGS["voxel_size"])
    veh_vox = data_io.load_array(vox_veh_folder, vox_veh_file, multi_array=True)

    vehicle = Vehicle(veh_vox, voxel_size=SETTINGS["voxel_size"])
    # Get floor and ceiling at a dummy position that may or may not work; used for testing code

    #### Arbitrary: use a point in the exact center of the vehicle
    #vox_veh_cabin = (vehicle.shape[0] // 2, vehicle.shape[1] // 2, vehicle.shape[2] // 2)

    # Point chosen for the EFV tester model
    vox_veh_cabin = (140,30,10)

    vehicle.get_labels(vox_veh_cabin)
    vehicle.get_floor(vox_veh_cabin)
    vehicle.get_ceil(vox_veh_cabin)

    for pose_name in SETTINGS["manikins_to_use"]:
        logging.debug("Checking intersection of '{}'".format(pose_name))
        main(pose_name, vehicle, settings=SETTINGS)
コード例 #5
0
if __name__ == "__main__":
    #############
    # User specified settings from separate file
    from rpl.tools.api import test_bench_api as tba
    SETTINGS = tba.load_settings("settings.js")

    # Load in vehicle occupied voxels file
    vox_veh_folder = r"voxelated_models/vehicles/{}/{}".format(
        SETTINGS["run_id"], SETTINGS["voxel_size"])
    vox_veh_file = "voxels_{}_vox{}".format(SETTINGS["run_id"],
                                            SETTINGS["voxel_size"])
    veh_vox = data_io.load_array(vox_veh_folder,
                                 vox_veh_file,
                                 multi_array=True)

    vehicle = Vehicle(veh_vox, voxel_size=SETTINGS["voxel_size"])
    # Get floor and ceiling at a dummy position that may or may not work; used for testing code

    #### Arbitrary: use a point in the exact center of the vehicle
    #vox_veh_cabin = (vehicle.shape[0] // 2, vehicle.shape[1] // 2, vehicle.shape[2] // 2)

    # Point chosen for the EFV tester model
    vox_veh_cabin = (140, 30, 10)

    vehicle.get_labels(vox_veh_cabin)
    vehicle.get_floor(vox_veh_cabin)
    vehicle.get_ceil(vox_veh_cabin)

    for pose_name in SETTINGS["manikins_to_use"]:
        logging.debug("Checking intersection of '{}'".format(pose_name))
        main(pose_name, vehicle, settings=SETTINGS)