224 lines
4.9 KiB
C++
Executable File
224 lines
4.9 KiB
C++
Executable File
/**
|
|
* Sends / receives data to / from one UAVCommander via TMS-IF
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Mike Wille, ESZS, 2025-04-17
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
#include <string>
|
|
#include <functional>
|
|
#include <vector>
|
|
|
|
#include <QVector3D>
|
|
#include <QString>
|
|
|
|
|
|
namespace UAS
|
|
{
|
|
namespace CoordinateFrame
|
|
{
|
|
namespace ReportPositions
|
|
{
|
|
struct Message
|
|
{
|
|
double lat;
|
|
double lon;
|
|
double alt;
|
|
int64_t timestamp;
|
|
};
|
|
|
|
using CallbackFn = std::function<void(const CoordinateFrame::ReportPositions::Message &data)>;
|
|
}
|
|
}
|
|
|
|
namespace TeleOperation {
|
|
/// Enumeration of states of a the radio link.
|
|
enum Type
|
|
{
|
|
/// The connection is in a undefined state.
|
|
Undefined,
|
|
/// The link is currently disconnected.
|
|
Disconnected,
|
|
/// The link is currently connecting.
|
|
Connecting,
|
|
/// The link is currently disconnecting
|
|
Diconnecting,
|
|
/// The link is currently connected.
|
|
Connected,
|
|
/// The link is currently in error state.
|
|
Error
|
|
};
|
|
|
|
namespace RadioLinkConnectionState {
|
|
struct Message
|
|
{
|
|
Type status;
|
|
};
|
|
using CallbackFn = std::function<void(const TeleOperation::RadioLinkConnectionState::Message &data)>;
|
|
}
|
|
|
|
}
|
|
|
|
namespace BuiltInTest {
|
|
/// Enumeration of states of a the radio link.
|
|
namespace TestResult {
|
|
/// Test result type enumeration.
|
|
enum Type
|
|
{
|
|
/// Unknown -- test has not yet been completed or could not be initiated.
|
|
Undefined,
|
|
/// OK -- no failure was detected.
|
|
OK,
|
|
/// Warning -- a situation which warrants a warning was detected.
|
|
Warning,
|
|
/// Reduced performance -- an error was detected which results in reduced performance.
|
|
Reduced_Performance_Error,
|
|
/// Fatal error -- a failure was detected which results in complete loss of functionality.
|
|
Fatal_Error
|
|
};
|
|
}
|
|
namespace ReportCBitStatus {
|
|
struct Message
|
|
{
|
|
std::string Key;
|
|
std::string RoutineName;
|
|
BuiltInTest::TestResult::Type Result;
|
|
unsigned long ErrorCode;
|
|
std::string ErrorCodeDescription;
|
|
};
|
|
using CallbackFn = std::function<void(const ReportCBitStatus::Message &data)>;
|
|
}
|
|
}
|
|
|
|
|
|
namespace Device {
|
|
/// Enumeration of states of a the radio link.
|
|
namespace OperationModeStateKind {
|
|
/// Operation mode state enumeration.
|
|
enum Type
|
|
{
|
|
/// Unknown mode state.
|
|
Undefined,
|
|
/// Off.
|
|
Off,
|
|
/// On.
|
|
On,
|
|
/// Standby.
|
|
Standby,
|
|
/// Initialising.
|
|
Init,
|
|
/// Shutting down.
|
|
Shutdown,
|
|
/// Normal operation.
|
|
Normal,
|
|
/// Manual operation.
|
|
Manual,
|
|
/// Automatic operation.
|
|
Auto,
|
|
/// Calibrating.
|
|
Calibrating,
|
|
/// Maintenance.
|
|
Maintenance
|
|
};
|
|
}
|
|
namespace ReportDeviceStatus
|
|
{
|
|
struct Message
|
|
{
|
|
OperationModeStateKind::Type Status;
|
|
};
|
|
using CallbackFn = std::function<void(const ReportDeviceStatus::Message &data)>;
|
|
}
|
|
}
|
|
|
|
|
|
namespace ObjectManager
|
|
{
|
|
namespace ReportPoint
|
|
{
|
|
struct Message
|
|
{
|
|
int uasId;
|
|
bool isRemoved;
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
namespace MissionCtrl
|
|
{
|
|
|
|
enum Task // see tmsif/type/MissionCtrl.hpp:43
|
|
{
|
|
Undefined, // 0
|
|
Connect, // 1
|
|
Disconnect, // 2
|
|
Arm, // 3
|
|
Disarm, // 4
|
|
Fire,
|
|
Observe, // 6
|
|
/// Let vehicle ascend.
|
|
Climb,
|
|
/// Let vehicle descend.
|
|
Descend,
|
|
/// Perform vehicle takeoff.
|
|
Takeoff, // 9
|
|
/// Perform vehicle landing.
|
|
Land, // 10
|
|
Reboot, // 11
|
|
Shutdown, // 12
|
|
/// Loiter around a specified position.
|
|
Loiter, // 13
|
|
/// Return to a specified position.
|
|
Return, // 14
|
|
/// Follow a specified entity.
|
|
Follow, // 15
|
|
/// Stop current motion/action.
|
|
Stop,
|
|
/// Resume the stopped motion/action.
|
|
Resume
|
|
};
|
|
|
|
namespace ReportMissionStatus
|
|
{
|
|
|
|
struct Message
|
|
{
|
|
std::string currentMissionName;
|
|
Task currentTask;
|
|
std::vector<Task> currentlyAllowedTasks;
|
|
std::string missionEnded;
|
|
};
|
|
|
|
using CallbackFn = std::function<void(const MissionCtrl::ReportMissionStatus::Message &data)>;
|
|
}
|
|
}
|
|
|
|
|
|
class UAVCommander
|
|
{
|
|
public:
|
|
virtual ~UAVCommander() = default;
|
|
bool isReady() const { return m_isReady; }
|
|
virtual void startIA(const std::string &ip, const uint16_t port, const bool useTcp) noexcept(false) = 0;
|
|
|
|
virtual void sendMission(double lat, double lon, double alt = 0, const QString &missionName = {}) noexcept(false) = 0;
|
|
virtual void returnToHome() = 0;
|
|
virtual void sendTryReclaimAutoMode() = 0;
|
|
|
|
virtual void set_CoordinateFrame_ReportPosition_Callback(CoordinateFrame::ReportPositions::CallbackFn callbackFn) = 0;
|
|
virtual void set_isReady_Callback(std::function<void()> callbackFn) = 0;
|
|
virtual void set_ReportCBitStatus_Callback(BuiltInTest::ReportCBitStatus::CallbackFn callbackFn) = 0;
|
|
virtual void set_ReportDeviceStatusType_Callback(Device::ReportDeviceStatus::CallbackFn callbackFn) = 0;
|
|
virtual void set_ReportRadioLinkConnectionState_Callback(TeleOperation::RadioLinkConnectionState::CallbackFn callbackFn) = 0;
|
|
virtual void set_ReportMissionStatus_Callback(MissionCtrl::ReportMissionStatus::CallbackFn callbackFn) = 0;
|
|
|
|
protected:
|
|
bool m_isReady { false };
|
|
};
|
|
} // namespace UAS
|