Loading...
Searching...
No Matches
stateupdate.h
1#ifndef _STATE_H
2#define _STATE_H
3
4#include "FreeRTOS.h"
5#include "event_groups.h"
6#include "groups.h"
7#include "handles.h"
8#include "message_buffer.h"
9#include "semphr.h"
10#include "task.h"
11
12#include "can.h"
13#include "dataframe.h"
14#include "devices.h"
15#include "kx134_1211.h"
16#include "params.h"
17#include "quaternion.h"
18#include "sensors.h"
19#include "slidingwindow.h"
20
21void vStateUpdate(void *pvParameters);
22
23enum State {
24 PRELAUNCH,
25 LAUNCH,
26 COAST,
27 APOGEE,
28 DESCENT
29};
30
31typedef struct {
32 enum State currentState;
33 Quaternion qRot; // Global attitude quaternion
34 float vAttitude[3]; // Attitude vector
35 float zUnit[3]; // Z unit vector
36 float cosine; // Tilt angle cosine
37 float tilt; // Tilt angle
38
39 // Flight dynamics state variables
40 float altitude; // Current altitude
41 float velocity; // Current vertical velocity
42 SlidingWindow avgPress;
43 SlidingWindow avgVel;
44} ctxState;
45
46typedef struct {
47 ctxState *state;
48 Handles *handles;
50
51#endif