Sub.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. AP_HAL::AnalogSource* chan_adc;
  19. /*
  20. constructor for main Sub class
  21. */
  22. Sub::Sub()
  23. : logger(g.log_bitmask),
  24. control_mode(MANUAL),
  25. motors(MAIN_LOOP_RATE),
  26. scaleLongDown(1),
  27. auto_mode(Auto_WP),
  28. guided_mode(Guided_WP),
  29. auto_yaw_mode(AUTO_YAW_LOOK_AT_NEXT_WP),
  30. G_Dt(MAIN_LOOP_SECONDS),
  31. inertial_nav(ahrs),
  32. ahrs_view(ahrs, ROTATION_NONE),
  33. attitude_control(ahrs_view, aparm, motors, MAIN_LOOP_SECONDS),
  34. pos_control(ahrs_view, inertial_nav, motors, attitude_control),
  35. wp_nav(inertial_nav, ahrs_view, pos_control, attitude_control),
  36. loiter_nav(inertial_nav, ahrs_view, pos_control, attitude_control),
  37. circle_nav(inertial_nav, ahrs_view, pos_control),
  38. trackpid(7.0,0.02,0.0,7.0,0.02,0.0),
  39. param_loader(var_info)
  40. {
  41. // init sensor error logging flags
  42. sensor_health.baro = true;
  43. sensor_health.compass = true;
  44. #if CONFIG_HAL_BOARD != HAL_BOARD_SITL
  45. failsafe.pilot_input = true;
  46. #endif
  47. }
  48. Sub sub;