int main(int argc, char** argv) { /* Initalize event library */ event_init(); if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); return -1; } if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link\n"); return -1; } /* Add our datalink event */ network = network_new(LINK_HOST, LINK_PORT, DATALINK_PORT, FMS_NETWORK_BROADCAST); struct event datalink_event; event_set(&datalink_event, network->socket_in, EV_READ, on_datalink_event, &datalink_event); event_add(&datalink_event, NULL); event_dispatch(); return 0; }
static void main_init(void) { TRACE(TRACE_DEBUG, "%s", "Starting initialization\n"); /* Initalize our SPI link to IO processor */ if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n"); return; } /* Initalize the event library */ event_init(); /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); return; } /* Initialize our communications with ground segment */ fms_gs_com_init(otp.gs_gw, 4242, 4243, FALSE); /* Initialize blaaa */ for (uint8_t i=0; i<6; i++) otp.servos_outputs_usecs[i] = 1500; for (uint8_t i=0; i<4; i++) otp.csc_servo_outputs[i] = 1500; TRACE(TRACE_DEBUG, "%s", "Initialization completed\n"); }
static void main_init(void) { TRACE(TRACE_DEBUG, "%s", "Starting initialization\n"); /* Initalize the event library */ event_init(); /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); return; } signal(SIGKILL, on_kill); signal(SIGINT, on_kill); signal(SIGILL, on_kill); signal(SIGHUP, on_kill); signal(SIGQUIT, on_kill); signal(SIGTERM, on_kill); signal(SIGSEGV, on_kill); if(!open_stream()) { fprintf(stderr, "Could not open stream, sorry\n"); exit(1); } TRACE(TRACE_DEBUG, "%s", "Initialization completed\n"); }
int main(int argc, char *argv[]) { portnum = 0; if (argc > 1) { portnum = atoi(argv[1]); if (portnum > 10) { printf("Port number must be <11\n"); return -1; } if (argc > 2) { configgps = atoi(argv[2]); } if (configgps) #ifdef GPS_CONFIGURE printf("Will configure GPS.\n"); #else printf("Rebuild with GPS configure support.\n"); #endif } printf("Using /dev/ttyUSB%d for GPS\n", portnum); (void) signal(SIGINT, main_exit); uart_init(); gps_init(); /* Initalize the event library */ event_init(); gcs_com_init(); if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); return -1; } #ifdef GPS_CONFIGURE //periodic task is launched so we are now ready to use uart to request gps baud change... if (configgps) { gps_configure_uart(); } #endif event_dispatch(); //should never occur! printf("goodbye! (%d)\n", foo); return 0; }
static void main_init(void) { uint8_t byte_idx; TRACE(TRACE_DEBUG, "%s", "Starting initialization\n"); /* Initalize our SPI link to IO processor */ if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n"); return; } spistream_init(&on_spistream_msg_received, &on_spistream_msg_sent); for(byte_idx=1; byte_idx < 123; byte_idx++) { spistream_msg[byte_idx] = byte_idx; } /* Initalize the event library */ event_init(); /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); return; } signal(SIGKILL, on_kill); signal(SIGINT, on_kill); signal(SIGILL, on_kill); signal(SIGHUP, on_kill); signal(SIGQUIT, on_kill); signal(SIGTERM, on_kill); signal(SIGSEGV, on_kill); signal(SIGPIPE, on_dead_pipe); if(!open_stream()) { fprintf(LOG_OUT, "Could not open stream, sorry\n"); exit(1); } TRACE(TRACE_DEBUG, "%s", "Initialization completed\n"); }
static void main_init(void) { #if RUN_FILTER printf("FILTER output will be in "); #if FILTER_OUTPUT_IN_NED printf("NED\n"); #else printf("ECEF\n"); #endif #else printf("Filter wont run\n"); #endif #if UPDATE_WITH_GRAVITY printf("the orientation becomes UPDATED with the GRAVITY\n"); #endif TRACE(TRACE_DEBUG, "%s", "Starting initialization\n"); /* Initalize our SPI link to IO processor */ if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n"); return; } /* Initalize the event library */ event_init(); /* Initalize our ô so accurate periodic timer */ if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); return; } #if RUN_FILTER init_ins_state(); set_reference_direction(); #endif main_rawlog_init(IMU_LOG_FILE); }
int main(int argc, char *argv[]) { (void) signal(SIGINT, main_exit); //set IMU neutrals RATES_ASSIGN(imu.gyro_neutral, IMU_GYRO_P_NEUTRAL, IMU_GYRO_Q_NEUTRAL, IMU_GYRO_R_NEUTRAL); VECT3_ASSIGN(imu.accel_neutral, IMU_ACCEL_X_NEUTRAL, IMU_ACCEL_Y_NEUTRAL, IMU_ACCEL_Z_NEUTRAL); VECT3_ASSIGN(imu.mag_neutral, IMU_MAG_X_NEUTRAL, IMU_MAG_Y_NEUTRAL, IMU_MAG_Z_NEUTRAL); if (spi_link_init()) { TRACE(TRACE_ERROR, "%s", "failed to open SPI link \n"); return -1; } /* Initalize the event library */ event_init(); control_init(); estimator_init(); // file_logger_init("my_log.data"); gcs_com_init(); if (fms_periodic_init(main_periodic)) { TRACE(TRACE_ERROR, "%s", "failed to start periodic generator\n"); return -1; } //main_parse_cmd_line(argc, argv); event_dispatch(); //should never occur! printf("goodbye! (%d)\n", foo); return 0; }