updated data extract functions for mavlink integration

This commit is contained in:
2026-05-05 12:20:12 -03:00
parent a9f09b6ce6
commit 3e11dd9e16
6 changed files with 55 additions and 23 deletions

View File

@@ -5,5 +5,3 @@
params["_drone"];
[_drone] call armatak_fnc_send_uas_platform_cot;
[_drone] call armatak_fnc_send_uas_video_cot;
[_drone] call armatak_fnc_send_uas_sensor_cot;

View File

@@ -5,6 +5,7 @@ private _uavControl = UAVControl _drone;
private _controller = _uavControl param [0, objNull];
private _controller_uid = if (!isNull _controller) then { [_controller] call armatak_fnc_extract_uuid } else { _drone getVariable ["armatak_uas_controller_uid", _uuid] };
private _callsign = [_drone] call armatak_fnc_extract_marker_callsign;
private _video_url = [_drone] call armatak_fnc_extract_marker_video_url;
private _atak_role = "a-f-A-M-H-Q";
switch (side _drone) do {
@@ -44,7 +45,11 @@ private _pitch = (vectorDir _drone) select 2;
private _roll = (vectorUp _drone) select 0;
private _isFlying = parseNumber (isEngineOn _drone);
private _hal = ((getPosATL _drone) select 2) max 0;
private _vehicleType = typeOf _drone;
private _vehicleType = if (_video_url == "") then {
typeOf _drone
} else {
format ["%1|armatak_video_url=%2", typeOf _drone, _video_url]
};
private _payload = [
_uuid,

View File

@@ -3,25 +3,28 @@ params["_unit"];
_target = getSensorTargets (_unit);
{
_unit = _x select 0;
private _targetUnit = _x select 0;
_position = _x select 1;
_status = _x select 2;
private _targetType = toLower (typeOf _targetUnit);
if (isNil {
_unit getVariable "armatak_current_side"
}) then {
_unit setVariable ["armatak_current_side", side _unit];
};
if ((_targetType find "lasertarget") < 0) then {
if (isNil {
_targetUnit getVariable "armatak_current_side"
}) then {
_targetUnit setVariable ["armatak_current_side", side _targetUnit];
};
if (_status != "destroyed" && !(_unit in armatak_server_syncedUnits)) then {
_unit_position = _unit call armatak_client_fnc_extractClientPosition;
if (_status != "destroyed" && !(_targetUnit in armatak_server_syncedUnits)) then {
_unit_position = _targetUnit call armatak_client_fnc_extractClientPosition;
_uuid = _unit call armatak_fnc_extract_uuid;
_type = _unit call armatak_fnc_extract_role;
_callsign = getText (configOf _unit >> "displayName");
_uuid = _targetUnit call armatak_fnc_extract_uuid;
_type = _targetUnit call armatak_fnc_extract_role;
_callsign = getText (configOf _targetUnit >> "displayName");
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
_marker_cot = [_uuid, _type, _unit_position select 1, _unit_position select 2, _unit_position select 3, _callsign, _unit_position select 5, _unit_position select 6];
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
"armatak" callExtension ["tcp_socket:cot:marker", [_marker_cot]];
};
};
} forEach _target;

View File

@@ -25,6 +25,16 @@ GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
[_x, _callsign, _group_name, _group_role] call armatak_fnc_send_eud_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
};
case (unitIsUAV _x): {
if !(_x getVariable ["armatak_uav_mavlink_broadcasting", false]) then {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
_x call armatak_fnc_extract_sensor_data;
};
};
case ((_objectType select 0) == "Vehicle"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
@@ -33,12 +43,14 @@ GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
_x call armatak_fnc_extract_sensor_data;
};
case ((_objectType select 0) == "VehicleAutonomous"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
if !(_x getVariable ["armatak_uav_mavlink_broadcasting", false]) then {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
_x call armatak_fnc_extract_sensor_data;
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
_x call armatak_fnc_extract_sensor_data;
};
};
};
} forEach GVAR(syncedUnits);

View File

@@ -10,6 +10,7 @@ if (_existingPfh >= 0) then {
private _broadcastingUav = player getVariable [QGVAR(broadcastingUav), objNull];
if (!isNull _broadcastingUav) then {
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
systemChat "UAV broadcasting stopped";
};

View File

@@ -1,12 +1,19 @@
#include "..\script_component.hpp"
if !(player getVariable [QEGVAR(client,eudConnected), false]) exitWith {};
private _broadcastingUav = player getVariable [QGVAR(broadcastingUav), objNull];
if !(player getVariable [QEGVAR(client,eudConnected), false]) exitWith {
if (!isNull _broadcastingUav) then {
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
player setVariable [QGVAR(broadcastingUav), objNull];
};
};
private _uav = getConnectedUAV player;
private _broadcastingUav = player getVariable [QGVAR(broadcastingUav), objNull];
if (isNull _uav) exitWith {
if (!isNull _broadcastingUav) then {
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
player setVariable [QGVAR(broadcastingUav), objNull];
systemChat "UAV broadcasting stopped";
"armatak" callExtension ["log", [["info", "UAV broadcasting stopped because player is no longer connected to a UAV"]]];
@@ -14,12 +21,18 @@ if (isNull _uav) exitWith {
};
if (_broadcastingUav isNotEqualTo _uav) then {
if (!isNull _broadcastingUav) then {
_broadcastingUav setVariable ["armatak_uav_mavlink_broadcasting", false, true];
};
player setVariable [QGVAR(broadcastingUav), _uav];
_uav setVariable ["armatak_uav_mavlink_broadcasting", true, true];
private _callsign = [_uav] call armatak_fnc_extract_marker_callsign;
systemChat format ["Broadcasting UAV %1", _callsign];
"armatak" callExtension ["log", [["info", format ["Broadcasting UAV %1 via MAVLink mock to %2", _callsign, player getVariable [QEGVAR(client,mavlink_address), ""]]]]];
};
_uav setVariable ["armatak_uav_mavlink_broadcasting", true, true];
private _mavlinkAddress = player getVariable [QEGVAR(client,mavlink_address), ""];
if (_mavlinkAddress isEqualTo "") exitWith {};