Example #1
0
def findL(S):
    n = len(S)
    IoC = IOC(S)
    ioc = IoC.calcIOC()
    ill = (0.027 * n) / ((ioc * (n - 1)) + 0.065 - (0.038 * n))
    if (ill == 0):
        ill = 1
    return ((ill))
    def _calcIOC(self, string):
        """this calulates the IOC from a passed string"""

        ob = IOC(string)
        ioc = ob.calcIOC()

        if (self.verbose == 1):
            print(ioc)

        return (ioc)
Example #3
0
 def __init__(self, url_site=None, verbose=False):
     # Estructura del diccionario -> {"raiz_cms": [Objeto_Analizer (, url_donde_se_encontro_websh)]}
     self.cms_dict = {}
     self.current_site = url_site
     self.lock = Lock()
     self.verbose = verbose
     self.ioc = IOC(verbose=verbose)
def calcIOC(string, verbose=0):
    """this calulates the IOC from a passed string"""
    ob = IOC(string)
    ioc = ob.calcIOC

    if (verbose == 1):
        print(ioc)

    return (ioc)
Example #5
0
    goal_q = toQuaternion(0, [0, 0, 1])
    goal_w_B = [0, 0, 0]
    target = goal_p_I + goal_v_I + goal_q + goal_w_B

############################### Perform optimal control ###############################
T = 5  # number of control intervals
dt = 0.1
nT = int(10 / 0.1)

OCsys = OC()
OCsys.getTraj(dyn, init, target, T)
x_his = OCsys.x_his
u_his = OCsys.u_his

############################### IOC ###############################
IOCsys = IOC()
IOCsys.getdPhi(OCsys.x_his, OCsys.u_his, OCsys.PHI)
IOCsys.getdf(OCsys.x_his, OCsys.u_his, OCsys.DYN)
IOCsys.IOC_main(IOCsys.dfdx_his, IOCsys.dfdu_his, IOCsys.dphidx_his,
                IOCsys.dphidu_his)

omega = IOCsys.omega / min(IOCsys.omega)  #normalize omega
print('Omega =', omega)

############################### Pendulum and LTI trajectory ###############################
if dyn == 'LTI' or dyn == 'Pendulum':

    x_his = np.concatenate(x_his, axis=1)
    u_his = np.concatenate(u_his, axis=1)

    fig, axs = plt.subplots(2)