full simulation with RF sensors
This commit is contained in:
@@ -1,24 +1,6 @@
|
||||
function [d, t, a] = computePointToPoints(obj, agentPos, targetPos)
|
||||
arguments (Input)
|
||||
obj (1, 1) {mustBeA(obj, "rfSensor")};
|
||||
agentPos (1, 3) double;
|
||||
targetPos (:, 3) double;
|
||||
end
|
||||
arguments (Output)
|
||||
d (:, 1) double;
|
||||
t (:, 1) double;
|
||||
a (:, 1) double;
|
||||
end
|
||||
|
||||
% distance from sensor to target
|
||||
d = vecnorm(agentPos - targetPos, 2, 2);
|
||||
|
||||
% distance from sensor nadir to target nadir (i.e. distance ignoring altitude)
|
||||
x = vecnorm(agentPos(1:2) - targetPos(:, 1:2), 2, 2);
|
||||
|
||||
% tilt angle (degrees) (0 (nadir), 180 (zenith))
|
||||
t = (180 - atan2d(x, targetPos(:, 3) - agentPos(3)));
|
||||
|
||||
% azimuth angle (degrees) (0 (+y) clockwise to 360)
|
||||
a = mod(atan2d(targetPos(:,1) - agentPos(1), targetPos(:,2) - agentPos(2)), 360);
|
||||
end
|
||||
function [d, dx, dy, dz] = computePointToPoints(~, agentPos, targetPos)
|
||||
dx = targetPos(:,1) - agentPos(1);
|
||||
dy = targetPos(:,2) - agentPos(2);
|
||||
dz = targetPos(:,3) - agentPos(3);
|
||||
d = sqrt(dx.^2 + dy.^2 + dz.^2);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user