Exemplo n.º 1
0
def launch_benchmark(with_nees):
    global radars, filter, attacker, states
    benchmark = Benchmark(radars=radars,
                          radar_filter=filter,
                          states=states,
                          attacker=attacker)
    benchmark.launch_benchmark(with_nees=with_nees)
Exemplo n.º 2
0
    def compute_nees(self, qs):
        '''
        Computes the average Normalized Estimated Error Squared (nees) for a given
        filter and list process noises qs.
        Parameters
        ----------
        qs: float iterable
            Process noises to be tested.

        Returns
        -------
        mean_nees: float
            Average nees of the tested filter/process noise.
        '''
        x0 = self.states[0, 0]
        y0 = self.states[0, 3]
        z0 = self.states[0, 6]
        filters_to_be_tested = []
        for filter, q in zip(self.filters, qs):
            current_filter = filter(dim_x=9,
                                    dim_z=3,
                                    radar=self.radar,
                                    q=q,
                                    x0=x0,
                                    y0=y0,
                                    z0=z0)
            filters_to_be_tested.append(current_filter)
        imm = IMMEstimator(mu=self.mu, M=self.trans, filters=self.filters)
        benchmark = Benchmark(radar=self.radar,
                              radar_filter=imm,
                              states=self.states)
        benchmark.launch_benchmark(with_nees=True, plot=False)
        return benchmark.nees
def gen_env():
    trajectory = Track()
    states = trajectory.gen_landing()
    x0 = states[0, 0]
    y0 = states[0, 3]
    z0 = states[0, 6]
    radar = Radar(x=0, y=2000)

    radar_filter_cv = RadarFilterCV(dim_x=9,
                                    dim_z=3,
                                    q=1.,
                                    x0=x0,
                                    y0=y0,
                                    z0=z0,
                                    radar=radar)
    radar_filter_ca = RadarFilterCA(dim_x=9,
                                    dim_z=3,
                                    q=400.,
                                    x0=x0,
                                    y0=y0,
                                    z0=z0,
                                    radar=radar)
    radar_filter_ct = RadarFilterCT(dim_x=9,
                                    dim_z=3,
                                    q=350.,
                                    x0=x0,
                                    y0=y0,
                                    z0=z0,
                                    radar=radar)
    filters = [radar_filter_cv, radar_filter_ca, radar_filter_ct]
    mu = [0.33, 0.33, 0.33]
    trans = np.array([[0.998, 0.001, 0.001], [0.050, 0.900, 0.050],
                      [0.001, 0.001, 0.998]])
    imm = IMMEstimator(filters, mu, trans)

    benchmark_imm3 = Benchmark(radars=radar, radar_filter=imm, states=states)
    benchmark_imm3.launch_benchmark(with_nees=True)
    radars = [radar1, radar2]
    radar_filter_cv = MultipleRadarsFilterCV(dim_x=9,
                                             dim_z=6,
                                             q=1.,
                                             radars=radars,
                                             x0=x0,
                                             y0=y0,
                                             z0=z0)
    radar_filter_ca = MultipleRadarsFilterCA(dim_x=9,
                                             dim_z=6,
                                             q=400.,
                                             radars=radars,
                                             x0=x0,
                                             y0=y0,
                                             z0=z0)
    radar_filter_ct = MultipleRadarsFilterCT(dim_x=9,
                                             dim_z=6,
                                             q=350.,
                                             radars=radars,
                                             x0=x0,
                                             y0=y0,
                                             z0=z0)
    filters = [radar_filter_cv, radar_filter_ca, radar_filter_ct]
    mu = [0.33, 0.33, 0.33]
    trans = np.array([[0.998, 0.001, 0.001], [0.050, 0.900, 0.050],
                      [0.001, 0.001, 0.998]])
    imm = IMMEstimator(filters, mu, trans)

    benchmark_imm3 = Benchmark(radars=radars, radar_filter=imm, states=states)
    benchmark_imm3.launch_benchmark(with_nees=True)
Exemplo n.º 5
0
                                                   z0=z0)
    filters = [radar_filter_cv, radar_filter_ca, radar_filter_ct]
    mu = [0.33, 0.33, 0.33]
    trans = np.array([[0.998, 0.001, 0.001], [0.050, 0.900, 0.050],
                      [0.001, 0.001, 0.998]])
    imm = RadarIMM(filters, mu, trans)

    # =============================== Attackers ================================
    ## No attacker
    # attacker = None

    ## Attackers for 2 Period Radars
    # attacker = DriftPeriodAttacker(filter = imm, t0 = 500, time = 300,
    #                                attack_drift = np.array([[100,100,100]]).T,
    #                                radar = pradar2, radar_pos = 1)

    attacker = CumulativeDriftPeriodAttacker(filter=imm,
                                             t0=300,
                                             time=2000,
                                             delta_drift=np.array([[0, 0,
                                                                    1]]).T,
                                             radar=pradar2,
                                             radar_pos=1)

    # =============================== Benchmark ================================
    benchmark = Benchmark(radars=pradars,
                          radar_filter=imm,
                          states=states,
                          attacker=attacker)
    benchmark.launch_benchmark(with_nees=True)