gotta check ctrl algo - it gives negative value
Fork of BAE_hw_test1_3 by
HK.h@11:6b00f3b1be17, 2015-03-04 (annotated)
- Committer:
- sakthipriya
- Date:
- Wed Mar 04 17:15:15 2015 +0000
- Revision:
- 11:6b00f3b1be17
- Parent:
- 0:ebdf4f859dca
control algo - torque converted to moment
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
raizel_varun | 0:ebdf4f859dca | 1 | //to be saved as HK.h |
raizel_varun | 0:ebdf4f859dca | 2 | |
raizel_varun | 0:ebdf4f859dca | 3 | #include "mbed.h" |
raizel_varun | 0:ebdf4f859dca | 4 | #define tstart -40 |
raizel_varun | 0:ebdf4f859dca | 5 | #define tstep 8 |
raizel_varun | 0:ebdf4f859dca | 6 | #define tstep_thermistor 8//verify!! |
raizel_varun | 0:ebdf4f859dca | 7 | #define tstart_thermistor -40 |
raizel_varun | 0:ebdf4f859dca | 8 | #define vstart 3.3 |
raizel_varun | 0:ebdf4f859dca | 9 | #define vstep 0.84667 |
raizel_varun | 0:ebdf4f859dca | 10 | #define cstart 0.0691 |
raizel_varun | 0:ebdf4f859dca | 11 | #define cstep 0.09133 |
raizel_varun | 0:ebdf4f859dca | 12 | #define rsens 0.095 |
raizel_varun | 0:ebdf4f859dca | 13 | #define Bnewvalue_start -100//in microTesla...max possible field is .0001 T |
raizel_varun | 0:ebdf4f859dca | 14 | #define Bnewvalue_step 13.333 |
raizel_varun | 0:ebdf4f859dca | 15 | #define AngularSpeed_start -10//max possible ang. velocity in space is 10 deg/sec |
raizel_varun | 0:ebdf4f859dca | 16 | #define AngularSpeed_step 1.3333 |
raizel_varun | 0:ebdf4f859dca | 17 | |
raizel_varun | 0:ebdf4f859dca | 18 | |
raizel_varun | 0:ebdf4f859dca | 19 | |
raizel_varun | 0:ebdf4f859dca | 20 | typedef struct SensorData |
raizel_varun | 0:ebdf4f859dca | 21 | { |
raizel_varun | 0:ebdf4f859dca | 22 | float Voltage[16]; |
raizel_varun | 0:ebdf4f859dca | 23 | float Current[8]; |
raizel_varun | 0:ebdf4f859dca | 24 | float Temperature[1]; |
raizel_varun | 0:ebdf4f859dca | 25 | float PanelTemperature[4]; |
raizel_varun | 0:ebdf4f859dca | 26 | float BatteryTemperature; //to be populated |
raizel_varun | 0:ebdf4f859dca | 27 | char faultpoll; //polled faults |
raizel_varun | 0:ebdf4f859dca | 28 | char faultir; //interrupted faults |
raizel_varun | 0:ebdf4f859dca | 29 | char power_mode; //power modes |
raizel_varun | 0:ebdf4f859dca | 30 | |
raizel_varun | 0:ebdf4f859dca | 31 | float AngularSpeed[3]; //in order x,y,z |
raizel_varun | 0:ebdf4f859dca | 32 | float Bnewvalue[3]; //in order Bx,By,Bz |
raizel_varun | 0:ebdf4f859dca | 33 | |
raizel_varun | 0:ebdf4f859dca | 34 | |
raizel_varun | 0:ebdf4f859dca | 35 | } SensorData; |
raizel_varun | 0:ebdf4f859dca | 36 | |
raizel_varun | 0:ebdf4f859dca | 37 | |
raizel_varun | 0:ebdf4f859dca | 38 | typedef struct SensorDataQuantised { |
raizel_varun | 0:ebdf4f859dca | 39 | char Voltage[8]; |
raizel_varun | 0:ebdf4f859dca | 40 | char Current[4]; |
raizel_varun | 0:ebdf4f859dca | 41 | char Temperature[1]; |
raizel_varun | 0:ebdf4f859dca | 42 | char PanelTemperature[2];//read by the 4 thermistors on solar panels |
raizel_varun | 0:ebdf4f859dca | 43 | char BatteryTemperature; //to be populated |
raizel_varun | 0:ebdf4f859dca | 44 | char faultpoll; //polled faults |
raizel_varun | 0:ebdf4f859dca | 45 | char faultir; //interrupted faults |
raizel_varun | 0:ebdf4f859dca | 46 | char power_mode; //power modes |
raizel_varun | 0:ebdf4f859dca | 47 | char AngularSpeed[2]; |
raizel_varun | 0:ebdf4f859dca | 48 | char Bnewvalue[2]; |
raizel_varun | 0:ebdf4f859dca | 49 | |
raizel_varun | 0:ebdf4f859dca | 50 | //float magnetometer,gyro=>to be addes |
raizel_varun | 0:ebdf4f859dca | 51 | } SensorDataQuantised; |
raizel_varun | 0:ebdf4f859dca | 52 | |
raizel_varun | 0:ebdf4f859dca | 53 | |
raizel_varun | 0:ebdf4f859dca | 54 | typedef struct ShortBeacon |
raizel_varun | 0:ebdf4f859dca | 55 | { |
raizel_varun | 0:ebdf4f859dca | 56 | char Voltage[1]; //battery voltage from gauge, needs to be quantised |
raizel_varun | 0:ebdf4f859dca | 57 | char AngularSpeed[2]; //all the 3 data |
raizel_varun | 0:ebdf4f859dca | 58 | char SubsystemStatus[1]; //power modes |
raizel_varun | 0:ebdf4f859dca | 59 | char Temp[2]; //temp of solar panel |
raizel_varun | 0:ebdf4f859dca | 60 | //Temp[0]'s LSB=> PanelTemperature[0], Temp[0]'s MSB=> PanelTemperature[1], Temp[1]'s LSB=> PanelTemperature[2], Temp[1]'s MSB=> PanelTemperature[3] |
raizel_varun | 0:ebdf4f859dca | 61 | char ErrorFlag[1]; //fault |
raizel_varun | 0:ebdf4f859dca | 62 | }ShortBeacy; |
raizel_varun | 0:ebdf4f859dca | 63 | |
raizel_varun | 0:ebdf4f859dca | 64 | |
raizel_varun | 0:ebdf4f859dca | 65 | |
raizel_varun | 0:ebdf4f859dca | 66 | void FUNC_HK_MAIN(); |
raizel_varun | 0:ebdf4f859dca | 67 | |
raizel_varun | 0:ebdf4f859dca | 68 | int quantiz(float start,float step,float x); |
raizel_varun | 0:ebdf4f859dca | 69 | void init_beacon(ShortBeacy* x,SensorDataQuantised y); |