Ejemplo n.º 1
0
        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']:
        # Skip slow intersection checks if in debug mode
        ## Intersection checks
        for pose_name in SETTINGS["manikins_to_use"]:
            logging.info(
                "Starting intersection checks for {}".format(pose_name))
            check_intersection.main(pose_name, vehicle, settings=SETTINGS)
        logging.info("All intersection checks complete")
Ejemplo n.º 2
0
        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']:
        # Skip slow intersection checks if in debug mode
        ## Intersection checks
        for pose_name in SETTINGS["manikins_to_use"]:
            logging.info("Starting intersection checks for {}".format(pose_name))
            check_intersection.main(pose_name, vehicle, settings=SETTINGS)
        logging.info("All intersection checks complete")

        ##  Determine best pose at each position (saves output to files as needed)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)