void magnetic_field_estimator(vector v_B_o) { float time_in_years = 2015 + (float)seconds_since_pivot / SECONDS_IN_YEAR; vector v_temp, v_r_lla, v_B_ned, v_B_eci; eci2ecef(v_r, v_temp); ecef2lla(v_temp, v_r_lla);// LLA is need ///* Save LLA vector for use in communications check routine copy_vector(v_r_lla, v_sat);// why is this required when ,lat long alt coming from GPS igrf(v_r_lla, time_in_years, 8, v_B_ned);// need to check at the end ned2ecef(v_B_ned, v_r_lla, v_temp); ecef2eci(v_temp, v_B_eci); eci2orbit(v_r, v_v, v_B_eci, v_B_o); scalar_into_vector(v_B_o, 1e-9); // igrf gives in nT int8_t sen,sen1; int16_t st; /*for (int i=0;i<3;i=i+1) { //sen = ((int8_t)((lambda))/2); st =(int16_t)(v_B_eci[i]/10); sen = (int8_t)st; sen1 = (int8_t)(st>>8); transmit_UART0(sen); transmit_UART0(sen1); }*/ }
void magnetic_field_estimator(vector v_B_o) { float time_in_years = 2010 + (float)seconds_since_pivot / SECONDS_IN_YEAR; vector v_temp, v_r_lla, v_B_ned, v_B_eci; eci2ecef(v_r, v_temp); ecef2lla(v_temp, v_r_lla); igrf(v_r_lla, time_in_years, 8, v_B_ned); ned2ecef(v_B_ned, v_r_lla, v_temp); ecef2eci(v_temp, v_B_eci); eci2orbit(v_r, v_v, v_B_eci, v_B_o); scalar_into_vector(v_B_o, 1e-9); }
void magnetic_field_estimator(vector v_B_o) { float time_in_years = 2010 + (float)seconds_since_pivot / SECONDS_IN_YEAR; vector v_temp, v_r_lla, v_B_ned, v_B_eci; eci2ecef(v_r, v_temp); ecef2lla(v_temp, v_r_lla); ///* Save LLA vector for use in communications check routine copy_vector(v_r_lla, v_sat); igrf(v_r_lla, time_in_years, 8, v_B_ned); ned2ecef(v_B_ned, v_r_lla, v_temp); ecef2eci(v_temp, v_B_eci); eci2orbit(v_r, v_v, v_B_eci, v_B_o); scalar_into_vector(v_B_o, 1e-9); }