コード例 #1
0
ファイル: mavsim_chap8.py プロジェクト: mjhaskell/EE_674_py
"""
import sys
sys.path.append('..')
import numpy as np
import params.sim_params as SIM

from chap2.mav_viewer import mav_viewer
from chap3.data_viewer import data_viewer
from chap7.mav_dynamics import mav_dynamics
from chap4.wind_simulation import wind_simulation
from chap6.autopilot import autopilot
from chap8.observer import observer
from tools.signals import signals

# initialize the visualization
mav_view = mav_viewer()  # initialize the mav viewer
data_view = data_viewer()  # initialize view of data plots

# initialize elements of the architecture
wind = wind_simulation(SIM.ts_simulation)
mav = mav_dynamics(SIM.ts_simulation)
ctrl = autopilot(SIM.ts_simulation)
obsv = observer(SIM.ts_simulation)

# autopilot commands
from message_types.msg_autopilot import msg_autopilot
commands = msg_autopilot()
Va_command = signals(dc_offset=25.0,
                     amplitude=3.0,
                     start_time=2.0,
                     frequency=0.01)
コード例 #2
0
# import viewers and video writer
from chap2.mav_viewer import mav_viewer
from chap2.video_writer import video_writer

# import parameters
import parameters.simulation_parameters as SIM
# import message types
from message_types.msg_state import msg_state

# initialize messages
state = msg_state()  # instantiate state message

# initialize viewers and video
VIDEO = False  # True==write video, False==don't write video
mav_view = mav_viewer()
if VIDEO == True:
    video = video_writer(video_name="chap2_video.avi",
                         bounding_box=(0, 0, 1000, 1000),
                         output_rate=SIM.ts_video)

# initialize the simulation time
sim_time = SIM.start_time

# main simulation loop
while sim_time < SIM.end_time:
    #-------vary states to check viewer-------------
    if sim_time < SIM.end_time / 6:
        state.pn += 10 * SIM.ts_simulation
    elif sim_time < 2 * SIM.end_time / 6:
        state.pe += 10 * SIM.ts_simulation
コード例 #3
0
ファイル: hw1.py プロジェクト: mjhaskell/EE_674_py
import sys
sys.path.append('..')

from chap2.mav_viewer import mav_viewer
from message_types.msg_state import msg_state

mv = mav_viewer()
state = msg_state()

for i in range(500):
    state.pn = state.pn + 0.1
    mv.update(state)

for i in range(500):
    state.pe = state.pe + 0.1
    mv.update(state)

for i in range(500):
    state.h = state.h + 0.1
    mv.update(state)

for i in range(1000):
    state.psi = state.psi + 3.14159 * 2 / 1000.0
    mv.update(state)

for i in range(1000):
    state.theta = state.theta + 3.14159 * 2 / 1000.0
    mv.update(state)

for i in range(1000):
    state.phi = state.phi + 3.14159 * 2 / 1000.0
コード例 #4
0
# import viewers and video writer
from chap2.mav_viewer import mav_viewer
from chap2.video_writer import video_writer

# import parameters
import parameters.simulation_parameters as SIM
# import message types
from message_types.msg_state import msg_state

# initialize messages
state = msg_state()  # instantiate state message

# initialize viewers and video
VIDEO = False  # True==write video, False==don't write video
spacecraft_view = mav_viewer()
if VIDEO == True:
    video = video_writer(video_name="chap2_video.avi",
                         bounding_box=(0, 0, 1000, 1000),
                         output_rate=SIM.ts_video)

# initialize the simulation time
sim_time = SIM.start_time

# main simulation loop
while sim_time < SIM.end_time:
    #-------vary states to check viewer-------------
    if sim_time < SIM.end_time / 6:
        state.pn += 10 * SIM.ts_simulation
    elif sim_time < 2 * SIM.end_time / 6:
        state.pe += 10 * SIM.ts_simulation
コード例 #5
0
from chap2.mav_viewer import mav_viewer
# from chap2.video_writer import video_writer

# import parameters
import parameters.simulation_parameters as SIM
# import message types
from message_types.msg_state import msg_state

# initialize messages
state = msg_state()  # instantiate state message

# initialize viewers and video
# VIDEO = False  # True==write video, False==don't write video

# craft_view = spacecraft_viewer()
craft_view = mav_viewer()

# if VIDEO == True:
#     video = video_writer(video_name="chap2_video.avi",
#                          bounding_box=(0, 0, 1000, 1000),
#                          output_rate=SIM.ts_video)

# initialize the simulation time
sim_time = SIM.start_time

# main simulation loop
while sim_time < SIM.end_time:
    #-------vary states to check viewer-------------
    if sim_time < SIM.end_time/6:
        state.pn += 10*SIM.ts_simulation
    elif sim_time < 2*SIM.end_time/6: