Sub.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>.
  12. */
  13. #include "Sub.h"
  14. #define FORCE_VERSION_H_INCLUDE
  15. #include "version.h"
  16. #undef FORCE_VERSION_H_INCLUDE
  17. const AP_HAL::HAL& hal = AP_HAL::get_HAL();
  18. /*
  19. constructor for main Sub class
  20. */
  21. Sub::Sub()
  22. : logger(g.log_bitmask),
  23. control_mode(MANUAL),
  24. motors(MAIN_LOOP_RATE),
  25. scaleLongDown(1),
  26. auto_mode(Auto_WP),
  27. guided_mode(Guided_WP),
  28. auto_yaw_mode(AUTO_YAW_LOOK_AT_NEXT_WP),
  29. G_Dt(MAIN_LOOP_SECONDS),
  30. inertial_nav(ahrs),
  31. ahrs_view(ahrs, ROTATION_NONE),
  32. attitude_control(ahrs_view, aparm, motors, MAIN_LOOP_SECONDS),
  33. pos_control(ahrs_view, inertial_nav, motors, attitude_control),
  34. wp_nav(inertial_nav, ahrs_view, pos_control, attitude_control),
  35. loiter_nav(inertial_nav, ahrs_view, pos_control, attitude_control),
  36. circle_nav(inertial_nav, ahrs_view, pos_control),
  37. trackpid(7.0,0.02,0.0,7.0,0.02,0.0),
  38. param_loader(var_info)
  39. {
  40. // init sensor error logging flags
  41. sensor_health.baro = true;
  42. sensor_health.compass = true;
  43. #if CONFIG_HAL_BOARD != HAL_BOARD_SITL
  44. failsafe.pilot_input = true;
  45. #endif
  46. }
  47. Sub sub;