Mission Control

Core Switch Logic
Mission Queue
Always Ran

send sensor data every 100 ms

send actuator data every 100 ms

create vTask

mission_control_initiate(task_priority)

_task(void *params)

mission_control_handle_command(cJSON *json)

Should be startup function

Things that need to always happen continuously

UAV State

STATE_IDLE STATE_MODULE_STARTUP STATE_MODULE_CORE STATE_MODULE_TEARDOWN

switch(UAV STATE)

STATE_IDLE

check if there's something in the mission queue

run current_mission->startup_fun

pop mission from queue

set current_mission

set UAV STATE -> STATE_MODULE_STARTUP

run current_mission->teardown_fun

set UAV_STATE -> STATE_MODULE_IDLE

STATE_MODULE_TEARDOWN

calibrate sensors

turn on all sensors

while (true)

STATE_MODULE_STARTUP

set UAV_STATE -> STATE_MODULE_TEARDOWN

set UAV STATE -> STATE_MODULE_CORE

STATE_MODULE_CORE

run current_mission->core_fun

if (current_mission->completed)

sleep(10)

mission queue

mission struct ![[Mission Control#mission_t]]

...

...

Static Variables ![[Mission Control#Static Variables]]

Link to original

Variables

Static Variables

mission_t : current_mission
enum : uav_state
queue : mission_queue

Variable Definitions

mission_t

struct

bool : completed
int : status
void * : data
void * : setup_func
void * : core_func
void * : teardown_func

uav_state

enum


queue

Handle Command

mission_control_handle_command