AP_ExternalControl: external control library for MAVLink,lua and DDS

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Co-authored-by: Andrew Tridgell <tridge60@gmail.com>
This commit is contained in:
Andrew Tridgell 2023-08-09 10:28:00 +10:00
parent 37a3f85a9a
commit 0f624089f8
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#include "AP_ExternalControl.h"
#if AP_EXTERNAL_CONTROL_ENABLED
// singleton instance
AP_ExternalControl *AP_ExternalControl::singleton;
AP_ExternalControl::AP_ExternalControl()
{
singleton = this;
}
namespace AP
{
AP_ExternalControl *externalcontrol()
{
return AP_ExternalControl::get_singleton();
}
};
#endif // AP_EXTERNAL_CONTROL_ENABLED

View File

@ -0,0 +1,43 @@
/*
external control library for MAVLink, DDS and scripting
*/
#pragma once
#include "AP_ExternalControl_config.h"
#if AP_EXTERNAL_CONTROL_ENABLED
#include <AP_Math/AP_Math.h>
class AP_ExternalControl
{
public:
AP_ExternalControl();
/*
Set linear velocity and yaw rate. Pass NaN for yaw_rate_rads to not control yaw.
Velocity is in earth frame, NED [m/s].
Yaw is in earth frame, NED [rad/s].
*/
virtual bool set_linear_velocity_and_yaw_rate(const Vector3f &linear_velocity, float yaw_rate_rads)
{
return false;
}
static AP_ExternalControl *get_singleton(void)
{
return singleton;
}
private:
static AP_ExternalControl *singleton;
};
namespace AP
{
AP_ExternalControl *externalcontrol();
};
#endif // AP_EXTERNAL_CONTROL_ENABLED

View File

@ -0,0 +1,10 @@
#pragma once
#include <AP_Common/AP_Common.h>
#include <AP_HAL/AP_HAL_Boards.h>
#ifndef AP_EXTERNAL_CONTROL_ENABLED
#define AP_EXTERNAL_CONTROL_ENABLED 1
#endif