예제 #1
0
import matplotlib.pyplot as plt
import sys

sys.path.append('..')
import massParam as P
from hw1.signalGenerator import signalGenerator
from hw1.massAnimation import massAnimation
from hw1.dataPlotter import dataPlotter
from hw2.massDynamics import massDynamics
from massController import massController
from dataPlotterObserver import dataPlotterObserver

# instantiate mass, controller, and reference classes
mass = massDynamics()
controller = massController()
reference = signalGenerator(amplitude=1.0, frequency=1.0)
disturbance = signalGenerator(amplitude=0.0)

# instantiate the simulation plots and animation
dataPlot = dataPlotter()
animation = massAnimation()
dataPlotObserver = dataPlotterObserver()

t = P.t_start  # time starts at t_start
y = mass.h()

while t < P.t_end:  # main simulation loop
    # Propagate dynamics in between plot samples
    t_next_plot = t + P.t_plot

    # updates control and dynamics at faster simulation rate
예제 #2
0
파일: ballbeamSim.py 프로젝트: mebach/me431
import matplotlib.pyplot as plt
import sys
sys.path.append('..')
import ballbeamParam as P
from hw1.signalGenerator import signalGenerator
from hw1.ballbeamAnimation import ballbeamAnimation
from hw1.dataPlotter import dataPlotter
from hw2.ballbeamDynamics import ballbeamDynamics
from ballbeamController import ballbeamController

# instantiate ball beam, controller, and reference classes
ballbeam = ballbeamDynamics(alpha=0.0)
controller = ballbeamController()
reference = signalGenerator(amplitude=0.15, frequency=0.01, y_offset=0.25)
disturbance = signalGenerator(amplitude=0.0)
noise = signalGenerator(amplitude=0.01)

# instantiate the simulation plots and animation
dataPlot = dataPlotter()
animation = ballbeamAnimation()

t = P.t_start  # time starts at t_start
y = ballbeam.h()  # output at the start of the simulation

while t < P.t_end:  # main simulation loop
    # Propagate dynamics at rate Ts
    t_next_plot = t + P.t_plot

    while t < t_next_plot:
        r = reference.square(t)
        d = disturbance.step(t)
예제 #3
0
파일: VTOLSim.py 프로젝트: mebach/me431
import matplotlib.pyplot as plt
import numpy as np
import sys

sys.path.append('..')
import VTOLParam as P
from hw1.signalGenerator import signalGenerator
from hw1.VTOLAnimation import VTOLAnimation
from hw1.dataPlotter import dataPlotter
from hw2.VTOLDynamics import VTOLDynamics
from VTOLController import VTOLController

# instantiate VTOL, controller, and reference classes
VTOL = VTOLDynamics()
controller = VTOLController()
z_reference = signalGenerator(amplitude=2.5, frequency=0.1, y_offset=3.0)
h_reference = signalGenerator(amplitude=3.0, frequency=0.1, y_offset=5.0)
f_l = signalGenerator(amplitude=50.0, frequency=0.5)
f_r = signalGenerator(amplitude=50.0, frequency=0.5)

# instantiate the simulation plots and animation
dataPlot = dataPlotter()
animation = VTOLAnimation()

t = P.t_start  # times starts at t_start
y = VTOL.h()

while t < P.t_end:

    # Propagate dynamics in between plot samples
    t_next_plot = t + P.t_plot
예제 #4
0
파일: ballbeamSim.py 프로젝트: mebach/me431
import matplotlib.pyplot as plt
import sys
sys.path.append('..')
import ballbeamParam as P
from hw1.signalGenerator import signalGenerator
from hw1.ballbeamAnimation import ballbeamAnimation
from hw1.dataPlotter import dataPlotter
from ballbeamDynamics import ballbeamDynamics

# instantiate ball beam, controller, and reference classes
ballbeam = ballbeamDynamics(alpha=0.0)
reference = signalGenerator(amplitude=0.5, frequency=0.02)
force = signalGenerator(amplitude=8.0, frequency=0.8)

# instantiate the simulation plots and animation
dataPlot = dataPlotter()
animation = ballbeamAnimation()

t = P.t_start  # time starts at t_start
while t < P.t_end:  # main simulation loop

    # Propagate dynamics at rate Ts
    t_next_plot = t + P.t_plot
    while t < t_next_plot:
        r = reference.square(t)
        u = force.sin(t)
        y = ballbeam.update(u)  # propagate the dynamics
        t = t + P.Ts  # advance time by Ts

    # update animation and data plots at rate t_plot
    animation.update(ballbeam.state)
예제 #5
0
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('..')  # add parent directory
import VTOLParam as P
from hw2.VTOLDynamics import VTOLDynamics
from VTOLController import VTOLController
from hw1.signalGenerator import signalGenerator
from hw1.VTOLAnimation import VTOLAnimation
from hw1.dataPlotter import dataPlotter

# instantiate VTOL, controller, and reference classes
VTOL = VTOLDynamics()
controller = VTOLController()
z_reference = signalGenerator(amplitude=4.0, frequency=0.02, y_offset=5.0)
h_reference = signalGenerator(amplitude=3.0, frequency=0.03, y_offset=5.0)
F_disturbance = signalGenerator(amplitude=1.0)
tau_disturbance = signalGenerator(amplitude=0.2)
z_noise = signalGenerator(amplitude=0.01, frequency=100.0 * 2 * np.pi)
h_noise = signalGenerator(amplitude=0.05, frequency=100.0 * 2 * np.pi)
th_noise = signalGenerator(amplitude=0.01, frequency=100.0 * 2 * np.pi)

# instantiate the simulation plots and animation
dataPlot = dataPlotter()
animation = VTOLAnimation()

t = P.t_start  # time starts at t_start
y = VTOL.h()  # output of system at start of simulation
while t < P.t_end:  # main simulation loop
    # Propagate dynamics in between plot samples
    t_next_plot = t + P.t_plot
예제 #6
0
import sys
sys.path.append('..')  # add parent directory
import matplotlib.pyplot as plt
import numpy as np
import massParam as P
from hw2.massDynamics import massDynamics
from massController import massController
from hw1.signalGenerator import signalGenerator
from hw1.massAnimation import massAnimation
from hw1.dataPlotter import dataPlotter

# instantiate satellite, controller, and reference classes
mass = massDynamics()
controller = massController()
reference = signalGenerator(amplitude=0.5, frequency=0.04)
disturbance = signalGenerator(amplitude=0.25)
noise = signalGenerator(amplitude=0.01, frequency=2.0 * np.pi * 500)

# instantiate the simulation plots and animation
dataPlot = dataPlotter()
animation = massAnimation()

t = P.t_start  # time starts at t_start
y = mass.h()  # output of system at start of simulation
while t < P.t_end:  # main simulation loop
    # Propagate dynamics in between plot samples
    t_next_plot = t + P.t_plot
    while t < t_next_plot:  # updates control and dynamics at faster simulation rate
        r = reference.square(t)  # reference input
        d = disturbance.step(t)  # input disturbance
        n = noise.sin(t)  # simulate sensor noise
예제 #7
0
파일: VTOLSim.py 프로젝트: mebach/me431
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('..')
import VTOLParam as P
from hw1.signalGenerator import signalGenerator
from hw1.VTOLAnimation import VTOLAnimation
from hw1.dataPlotter import dataPlotter
from VTOLDynamics import VTOLDynamics

# instantiate VTOL, controller, and reference classes
VTOL = VTOLDynamics()
reference = signalGenerator(amplitude=0.5, frequency=0.1)
f_l = signalGenerator(amplitude=50.0, frequency=0.5)
f_r = signalGenerator(amplitude=50.0, frequency=0.5)

# instantiate the simulation plots and animation
dataPlot = dataPlotter()
animation = VTOLAnimation()

t = P.t_start  # times starts at t_start
while t < P.t_end:

    # Propagate dynamics in between plot samples
    t_next_plot = t + P.t_plot

    # updates control and dynamics at faster simulation rate
    while t < t_next_plot:
        r = reference.square(t)
        u = np.array([[f_l.sin(t)], [f_r.sin(t)]])
        y = VTOL.update(u)