From 103af72859f33a3f942c77dbed632273a5b2588c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 25 Feb 2019 16:13:47 +1100 Subject: [PATCH] AP_InertialSensor: remove more px4 remnants --- .../examples/VibTest/VibTest.cpp | 206 ------------------ .../examples/VibTest/wscript | 9 - 2 files changed, 215 deletions(-) delete mode 100644 libraries/AP_InertialSensor/examples/VibTest/VibTest.cpp delete mode 100644 libraries/AP_InertialSensor/examples/VibTest/wscript diff --git a/libraries/AP_InertialSensor/examples/VibTest/VibTest.cpp b/libraries/AP_InertialSensor/examples/VibTest/VibTest.cpp deleted file mode 100644 index 5ca43c534a..0000000000 --- a/libraries/AP_InertialSensor/examples/VibTest/VibTest.cpp +++ /dev/null @@ -1,206 +0,0 @@ -// -// test harness for vibration testing -// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 - -#include -#include - -#include -#include -#include -#include -#include - -const AP_HAL::HAL& hal = AP_HAL::get_HAL(); - -static int accel_fd[INS_MAX_INSTANCES]; -static int gyro_fd[INS_MAX_INSTANCES]; -static uint32_t total_samples[INS_MAX_INSTANCES]; -static uint64_t last_accel_timestamp[INS_MAX_INSTANCES]; -static uint64_t last_gyro_timestamp[INS_MAX_INSTANCES]; -static uint32_t accel_deltat_min[INS_MAX_INSTANCES]; -static uint32_t accel_deltat_max[INS_MAX_INSTANCES]; -static uint32_t gyro_deltat_min[INS_MAX_INSTANCES]; -static uint32_t gyro_deltat_max[INS_MAX_INSTANCES]; -static AP_Logger_File AP_Logger("/fs/microsd/VIBTEST"); - -static const struct LogStructure log_structure[] = { - LOG_COMMON_STRUCTURES, - LOG_EXTRA_STRUCTURES -}; - -void setup(void) -{ - for (uint8_t i=0; i accel_deltat_max[i]) { - accel_deltat_max[i] = deltat; - } - if (accel_deltat_min[i] == 0 || deltat < accel_deltat_max[i]) { - accel_deltat_min[i] = deltat; - } - last_accel_timestamp[i] = accel_report.timestamp; - - struct log_ACCEL pkt = { - LOG_PACKET_HEADER_INIT((uint8_t)(LOG_ACC1_MSG+i)), - time_us : AP_HAL::micros64(), - sample_us : accel_report.timestamp, - AccX : accel_report.x, - AccY : accel_report.y, - AccZ : accel_report.z - }; - logger.WriteBlock(&pkt, sizeof(pkt)); - got_sample = true; - total_samples[i]++; - } - if (gyro_fd[i] != -1 && ::read(gyro_fd[i], &gyro_report, sizeof(gyro_report)) == - sizeof(gyro_report) && - gyro_report.timestamp != last_gyro_timestamp[i]) { - uint32_t deltat = gyro_report.timestamp - last_gyro_timestamp[i]; - if (deltat > gyro_deltat_max[i]) { - gyro_deltat_max[i] = deltat; - } - if (gyro_deltat_min[i] == 0 || deltat < gyro_deltat_max[i]) { - gyro_deltat_min[i] = deltat; - } - last_gyro_timestamp[i] = gyro_report.timestamp; - - struct log_GYRO pkt = { - LOG_PACKET_HEADER_INIT((uint8_t)(LOG_GYR1_MSG+i)), - time_us : AP_HAL::micros64(), - sample_us : gyro_report.timestamp, - GyrX : gyro_report.x, - GyrY : gyro_report.y, - GyrZ : gyro_report.z - }; - logger.WriteBlock(&pkt, sizeof(pkt)); - got_sample = true; - total_samples[i]++; - } - } - if (got_sample) { - if (total_samples[0] % 2000 == 0 && last_print != total_samples[0]) { - last_print = total_samples[0]; - hal.console->printf("t=%lu total_samples=%lu/%lu/%lu adt=%u:%u/%u:%u/%u:%u gdt=%u:%u/%u:%u/%u:%u\n", - (unsigned long)AP_HAL::millis(), - (unsigned long)total_samples[0], - (unsigned long)total_samples[1], - (unsigned long)total_samples[2], - accel_deltat_min[0], - accel_deltat_max[0], - accel_deltat_min[1], - accel_deltat_max[1], - accel_deltat_min[2], accel_deltat_max[2], - gyro_deltat_min[0], gyro_deltat_max[0], - gyro_deltat_min[1], gyro_deltat_max[1], - gyro_deltat_min[2], gyro_deltat_max[2]); -#if 0 - ::printf("t=%lu total_samples=%lu/%lu/%lu adt=%u:%u/%u:%u/%u:%u gdt=%u:%u/%u:%u/%u:%u\n", - AP_HAL::millis(), - total_samples[0], total_samples[1],total_samples[2], - accel_deltat_min[0], accel_deltat_max[0], - accel_deltat_min[1], accel_deltat_max[1], - accel_deltat_min[2], accel_deltat_max[2], - gyro_deltat_min[0], gyro_deltat_max[0], - gyro_deltat_min[1], gyro_deltat_max[1], - gyro_deltat_min[2], gyro_deltat_max[2]); -#endif - - memset(accel_deltat_min, 0, sizeof(accel_deltat_min)); - memset(accel_deltat_max, 0, sizeof(accel_deltat_max)); - memset(gyro_deltat_min, 0, sizeof(gyro_deltat_min)); - memset(gyro_deltat_max, 0, sizeof(gyro_deltat_max)); - } - } - } while (got_sample); - hal.scheduler->delay_microseconds(100); -} - -#else -const AP_HAL::HAL& hal = AP_HAL::get_HAL(); -void setup() {} -void loop() {} -#endif // CONFIG_HAL_BOARD - -AP_HAL_MAIN(); diff --git a/libraries/AP_InertialSensor/examples/VibTest/wscript b/libraries/AP_InertialSensor/examples/VibTest/wscript deleted file mode 100644 index 0d16409835..0000000000 --- a/libraries/AP_InertialSensor/examples/VibTest/wscript +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -def build(bld): - # TODO: Test code doesn't build. Fix or delete the test. - return - bld.ap_example( - use='ap', - )