def start_RfEar(self): # center freq Nooelec import rf if self.__sdr_type == 'NooElec': center_freq = 434.2e6 freqspan = 1e5 elif self.__sdr_type == 'AirSpy': center_freq = 434.0e6 freqspan = 2e4 else: print '~~~~~ UNKNOWN SDR-DEVICE-TYPE -> check type input' quit() self.__oRf = rf.RfEar(self.__sdr_type, center_freq, freqspan) freq6tx = [ 434.325e6, 433.89e6, 434.475e6, 434.025e6, 434.62e6, 434.175e6 ] # NooElec tx_6pos = [[770, 432, 0], [1794, 437, 0], [2814, 447, 0], [2824, 1232, 0], [1789, 1237, 0], [774, 1227, 0]] freq2tx = [434.325e6, 434.62e6] # FIXME: change if using not only 2 tx tx_2pos = [ [1120, 1374, 0], # FIXME: change this if changing tx position [1370, 1374, 0] ] self.__oRf.set_txparams(freq2tx, tx_2pos) return True
def start_RfEar(self, center_freq=434.2e6, freqspan=1e5): import rf self.__oRf = rf.RfEar(sdr_type='NooElec', center_freq=center_freq, freqspan=freqspan) freq6tx = [434.82e6, 434.17e6, 434.02e6, 434.62e6, 434.32e6] """ tx_6pos = [[700, 440], [1560,450], [2440, 460], [2440, 1240], [1560, 1235], [700, 1230]] """ tx_6pos = np.array([[2359, 1349, 641], [2110, 1349, 641], [1861, 1349, 641], [1612, 1349, 641], [1363, 1349, 641]]) self.__oRf.set_txparams(freq6tx, tx_6pos) # self.__oRf.plot_txrss_live() return True
def start_RfEar(self, center_freq=434.2e6, freqspan=2e4): import rf self.__oRf = rf.RfEar(center_freq, freqspan) freqtx = [433.9e6, 434.15e6, 434.40e6, 434.65e6] tx_pos = [[790, 440], [2530, 460], [2530, 1240], [790, 1230]] self.__oRf.set_txparams(freqtx, tx_pos) return True
def start_RfEar(self, center_freq=434.2e6, freqspan=1e5): import rf self.__oRf = rf.RfEar(center_freq, freqspan) # freqtx = [433.9e6, 434.15e6, 434.40e6, 434.65e6] # tx_pos = [[790, 440], # [2530, 460], # [2530, 1240], # [790, 1230]] # self.__oRf.set_txparams(freqtx, tx_pos) freq6tx = [434.00e6, 434.1e6, 434.30e6, 434.45e6, 434.65e6, 433.90e6] """ tx_6pos = [[700, 440], [1560,450], [2440, 460], [2440, 1240], [1560, 1235], [700, 1230]] """ tx_6pos = [[520, 430, 0], [1540, 430, 0], [2570, 430, 0], [2570, 1230, 0], [1540, 1230, 0], [530, 1230, 0]] self.__oRf.set_txparams(freq6tx, tx_6pos) return True
def __init__(self, tx_pos, set_model_type='log', x0=[1000, 1000]): self.__model_type = set_model_type self.__tx_freq = [] self.__tx_pos = [] self.__tx_alpha = [] self.__tx_gamma = [] self.__tx_freq = [ 4.3400e+08, 4.341e+08, 4.3430e+08, 4.3445e+08, 4.3465e+08, 4.3390e+08 ] self.__tx_pos = tx_pos if self.__model_type == 'log': """ parameter for log model """ b_file_param = True if b_file_param: (self.__tx_alpha, self.__tx_gamma) = rf_tools.get_cal_param_from_file( param_filename='cal_param.txt') print('Take alpha/gamma from cal-file') print('alpha = ' + str(self.__tx_alpha)) print('gamma = ' + str(self.__tx_gamma)) else: self.__tx_alpha = [ 0.011100059337162281, 0.014013732682386724, 0.011873535003719441, 0.013228415946149144, 0.010212580857184312, 0.010286057191882235 ] self.__tx_gamma = [ -0.49471304043015696, -1.2482393190627841, -0.17291318936462172, -0.61587988305564456, 0.99831151034040444, 0.85711994311461936 ] elif self.__model_type == 'lin': """ parameter for linear model """ #self.__tx_alpha = [-0.020559673796613238, -0.027175147727451984, -0.023111068055053488, -0.024454023111282586, # -0.024854213762496295, -0.021694731996127509] #self.__tx_gamma = [-42.189573853301056, -37.651222316888159, -40.60648965954146, -41.523883513559113, # -42.342411649995938, -42.349468350676268] """ Start RFEar as Measurement System """ self.__oMeasSys = rf.RfEar(434.2e6) self.__oMeasSys.set_txparams(self.__tx_freq, self.__tx_pos) self.__oMeasSys.set_calparams(self.__tx_alpha, self.__tx_gamma) self.__tx_num = len(self.__tx_freq) """ initialize tracking setup """ print(str(self.__tx_alpha)) print(str(self.__tx_gamma)) print(str(self.__tx_pos)) self.__tx_param = [] for itx in range(self.__tx_num): self.__tx_param.append([ self.__tx_pos[itx], self.__tx_alpha[itx], self.__tx_gamma[itx] ]) """ initialize EKF """ self.__x_est_0 = np.array([[x0[0]], [x0[1]]]).reshape((2, 1)) self.__x_est = self.__x_est_0 # standard deviations self.__sig_x1 = 500 self.__sig_x2 = 500 self.__p_mat_0 = np.array(np.diag([self.__sig_x1**2, self.__sig_x2**2])) self.__p_mat = self.__p_mat_0 # process noise self.__sig_w1 = 100 self.__sig_w2 = 100 self.__q_mat = np.array(np.diag([self.__sig_w1**2, self.__sig_w2**2])) # measurement noise # --> see measurement_covariance_model # self.__sig_r = 10 # self.__r_mat = self.__sig_r ** 2 # initial values and system dynamic (=eye) self.__i_mat = np.eye(2) self.__z_meas = np.zeros(self.__tx_num) self.__y_est = np.zeros(self.__tx_num) self.__r_dist = np.zeros(self.__tx_num)
import rf import rf_tools import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab wp_filename = 'wp_list_test_06_2018.txt' x0 = [80, 500, 0] xn = [1500, 1200, np.pi] dxdy = [50, 50, (np.pi * (1 / 100))] rf_tools.wp_generator(wp_filename, x0, xn, dxdy, 3, True) rf_tools.analyze_measdata_from_file('lin') Rf = rf.RfEar(434.2e6, 8e4) freq6tx = [434.00e6, 434.1e6, 434.30e6, 434.45e6, 434.65e6, 433.90e6] tx_6pos = [[520, 430, 0], [1540, 430, 0], [2570, 430, 0], [2570, 1230, 0], [1540, 1230, 0], [520, 1230, 0]] Rf.set_txparams(freq6tx, tx_6pos) Rf.set_samplesize(32) Rf.plot_power_spectrum_density() #Rf.plot_txrss_live() """ #Rf.get_performance() #cal.plot_txrss_live()
for i in range(numtx): str_rss = str_rss + ', '.join(map(str, dataseq[:, i])) + ', ' measfile.write(str_base_data + str_freqs + str_rss + '\n') measfile.close() return True wplist_filename = 'way_points_cal_hippo_onboard.txt' print(wplist_filename) measdata_filename = 'measdata_onboard_cal_data.txt' print(measdata_filename) oRf = rf.RfEar(center_freq=434.2e6, freqspan=1e5) freq6tx = [434.00e6, 434.15e6, 434.30e6, 434.45e6, 434.65e6, 433.90e6] tx_6pos = [[520, 430], [1540, 430], [2570, 430], [2570, 1230], [1540, 1230], [530, 1230]] oRf.set_txparams(freq6tx, tx_6pos) freqtx, numtx, tx_abs_pos = oRf.get_txparams() #manual_measurement_sequence(wplist_filename, measdata_filename, numtx, tx_abs_pos, freqtx) rf_tools.analyze_measdata_from_file(b_onboard=True, measfilename=measdata_filename)
#rf_tools.wp_generator(wp_filename, x0, xn, dxdy, 5.0, True) txpos_offset = np.array([0, 0]) txpos_tuning = [ [0, 0], # 433.9MHz [0, 0], # 434.1MHz [0, 0], # 434.3MHz [0, 0] ] # 434.5MHz analyze_tx = [1, 2, 3, 4] #rf_tools.analyse_measdata_from_file(analyze_tx, txpos_tuning) Rf = rf.RfEar(434.2e6, 2e4) freqtx = [433.9e6, 434.15e6, 434.40e6, 434.65e6] tx_pos = [[790, 440], [2530, 460], [2530, 1240], [790, 1230]] Rf.set_txparams(freqtx, tx_pos) Rf.set_samplesize(32) #Rf.plot_power_spectrum_density() #Rf.plot_txrss_live() #cal.get_performance() #cal.plot_txrss_live() """ freqspan = 2e4 freqcenter = np.mean(freqtx)