con = {0: [-0.8, 0.3], 1: [-2.0, 2.0]} # now we create our Trajectory object and alter some method parameters via the keyword arguments S = ControlSystem(f, a, b, xa, xb, ua, ub, constraints=con, kx=5, use_chains=False) # time to run the iteration S.solve() # the following code provides an animation of the system above # for a more detailed explanation have a look at the 'Visualisation' section in the documentation import sys import matplotlib as mpl from pytrajectory.visualisation import Animation def draw(xt, image): x = xt[0] phi = xt[2] car_width = 0.05 car_heigth = 0.02
# boundary values for the inputs ua = [0.5*9.81*50.0/(cos(5/360.0*2*pi)), 0.5*9.81*50.0/(cos(5/360.0*2*pi))] ub = [0.5*9.81*50.0/(cos(5/360.0*2*pi)), 0.5*9.81*50.0/(cos(5/360.0*2*pi))] # create trajectory object S = ControlSystem(f, a=0.0, b=3.0, xa=xa, xb=xb, ua=ua, ub=ub) # don't take advantage of the system structure (integrator chains) # (this will result in a faster solution here) S.set_param('use_chains', False) # also alter some other method parameters to increase performance S.set_param('kx', 5) # run iteration S.solve() # the following code provides an animation of the system above # for a more detailed explanation have a look at the 'Visualisation' section in the documentation import sys import matplotlib as mpl from pytrajectory.visualisation import Animation def draw(xti, image): x, y, theta = xti[0], xti[2], xti[4] S = np.array( [ [0, 0.3], [-0.1, 0.1], [-0.7, 0], [-0.1, -0.05], [ 0, -0.1],
u1] return ff # system state boundary values for a = 0.0 [s] and b = 2.0 [s] xa = [0.0, 0.0] xb = [1.0, 0.0] # constraints dictionary con = {1 : [-0.1, 0.65]} # create the trajectory object S = ControlSystem(f, a=0.0, b=2.0, xa=xa, xb=xb, constraints=con, use_chains=False) # start x, u = S.solve() # the following code provides an animation of the system above # for a more detailed explanation have a look at the 'Visualisation' section in the documentation import sys import matplotlib as mpl from pytrajectory.visualisation import Animation def draw(xt, image): x = xt[0] car_width = 0.05 car_heigth = 0.02 x_car = x
xb = [1.0, 0.0] # constraints dictionary con = {1: [-0.1, 0.65]} # create the trajectory object S = ControlSystem(f, a=0.0, b=2.0, xa=xa, xb=xb, constraints=con, use_chains=False) # start x, u = S.solve() # the following code provides an animation of the system above # for a more detailed explanation have a look at the 'Visualisation' section in the documentation import sys import matplotlib as mpl from pytrajectory.visualisation import Animation def draw(xt, image): x = xt[0] car_width = 0.05 car_heigth = 0.02 x_car = x