コード例 #1
0
def parse_or_load_xtf(path):

    if os.path.exists("xtf_cache.cereal"):
        xtf_pings = xtf_data.xtf_sss_ping.read_data("xtf_cache.cereal")
    else:
        xtf_pings = xtf_data.xtf_sss_ping.parse_folder(path)
        #nav_entries = csv_data.csv_nav_entry.parse_file(csv_path)
        xtf_data.write_data(xtf_pings, "xtf_cache.cereal")
    return xtf_pings
コード例 #2
0
ファイル: simple_sss_sim.py プロジェクト: xiaozhangwmx/auvlib
def match_or_load_xtf(xtf_path, csv_path):

    if os.path.exists("matched_cache.cereal"):
        xtf_pings = xtf_data.xtf_sss_ping.read_data("matched_cache.cereal")
    else:
        xtf_pings = utils.parse_or_load_xtf(xtf_path)
        nav_entries = utils.parse_or_load_csv(csv_path)
        xtf_pings = csv_data.convert_matched_entries(xtf_pings, nav_entries)
        xtf_data.write_data(xtf_pings, "matched_cache.cereal")
    return xtf_pings
コード例 #3
0
#------------------------------------------------------------------------------
#SAVE XTF DATA FROM SELECTED REGION

#Read xtf data
xtf_data = xtf_data.xtf_sss_ping.read_data(xtf_file)

#Pick out data points from selected region
xtf_region_data = []
for ping in xtf_data:
    pos = ping.pos_
    if pos[0] > low_x and pos[0] < high_x and pos[1] > low_y and pos[
            1] < high_y:
        xtf_region_data.append(ping)

#Save data points from selected region
xtf_data.write_data(xtf_region_data, save_path_xtf + outputfile_xtf)

#------------------------------------------------------------------------------
#SAVE MULTIBEAM DATA FROM SELECTED REGION

#Read multibeam data
mbes_data = std_data.mbes_ping.read_data(mbes_file)

#Pick out data points from selected region
mbes_region_data = []
for ping in mbes_data:
    pos = ping.pos_
    if pos[0] > low_x and pos[0] < high_x and pos[1] > low_y and pos[
            1] < high_y:
        mbes_region_data.append(ping)
コード例 #4
0
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
''' cut some unuseful pings in each layer '''

xtf_file = "/home/chs/Desktop/Sonar/Data/xtf_ping/xtf_pings_low.cereal"  # sidescan data
xtf_pings = xtf_data.xtf_sss_ping.read_data(xtf_file)

choosen_pings = []
for ping in xtf_pings:
    if 1560597112120 < ping.time_stamp_ < 1560598940700:
        choosen_pings.append(ping)
''' Show moving curve of vechile in xtf '''
x_xtf = []
y_xtf = []
z_xtf = []
for ping in choosen_pings:
    x_xtf.append(ping.pos_[0])
    y_xtf.append(ping.pos_[1])
    z_xtf.append(ping.pos_[2])
ax = plt.subplot(projection='3d')
ax.scatter(x_xtf, y_xtf, z_xtf, s=2, c='r', marker='.')
ax.set_zlabel('Z')
ax.set_ylabel('Y')
ax.set_xlabel('X')
plt.show()

xtf_data.write_data(
    choosen_pings,
    "/home/chs/Desktop/Sonar/Data/xtf_ping/xtf_pings_low_1.cereal")
print('Num of pings: %i' % len(choosen_pings))
コード例 #5
0
from auvlib.data_tools import xtf_data
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

xtf_file = "/home/chs/Desktop/Sonar/Data/xtf_ping/xtf_pings_mid.cereal"  # sidescan data
new_xtf_pings = xtf_data.xtf_sss_ping.read_data(xtf_file)

xtf_file = "/home/chs/Desktop/Sonar/Data/xtf_ping/xtf_pings_mid_old.cereal"  # sidescan data
old_xtf_pings = xtf_data.xtf_sss_ping.read_data(xtf_file)

for ping in old_xtf_pings:
    if new_xtf_pings[0].time_stamp_ == ping.time_stamp_:
        delta_pos = new_xtf_pings[0].pos_ - ping.pos_
        print("Delta pos =")
        print(delta_pos)
''' Delta pos = [845.22058245  82.73684846    0. ]'''
''' Note: this step has been added to divide data '''
std_pings_moved = []
for ping in new_xtf_pings:
    new_pos = ping.pos_ + np.array([845.22058245, 82.73684846, 0.])
    ping.pos_ = new_pos
    std_pings_moved.append(ping)

xtf_data.write_data(
    std_pings_moved,
    "/home/chs/Desktop/Sonar/Data/xtf_ping/xtf_pings_mid_new_1.cereal")
print("???")
コード例 #6
0
def saver(choosen_pings, i):
    choosen_pings =move_base(choosen_pings)
    xtf_data.write_data(choosen_pings, "/home/chs/Desktop/Sonar/Data/xtf_ping/xtf_pings_%d.cereal" % i)
    # print('Num of pings: %i' % len(choosen_pings))
    return choosen_pings[0].time_stamp_