AP_Mount_SToRM32.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. SToRM32 mount backend class
  3. */
  4. #pragma once
  5. #include <AP_HAL/AP_HAL.h>
  6. #include <AP_AHRS/AP_AHRS.h>
  7. #include <AP_Math/AP_Math.h>
  8. #include <AP_Common/AP_Common.h>
  9. #include <RC_Channel/RC_Channel.h>
  10. #include "AP_Mount_Backend.h"
  11. #define AP_MOUNT_STORM32_RESEND_MS 1000 // resend angle targets to gimbal once per second
  12. #define AP_MOUNT_STORM32_SEARCH_MS 60000 // search for gimbal for 1 minute after startup
  13. class AP_Mount_SToRM32 : public AP_Mount_Backend
  14. {
  15. public:
  16. // Constructor
  17. AP_Mount_SToRM32(AP_Mount &frontend, AP_Mount::mount_state &state, uint8_t instance);
  18. // init - performs any required initialisation for this instance
  19. void init() override {}
  20. // update mount position - should be called periodically
  21. void update() override;
  22. // has_pan_control - returns true if this mount can control it's pan (required for multicopters)
  23. bool has_pan_control() const override;
  24. // set_mode - sets mount's mode
  25. void set_mode(enum MAV_MOUNT_MODE mode) override;
  26. // send_mount_status - called to allow mounts to send their status to GCS using the MOUNT_STATUS message
  27. void send_mount_status(mavlink_channel_t chan) override;
  28. private:
  29. // search for gimbal in GCS_MAVLink routing table
  30. void find_gimbal();
  31. // send_do_mount_control - send a COMMAND_LONG containing a do_mount_control message
  32. void send_do_mount_control(float pitch_deg, float roll_deg, float yaw_deg, enum MAV_MOUNT_MODE mount_mode);
  33. // internal variables
  34. bool _initialised; // true once the driver has been initialised
  35. uint8_t _sysid; // sysid of gimbal
  36. uint8_t _compid; // component id of gimbal
  37. mavlink_channel_t _chan; // mavlink channel used to communicate with gimbal. Currently hard-coded to Telem2
  38. uint32_t _last_send; // system time of last do_mount_control sent to gimbal
  39. };