void lla_of_ecef_i(struct LlaCoor_i* out, struct EcefCoor_i* in) { /* convert our input to floating point */ struct EcefCoor_d in_d; in_d.x = M_OF_CM((double)in->x); in_d.y = M_OF_CM((double)in->y); in_d.z = M_OF_CM((double)in->z); /* calls the floating point transformation */ struct LlaCoor_d out_d; lla_of_ecef_d(&out_d, &in_d); /* convert the output to fixed point */ out->lon = (int32_t)rint(EM7RAD_OF_RAD(out_d.lon)); out->lat = (int32_t)rint(EM7RAD_OF_RAD(out_d.lat)); out->alt = (int32_t)MM_OF_M(out_d.alt); }
void gps_feed_values(double utm_north, double utm_east, double utm_alt, double gspeed, double course, double climb) { gps.utm_pos.north = CM_OF_M(utm_north); gps.utm_pos.east = CM_OF_M(utm_east); //TODO set height above ellipsoid properly gps.hmsl = utm_alt * 1000.; gps.gspeed = CM_OF_M(gspeed); gps.course = EM7RAD_OF_RAD(RadOfDeg(course/10.)); gps.ned_vel.z = -climb*100.; gps.fix = GPS_FIX_3D; gps_available = TRUE; }