2015-02-14 08:27:32 -04:00
|
|
|
/*
|
|
|
|
SToRM32 mount backend class
|
|
|
|
*/
|
2016-02-17 21:25:38 -04:00
|
|
|
#pragma once
|
2015-02-14 08:27:32 -04:00
|
|
|
|
2022-02-28 21:19:11 -04:00
|
|
|
#include "AP_Mount_Backend.h"
|
|
|
|
|
2022-06-14 01:55:37 -03:00
|
|
|
#ifndef HAL_MOUNT_STORM32MAVLINK_ENABLED
|
|
|
|
#define HAL_MOUNT_STORM32MAVLINK_ENABLED HAL_MOUNT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAL_MOUNT_STORM32MAVLINK_ENABLED
|
2015-08-11 03:28:44 -03:00
|
|
|
|
|
|
|
#include <AP_Math/AP_Math.h>
|
|
|
|
#include <AP_Common/AP_Common.h>
|
|
|
|
#include <RC_Channel/RC_Channel.h>
|
2022-02-28 21:19:11 -04:00
|
|
|
#include <AP_AHRS/AP_AHRS.h>
|
2015-02-14 08:27:32 -04:00
|
|
|
|
|
|
|
class AP_Mount_SToRM32 : public AP_Mount_Backend
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Constructor
|
2022-08-30 08:15:10 -03:00
|
|
|
AP_Mount_SToRM32(AP_Mount &frontend, AP_Mount_Params ¶ms, uint8_t instance);
|
2015-02-14 08:27:32 -04:00
|
|
|
|
|
|
|
// init - performs any required initialisation for this instance
|
2019-08-27 03:23:30 -03:00
|
|
|
void init() override {}
|
2015-02-14 08:27:32 -04:00
|
|
|
|
|
|
|
// update mount position - should be called periodically
|
2018-11-07 20:49:14 -04:00
|
|
|
void update() override;
|
2015-02-14 08:27:32 -04:00
|
|
|
|
2022-09-29 02:11:31 -03:00
|
|
|
// has_pan_control - returns true if this mount can control its pan (required for multicopters)
|
2022-08-26 00:42:17 -03:00
|
|
|
bool has_pan_control() const override { return yaw_range_valid(); }
|
2015-02-14 08:27:32 -04:00
|
|
|
|
2022-07-11 05:07:22 -03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// get attitude as a quaternion. returns true on success
|
|
|
|
bool get_attitude_quaternion(Quaternion& att_quat) override;
|
2015-02-14 08:27:32 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2015-07-24 08:54:50 -03:00
|
|
|
// search for gimbal in GCS_MAVLink routing table
|
|
|
|
void find_gimbal();
|
|
|
|
|
2022-06-23 00:39:33 -03:00
|
|
|
// send_do_mount_control with latest angle targets
|
|
|
|
void send_do_mount_control(const MountTarget& angle_target_rad);
|
2015-02-14 08:27:32 -04:00
|
|
|
|
|
|
|
// internal variables
|
|
|
|
bool _initialised; // true once the driver has been initialised
|
2015-07-24 08:54:50 -03:00
|
|
|
uint8_t _sysid; // sysid of gimbal
|
|
|
|
uint8_t _compid; // component id of gimbal
|
2022-05-31 00:39:03 -03:00
|
|
|
mavlink_channel_t _chan; // mavlink channel used to communicate with gimbal
|
2015-02-14 08:27:32 -04:00
|
|
|
uint32_t _last_send; // system time of last do_mount_control sent to gimbal
|
2022-06-23 00:39:33 -03:00
|
|
|
MountTarget _angle_rad; // latest angle target
|
2015-02-14 08:27:32 -04:00
|
|
|
};
|
2022-06-14 01:55:37 -03:00
|
|
|
#endif // HAL_MOUNT_STORM32MAVLINK_ENABLED
|