mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
Fix the broken get_location_target method and move it up to generic backend so that can be used by all backends Remove flag variables that were used to determine valid or invalid Location variables and use the initialized() method instead. Should fix #31535 Signed-off-by: neo-0007 <hrishikeshgohain123@gmail.com>
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
/*
|
|
Scripting mount/gimbal driver
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "AP_Mount_config.h"
|
|
|
|
#if HAL_MOUNT_SCRIPTING_ENABLED
|
|
|
|
#include "AP_Mount_Backend.h"
|
|
|
|
#include <AP_HAL/AP_HAL.h>
|
|
#include <AP_Math/AP_Math.h>
|
|
#include <AP_Common/AP_Common.h>
|
|
|
|
class AP_Mount_Scripting : public AP_Mount_Backend
|
|
{
|
|
|
|
public:
|
|
// Constructor
|
|
using AP_Mount_Backend::AP_Mount_Backend;
|
|
|
|
/* Do not allow copies */
|
|
CLASS_NO_COPY(AP_Mount_Scripting);
|
|
|
|
// update mount position - should be called periodically
|
|
void update() override;
|
|
|
|
// return true if healthy
|
|
bool healthy() const override;
|
|
|
|
// has_pan_control - returns true if this mount can control its pan (required for multicopters)
|
|
bool has_pan_control() const override { return yaw_range_valid(); };
|
|
|
|
// accessors for scripting backends
|
|
void set_attitude_euler(float roll_deg, float pitch_deg, float yaw_bf_deg) override;
|
|
|
|
protected:
|
|
|
|
// get attitude as a quaternion. returns true on success
|
|
bool get_attitude_quaternion(Quaternion& att_quat) override;
|
|
|
|
private:
|
|
|
|
// internal variables
|
|
uint32_t last_update_ms; // system time of last call to one of the get_ methods. Used for health reporting
|
|
Vector3f current_angle_deg; // current gimbal angles in degrees (x=roll, y=pitch, z=yaw)
|
|
|
|
};
|
|
|
|
#endif // HAL_MOUNT_SCRIPTING_ENABLED
|