Sub.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. lights1 = 0;
  45. updowmgain = 0.5;
  46. stable_alt_control = TRUE;
  47. rotyaw.identity();
  48. rotpitch.identity();
  49. delaygain = 401;
  50. velocity_z_filer =0.0;
  51. continuous_count=0;
  52. continuous_countdec=0;
  53. last_continuous = 0;
  54. #if CONFIG_HAL_BOARD != HAL_BOARD_SITL
  55. failsafe.pilot_input = true;
  56. #endif
  57. }
  58. Sub sub;