Example #1
0
        replace('NBR_CONSTS_STR', nbr_consts).replace('MOVE_VARS_STR', move_vars).replace('MOVE_DYN_STR', move_dyn). \
        replace('MOVE_PRE_COND', move_pre_cond)

    rddl_inst_file = open(rddl_out, "w")
    rddl_inst_file.write(rddl_str)

    rddl_temp_file.close()
    rddl_inst_file.close()


if __name__ == '__main__':
    naive_collapse = False
    map_file = '../maps/Saturn/Saturn_1.5_3D_sm_v1.0.json'
    MAX_NBRS = 14
    edges = []
    
    if naive_collapse:
        rooms, edges = read_semantic_map(map_file)
        room_name_lookup = {rm:rm for rm in rooms.keys()}
    else:
        orig_map = json.load(open(map_file,'r'))
        one_way_edges, room_name_lookup, new_map, orig_map = transformed_connections(orig_map)
        for a,b in one_way_edges:
            edges.append((a,b))
            edges.append((b,a))
            
    make_rddl_inst_fol(edges, room_name_lookup, 
                       '../data/rddl_psim/role_fol_template.rddl',
                       '../data/rddl_psim/role_clpsd_map.rddl',
                       '../maps/Saturn/rddl_clpsd_neighbors.csv')
            room2Vics[rm] = []
        room2Vics[rm].append(vic['block_type'])
    return room2Vics


derivedFeats = []
derivedFeats.append(CountEnterExit(['mce3', 'scw1']))
derivedFeats.append(CountEnterExit(['el2', 'srbn']))

ddir = '../data/ASU_DATA/'
fnames = []
fnames.append(
    ddir +
    'TrialMessages_CondBtwn-1_CondWin-Saturn-StaticMap_Trial-1_Team-na_Member-Aptiminer1_Vers-hack-1.metadata'
)
fnames.append(
    ddir +
    'study-2_pilot-2_2021.02_NotHSRData_TrialMessages_Trial-T000294_Team-TM000011_CondBtwn-TmPlan_CondWin-SaturnA_Vers-1_.metadata'
)
map_file = '/home/mostafh/Documents/psim/new_atomic/atomic/maps/Saturn/Saturn_1.4_3D_sm_v1.0.json'

room_node_names, room_edges = read_semantic_map(map_file)
fname = fnames[1]

parser = ProcessParsedJson(fname, room_node_names, logger=logging)
parser.startProcessing(derivedFeats)

SandRVics = getVictimsFromBus(parser.vList)
parser.setVictimLocations(SandRVics)
parser.getActionsAndEvents(None, None, 99)