コード例 #1
0
    ## kalman filter parameters

    #the actual, hidden state
    actual = numpy.array([[0, 5]])

    #the sensor
    sensor = Mvn(vectors=[[1, 0], [0, 1]], var=[1, numpy.inf])

    #the system noise
    noise = Mvn(vectors=[[1, 0], [0, 1]], var=numpy.array([0.5, 1])**2)

    #the shear transform to move the system forward
    transform = Matrix([[1, 0], [0.5, 1]])

    filtered = sensor.measure(actual)

    ## initial plot

    ax = newAx(fig)

    #plot the initial actual position
    ax.plot(actual[:, 0], actual[:, 1], **actualParams)
    ax.set_title('Kalman Filtering: Start')
    pylab.xlabel('Position')
    pylab.ylabel('Velocity')
    P.publish(fig)

    #measure the actual position, and plot the measurment
    filtered.plot(facecolor=colors['Filter Result'], **otherParams)
    ax.set_title('Initialize to first measurement')
コード例 #2
0
ファイル: kalman.py プロジェクト: 9578577/mvn
    ## kalman filter parameters

    #the actual, hidden state
    actual = numpy.array([[0, 5]])

    #the sensor
    sensor = Mvn(vectors = [[1, 0], [0, 1]],var = [1, numpy.inf])

    #the system noise
    noise = Mvn(vectors = [[1, 0], [0, 1]], var = numpy.array([0.5, 1])**2)

    #the shear transform to move the system forward
    transform = Matrix([[1, 0], [0.5, 1]])

    filtered = sensor.measure(actual)


    ## initial plot

    ax = newAx(fig)
    
    #plot the initial actual position
    ax.plot(actual[:, 0], actual[:, 1], **actualParams)
    ax.set_title('Kalman Filtering: Start')
    pylab.xlabel('Position')
    pylab.ylabel('Velocity')    
    P.publish(fig)