import os try: from nephelae_scenario import Scenario # Find a way to give this as an argument to the server ! scenario = Scenario(os.environ['NEPHELAE_CONFIG']) scenario.load() scenario.start() websockets_cloudData_ids = {} refreshers = {} # Legacy variables. To remove when conversion to scenario is completed db = scenario.database # Defines displayable samples, to keep for now. Find an alternative to put in scenario # db_data_tags = ['RCT', 'WT', 'THT'] # db_data_tags = ['RCT', 'WT', 'THT', 'temperature', 'pressure', 'cloud_channel_0', 'cloud_channel_1'] # db_data_tags = [ 'pressure', 'humidity', 'temperature', 'cloud_channel_0', 'cloud_channel_1', 'RCT', 'WT', 'THT'] db_data_tags = [ 'pressure', 'humidity', 'temperature', 'cloud_channel_0', 'cloud_channel_1' ] # db_data_tags = ['temperature', 'pressure', 'cloud_channel_0', 'cloud_channel_1'] # TODO fix this def on_exit(): print("Shutting down paparazzi interface... ", end='', flush=True) scenario.stop()
# READ THIS FIRST ! ############################ # to make a test run the following commands: # create_mission() -> will create a mission instance # scenario.aircrafts['200'].execute_mission() -> will send the MISSION_CUSTOM message to update the uav # update_mission(hdrift=[7.5, 0.5]) -> will send the MISSION_UPDATE update the [vx, vx] on current mission. # update_mission(zdrift=2.0) -> will send the MISSION_UPDATE update vz on current mission. ################################################ import signal from nephelae_scenario import Scenario from nephelae_paparazzi.common import IvyStop, messageInterface from nephelae_paparazzi.utils import send_lwc scenario = Scenario('config_examples/full_200.yaml') scenario.load() scenario.start() def create_mission(aircraft='200', missionType='Lace', duration=-1.0, start=[-1500.0, 900.0, 700.0], first_turn_direction=1.0, circle_radius=80.0, drift=[-7.5, -0.5, 0.0]): scenario.aircrafts[aircraft].create_mission( missionType=missionType, duration=duration, start=start,
#! /usr/bin/python3 import signal from nephelae_scenario import Scenario from nephelae_paparazzi.common import IvyStop, messageInterface from nephelae_paparazzi.utils import send_lwc scenario = Scenario('../config-files/mapping_200.yaml') scenario.load() scenario.start() flightAreaKeys = [ slice(scenario.flightArea[0][0], scenario.flightArea[1][0]), slice(scenario.flightArea[0][1], scenario.flightArea[1][1]), slice(scenario.flightArea[0][2], scenario.flightArea[1][2]) ] def compute_map(): t0 = scenario.database.last_entry('RCT').position.t print("Current time :", t0) keys = [t0 - 150] + flightAreaKeys return scenario.maps['LWC'][keys] def stop(): if scenario.running: print("Shutting down... ", end='', flush=True) scenario.stop() print("Complete.", flush=True)
#! /usr/bin/python3 import sys sys.path.append('../../') from nephelae_scenario import Scenario scenario = Scenario('config_examples/main01.yaml') scenario.load() print(scenario.parser.yamlStream) print(scenario.config)
def stop(): if scenario.running: print("Shutting down... ", end='', flush=True) scenario.stop() print("Complete.", flush=True) IvyStop() try: get_ipython().ask_exit() except NameError: sys.exit() signal.signal(signal.SIGINT, lambda sig, fr: stop()) configFilename = '../../examples/config/demo_database_only.yaml' scenario = Scenario(configFilename) scenario.load() scenario.start() class Logger: def add_sample(self, sample): print(sample) logger = Logger() gpr = scenario.maps['LWC'] timeview = scenario.dataviews['LWC_time'] # timeview.attach_observer(logger)
# to make a test run the following commands: # create_mission() -> will create a mission instance # scenario.aircrafts['200'].execute_mission() -> will send the MISSION_CUSTOM message to update the uav # update_mission(hdrift=[7.5, 0.5]) -> will send the MISSION_UPDATE update the [vx, vx] on current mission. # update_mission(zdrift=2.0) -> will send the MISSION_UPDATE update vz on current mission. ################################################ import signal from nephelae_scenario import Scenario from nephelae_paparazzi.common import IvyStop, messageInterface from nephelae_paparazzi.utils import send_lwc scenario = Scenario('config/full_200.yaml') scenario.load() scenario.start() def create_mission(aircraft='200', missionType='Lace', duration=-1.0, start=[-1500.0, 900.0, 700.0], first_turn_direction=1.0, circle_radius=80.0, drift=[-7.5,-0.5,0.0]): scenario.aircrafts[aircraft].create_mission( missionType=missionType, duration=duration, start=start, first_turn_direction=first_turn_direction, circle_radius=circle_radius, drift=drift) # Do a scenario.aircrafts['200'].execute_mission() to send mission to aircraft # (no mission list managed for now)
# to make a test run the following commands: # create_mission() -> will create a mission instance # scenario.aircrafts['200'].execute_mission() -> will send the MISSION_CUSTOM message to update the uav # update_mission(hdrift=[7.5, 0.5]) -> will send the MISSION_UPDATE update the [vx, vx] on current mission. # update_mission(zdrift=2.0) -> will send the MISSION_UPDATE update vz on current mission. ################################################ import signal from nephelae_scenario import Scenario from nephelae_paparazzi.common import IvyStop, messageInterface from nephelae_paparazzi.utils import send_lwc scenario = Scenario('config/missions_only_200.yaml') scenario.load() scenario.start() def create_mission(aircraft='200', missionType='Lace', duration=-1.0, start=[-1500.0, 900.0, 700.0], first_turn_direction=1.0, circle_radius=80.0, drift=[-7.5,-0.5,0.0]): scenario.aircrafts[aircraft].create_mission( missionType=missionType, duration=duration, start=start, first_turn_direction=first_turn_direction, circle_radius=circle_radius, drift=drift) # Do a scenario.aircrafts['200'].execute_mission() to send mission to aircraft # (no mission list managed for now)