How to create a fixed user who receives GNSS signals within a map made from 3D plot?

3 ビュー (過去 30 日間)
I would like to refer to the example of matlab above to create a user who is statically fixed in the middle of the map, not a user who moves along the trajectory.
So I modified it a little bit and wrote the code, and when I run it, the figure comes out well, but there's an unknown error, so I need some help.
Error using fusion.internal.GPSSensorBase/validateInputsImpl (line 302)
Expected input to be an array with number of columns equal to 3.
Error in deepseek_v01 (line 31)
[lla, velocity] = gps(position, zeros(1,3));
^^^^^^^^^^^^^^^^^^^^^^^^^
I'm getting this error, and I'm curious about the solution. I'm also curious if there's any problem even if I ignore the error and use it.
The .osm file I use is not attached, so you can use the .osm file that Matlab supports by default.
referenceLocation = [37.498759 127.027487 0];
scene = uavScenario('ReferenceLocation', referenceLocation, 'UpdateRate', 10, 'StopTime', Inf);
buildingColor = [0.8 0.8 0.8];
if isfile('gangnam_11exit.osm')
addMesh(scene, 'buildings', {'gangnam_11exit.osm', [-250 250], [-250 250], 'auto'}, buildingColor);
else
addMesh(scene, 'buildings', {'random', [-150 150], [-150 150], [10 50]}, buildingColor);
end
user = uavPlatform('User', scene, 'ReferenceFrame', 'ENU', 'InitialPosition', [0 0 80]);
gps = gpsSensor('UpdateRate', 10, ...
'ReferenceLocation', referenceLocation, ...
'HorizontalPositionAccuracy', 1.6, ...
'VerticalPositionAccuracy', 3.0, ...
'VelocityAccuracy', 0.1);
fig = figure('Name','Static GNSS User');
ax = show3D(scene);
hold(ax, 'on');
axis(ax, 'equal');
grid(ax, 'on');
view(ax, 3);
plot3(ax, 0, 0, 80, 'ro', 'MarkerSize', 12, 'MarkerFaceColor', 'r');
setup(scene);
while ishandle(fig)
[position, orientation] = user.read();
[lla, velocity] = gps(position, zeros(1,3));
fprintf('[ENU Position] X: %.2fm, Y: %.2fm, Z: %.2fm\n', position(1), position(2), position(3));
fprintf('[GPS Coordinates] Lat: %.6f°, Lon: %.6f°, Alt: %.2fm\n\n', lla(1), lla(2), lla(3));
show3D(scene, 'Parent', ax, 'FastUpdate', true);
drawnow limitrate;
advance(scene);
end

採用された回答

Ryan Salvo
Ryan Salvo 2025 年 3 月 17 日
The output of the read object function of uavPlatform is not position, but a 16-element motion vector. The gpsSensor object expects a 3-element position vector. This can be obtained by indexing into the motion vector.
[motion, orientation] = user.read();
position = motion(1:3);
[lla, velocity] = gps(position, zeros(1,3));
  2 件のコメント
inhyeok
inhyeok 2025 年 3 月 18 日
Thank you. I'd like to ask you an additional question, but it doesn't make an error, but the result value keeps printing out, do you know a solution to this as well?
Ryan Salvo
Ryan Salvo 2025 年 3 月 18 日
The fprintf command within the for-loop is most likely causing the result to repeatedly print.

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by