SIM_Multicopter.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. multicopter simulator class
  15. */
  16. #pragma once
  17. #include "SIM_Aircraft.h"
  18. #include "SIM_Motor.h"
  19. #include "SIM_Frame.h"
  20. namespace SITL {
  21. /*
  22. a multicopter simulator
  23. */
  24. class MultiCopter : public Aircraft {
  25. public:
  26. MultiCopter(const char *frame_str);
  27. /* update model by one time step */
  28. void update(const struct sitl_input &input) override;
  29. /* static object creator */
  30. static Aircraft *create(const char *frame_str) {
  31. return new MultiCopter(frame_str);
  32. }
  33. protected:
  34. // calculate rotational and linear accelerations
  35. void calculate_forces(const struct sitl_input &input, Vector3f &rot_accel, Vector3f &body_accel);
  36. Frame *frame;
  37. };
  38. }