Пример #1
0
    triangular_stack_list,output_feedback_synthesis_lightweight_many_variables
from pypolytrajectory.system import LQG_LTV,LTV,LQG
import scipy.linalg as spa

# pypolycontain
from pypolycontain.visualization.visualize_2D import visualize_2D_zonotopes_ax as visZax

#np.random.seed(0)

"""
Environment Generation
"""
K=10
n=2*K+3
v,dt,g,d_0=1,0.429,-10,1
S=LTV()
T=int((K+d_0)/(v*dt))+1

gap_bar,step_var,gap_var=1,0.3,0.1
x0_bar=np.zeros((n,1))
G=np.zeros((n,n))
x0_bar[0,0],x0_bar[1,0]=-d_0,0
G[0,0]=0 # Variation in x
G[1,1]=0 # Variation in speed
G[2,2]=0 # Variation in height
for i in range(K):
    x0_bar[3+2*i+1]=gap_bar
    G[3+2*i+1,3+2*i+1]=gap_var
    for j in range(K-i):
        G[3+2*i+2*j,3+2*i]=step_var
      
Пример #2
0
        ax.set_xlim(
            [min(points_convex_all[:, 0]),
             max(points_convex_all[:, 0])])
        ax.set_ylim(
            [min(points_convex_all[:, 1]),
             max(points_convex_all[:, 1])])
    return ax


#np.random.seed(0)
"""
Parameters
"""
m, m_h, a, b = 2, 2, 0.5, 0.5
n = 4
S = LTV()
dt, T, g = 0.04, 45, 10
l = a + b

M = np.array([[(m_h + m) * l**2 + m * a**2, m * l * b], [m * l * b, m * b**2]])
Minv = np.linalg.pinv(M)
tau_g = g * np.array([[m_h * l + m * a + m * l, 0], [0, -m * b]])

for t in range(T):
    S.A[t] = np.eye(n)
    S.A[t][0, 2], S.A[t][1, 3] = dt, dt
    S.A[t][2:, 0:2] = np.dot(Minv, tau_g) * dt
    Bq = np.dot(Minv, np.array([1, 1])) * dt
    S.B[t] = np.array([0, 0, Bq[0], Bq[1]]).reshape(4, 1)
    #    S.B[t]=np.array([0,0,1,1]).reshape(4,1)
    #    S.B[t]=np.array([[0,0,1,0],[0,0,0,1]]).T
Пример #3
0
@author: sadra
"""

import numpy as np
from pypolytrajectory.LTV import system, test_controllability
from pypolytrajectory.reduction import reduced_order, order_reduction_error, error_construction, error_construction_old
from pypolycontain.lib.objects import zonotope
from pypolycontain.lib.zonotope_order_reduction.methods import G_cut, Girard
from pypolytrajectory.synthesis import output_feedback_synthesis,outputfeedback_synthesis_zonotope_solution,\
    triangular_stack_list,output_feedback_synthesis_lightweight_many_variables
from pypolytrajectory.system import LQG_LTV, LTV, LQG
import scipy.linalg as spa

np.random.seed(0)

S = LTV()
n = 20
m = 1
o = 1
z = 20
T = 58
S.X0 = zonotope(np.ones((n, 1)) * 0, np.eye(n) * 1)
B = np.random.randint(0, 2, size=(n, m))
B[0, 0] = 1
B[1, 0] = 0
A = 0.9 * np.eye(n) + np.random.randint(-100, 100, size=(n, n)) * 0.01 * 0.15
C = np.zeros((o, n))
C[0, 0] = 1
#C[1,1]=1
D = np.eye(n)[0:z, :]
#A=np.array([[0.28,0.25,-0.19,-0.22,0.03,-0.50],
Пример #4
0
import numpy as np
from pypolytrajectory.LTV import system, test_controllability
from pypolytrajectory.reduction import reduced_order, order_reduction_error, error_construction, error_construction_old
from pypolycontain.lib.objects import zonotope
from pypolycontain.lib.zonotope_order_reduction.methods import G_cut, Girard
from pypolytrajectory.synthesis import output_feedback_synthesis,outputfeedback_synthesis_zonotope_solution,\
    triangular_stack_list,output_feedback_synthesis_lightweight_many_variables
from pypolytrajectory.system import LQG_LTV, LTV, LQG
import scipy.linalg as spa

np.random.seed(0)
S = LTV()
n = 1000
m = 2
o = 1
z = 1
T = 32
S.X0 = zonotope(np.ones((n, 1)) * 0, np.eye(n) * 1)
B = np.random.randint(0, 2, size=(n, m))
B[0, 0] = 0
#B[1,0]=0
A = 0.995 * np.eye(n) + np.random.randint(-100, 100,
                                          size=(n, n)) * 0.01 * 0.005
C = np.zeros((o, n))
C[0, 0] = 1
#C[1,1]=1
D = np.eye(n)[0:z, :]
#A=np.array([[0.28,0.25,-0.19,-0.22,0.03,-0.50],
#                 [0.25,-0.47,0.30,0.17,-0.11,-0.11],
#                 [-0.19,0.30,0.46,0.09,-0.02,-0.08],
#                 [-0.22,0.17,0.09,0.60,-0.06,0.14],
Пример #5
0
Created on Mon Jun 24 18:53:03 2019

@author: sadra
"""

import numpy as np
from pypolytrajectory.LTV import system,test_controllability
from pypolytrajectory.reduction import reduced_order,order_reduction_error,error_construction,error_construction_old
from pypolycontain.lib.objects import zonotope
from pypolycontain.lib.zonotope_order_reduction.methods import G_cut,Girard
from pypolytrajectory.synthesis import synthesis_disturbance_feedback,zonotopic_controller,synthesis,zonotopic_controller_soft
from pypolytrajectory.system import LQG_LTV,LTV,LQG


 
S=LTV()
n=5
m=1
o=1
T=58
S.X0=zonotope(np.ones((n,1))*0,np.eye(n)*1)
B=np.random.randint(0,2,size=(n,m))
B[0,0]=1
B[1,0]=0
A=0.0*np.eye(n)+np.random.normal(size=(n,n))*0.6
C=np.zeros((o,n))
C[0,0]=1
#A=np.array([[0.28,0.25,-0.19,-0.22,0.03,-0.50],
#                 [0.25,-0.47,0.30,0.17,-0.11,-0.11],
#                 [-0.19,0.30,0.46,0.09,-0.02,-0.08],
#                 [-0.22,0.17,0.09,0.60,-0.06,0.14],
Пример #6
0
def test_LQG_LTV():
    S=LTV()
    print S.R
    n=7
    m=1
    o=1
    T=55
    np.random.seed(212)
    S.X0=zonotope(np.ones((n,1))*0,np.eye(n)*1)
    for t in range(T):
        S.A[t]=0.95*np.eye(n)+np.random.normal(size=(n,n))*0.01
        S.B[t]=np.random.randint(0,2,size=(n,m))
        S.C[t]=np.zeros((o,n))
        S.C[t][0,0]=1
        S.W[t]=zonotope(np.zeros((n,1)),np.eye(n)*0.01)
        S.V[t]=zonotope(np.zeros((o,1)),np.eye(o)*0.01)
        S.Q[t]=np.eye(n)*1
        S.R[t]=np.eye(m)*1
        S.F=np.eye(n)*1
    L,K=LQG_LTV(S,T=50)