ModuleTest.cpp 651 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // Simple test for the AP_AHRS interface
  3. //
  4. #include <AP_AHRS/AP_AHRS.h>
  5. #include <AP_HAL/AP_HAL.h>
  6. #include <AP_Module/AP_Module.h>
  7. #include <AP_GPS/AP_GPS.h>
  8. #include <AP_Baro/AP_Baro.h>
  9. void setup();
  10. void loop();
  11. const AP_HAL::HAL& hal = AP_HAL::get_HAL();
  12. // sensor declaration
  13. static AP_InertialSensor ins;
  14. static AP_GPS gps;
  15. static AP_Baro baro;
  16. static AP_SerialManager serial_manager;
  17. // choose which AHRS system to use
  18. static AP_AHRS_DCM ahrs{};
  19. void setup(void)
  20. {
  21. serial_manager.init();
  22. ins.init(100);
  23. baro.init();
  24. ahrs.init();
  25. gps.init(serial_manager);
  26. }
  27. void loop(void)
  28. {
  29. ahrs.update();
  30. }
  31. AP_HAL_MAIN();