"Update traversal encountered invalid scene tree." error while using AppDesigner

16 views (last 30 days)
Hello everyone, I am currently trying to represent the orientation of an object in a appdesigner interface i designed. I figured i can use the sensor fusion toolbox to visualize roll pitch and yaw data that i obtained from an external source. However, when i tried to plot it on a axes, it shows an empty 3d axes system and gives the error in the summary. It works just fine in MATLAB editor however i cannot make it work in appdesigner. Can you help me?
tp = theaterPlot('Parent',app.UIAxes7,'XLimit',[-2 2],'YLimit',[-2 2],'ZLimit',[-2 2]);
op = orientationPlotter(tp,'DisplayName','orientation','LocalAxesLength',2);
plotOrientation(op,roll(i),yaw(i),pitch)

Accepted Answer

Ryan Salvo
Ryan Salvo on 7 Jul 2021
Hi Kaan,
I suspect the error may be caused by something besides the orientationPlotter. I was able to create a simple app in appdesigner and update the orientationPlotter with roll, pitch, and yaw values.
Thanks,
Ryan
Here is the code used to try the simple app:
myApp = app1_exported;
roll = 0; pitch = 0; yaw = 45;
update(myApp, roll, pitch, yaw);
Here is the simple app:
classdef app1_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
OrientationPlot
end
methods (Access = public)
function update(app, roll, pitch, yaw)
plotOrientation(app.OrientationPlot, roll, pitch, yaw);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.Position = [171 149 300 185];
tp = theaterPlot('Parent',app.UIAxes,'XLimit',[-2 2],'YLimit',[-2 2],'ZLimit',[-2 2]);
op = orientationPlotter(tp,'DisplayName','orientation','LocalAxesLength',2);
plotOrientation(op, 0, 0, 0);
app.OrientationPlot = op;
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1_exported
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
  2 Comments
Kaan Ege Tirman
Kaan Ege Tirman on 19 Jul 2021
Hello again and thank you for asnwer. I tried to run the code you provided with the answer but still, I get similar errors. I add the error messages below. By the way, I use 2020b release, maybe it causes problems?
Ryan Salvo
Ryan Salvo on 20 Jul 2021
Hi Kaan,
I took a look at orientationPlotter in R2020b and R2021a and I did not see any changes. I suspect that the graphics framework was updated in App Designer in R2021a to resolve this error. I recommend upgrading to R2021a to resolve this issue. If that is not possible, please submit a support request to continue to investigate workarounds in R2020b.
Thanks,
Ryan

Sign in to comment.

More Answers (0)

Categories

Find more on Develop uifigure-Based Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!