SIM_Tracker.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. /*
  14. antenna-tracker simulator class
  15. */
  16. #pragma once
  17. #include "SIM_Aircraft.h"
  18. namespace SITL {
  19. /*
  20. a antenna tracker simulator
  21. */
  22. class Tracker : public Aircraft {
  23. public:
  24. Tracker(const char *frame_str);
  25. void update(const struct sitl_input &input) override;
  26. /* static object creator */
  27. static Aircraft *create(const char *frame_str) {
  28. return new Tracker(frame_str);
  29. }
  30. private:
  31. const bool onoff = false;
  32. const float yawrate = 9.0f;
  33. const float pitchrate = 1.0f;
  34. const float pitch_range = 45;
  35. const float yaw_range = 170;
  36. const float zero_yaw = 270; // yaw direction at startup
  37. const float zero_pitch = 10; // pitch at startup
  38. uint64_t last_debug_us = 0;
  39. float pitch_input;
  40. float yaw_input;
  41. float yaw_current_relative;
  42. float pitch_current_relative;
  43. void update_position_servos(float delta_time, float &yaw_rate, float &pitch_rate);
  44. void update_onoff_servos(float &yaw_rate, float &pitch_rate);
  45. };
  46. } // namespace SITL