Including the Robotics Toolbox into a Matlab App

630 views
Skip to first unread message

manuel...@gmail.com

unread,
Nov 10, 2018, 4:25:24 PM11/10/18
to Robotics & Machine Vision Toolboxes
I want to include the code I'm writing into a Matlab App for distribution (and in hope that the code will run faster once compiled).

Unfortunately I get this error message:

Error using evalin
Undefined function 'trotz' for input arguments of type 'double'.

My code up to there is
L1 = 500; % torso height
L2 = 1000; % upper arm length
L3 = -200; % z offset
L4 = 1500; % lower arm length

s = 'Tz(L1) Tz(q1) Rz(q2) Tx(L2) Tz(L3) Rz(q3) Tx(L4) Ry(q4) Rz(q5) Rx(q6)'; % transformations
disp('a');
dh = DHFactor(s); % denavit-hartenberg parameters
disp('b');
cmd = dh.command('scara');
disp('c');
scara = eval(cmd); % build robot

This code is right now just called with the click of a button inside the app.

Did anybody already try to integrate the RTB into a Matlab App? How did you do the visualization?

Thanks,
Manuel

Peter Corke

unread,
Nov 10, 2018, 5:28:54 PM11/10/18
to Robotics & Machine Vision Toolboxes
The toolbox functions can be used inside an app.  Apps are not compiled, so there won't be any speed advantage, just a user interface and ease of distribution advantage.  

To debug your problem please send back the following the output of the following commands, thanks

which trotz
ver
rvccheck

manuel...@gmail.com

unread,
Nov 12, 2018, 4:52:35 AM11/12/18
to Robotics & Machine Vision Toolboxes
Just to be clear: It only fails when I open the compiled stand alone desktop app.

I added those three lines to the app and now that's the log (when starting the standalone app):
'trotz' not found.
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.5.0.944444 (R2018b)
MATLAB License Number: unknown
Operating System: Microsoft Windows 7 Enterprise  Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
Control System Toolbox                                Version 10.5        (R2018b)
Global Optimization Toolbox                           Version 4.0         (R2018b)
MATLAB Compiler                                       Version 7.0         (R2018b)
Optimization Toolbox                                  Version 8.2         (R2018b)
Phased Array System Toolbox                           Version 4.0         (R2018b)
Signal Processing Toolbox                             Version 8.1         (R2018b)
System Identification Toolbox                         Version 9.9         (R2018b)
You are using:
 - MATLAB release 2018b
a
Undefined function 'DHFactor' for input arguments of type 'char'.

Error in app1/ButtonPushed (line 29)

Error in appdesigner.internal.service.AppManagementService/tryCallback (line 330)

Error in matlab.apps.AppBase>@(source,event)tryCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event)

Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.

It somehow doesn't include your toolbox into the compiled app. It also doesn't list trotz when showing me all dependencies just before creating the app.

Starting the app inside Matlab, that's the output:

C:\Users\***\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\Robotics Toolbox for MATLAB\robot\trotz.m
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.5.0.944444 (R2018b)
MATLAB License Number: ******
Operating System: Microsoft Windows 7 Enterprise  Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.5         (R2018b)
Simulink                                              Version 9.2         (R2018b)
5G Toolbox                                            Version 1.0         (R2018b)
Aerospace Blockset                                    Version 4.0         (R2018b)
Aerospace Toolbox                                     Version 3.0         (R2018b)
Antenna Toolbox                                       Version 3.2         (R2018b)
Audio System Toolbox                                  Version 1.5         (R2018b)
Automated Driving System Toolbox                      Version 1.3         (R2018b)
Bioinformatics Toolbox                                Version 4.11        (R2018b)
Communications Toolbox                                Version 7.0         (R2018b)
Computer Vision System Toolbox                        Version 8.2         (R2018b)
Control System Toolbox                                Version 10.5        (R2018b)
Curve Fitting Toolbox                                 Version 3.5.8       (R2018b)
DSP System Toolbox                                    Version 9.7         (R2018b)
Data Acquisition Toolbox                              Version 3.14        (R2018b)
Database Toolbox                                      Version 9.0         (R2018b)
Datafeed Toolbox                                      Version 5.8         (R2018b)
Deep Learning Toolbox                                 Version 12.0        (R2018b)
Econometrics Toolbox                                  Version 5.1         (R2018b)
Embedded Coder                                        Version 7.1         (R2018b)
Filter Design HDL Coder                               Version 3.1.4       (R2018b)
Financial Instruments Toolbox                         Version 2.8         (R2018b)
Financial Toolbox                                     Version 5.12        (R2018b)
Fixed-Point Designer                                  Version 6.2         (R2018b)
Fuzzy Logic Toolbox                                   Version 2.4         (R2018b)
GPU Coder                                             Version 1.2         (R2018b)
Global Optimization Toolbox                           Version 4.0         (R2018b)
HDL Coder                                             Version 3.13        (R2018b)
HDL Verifier                                          Version 5.5         (R2018b)
Image Acquisition Toolbox                             Version 5.5         (R2018b)
Image Processing Toolbox                              Version 10.3        (R2018b)
Instrument Control Toolbox                            Version 3.14        (R2018b)
LTE HDL Toolbox                                       Version 1.2         (R2018b)
LTE Toolbox                                           Version 3.0         (R2018b)
MATLAB Coder                                          Version 4.1         (R2018b)
MATLAB Compiler                                       Version 7.0         (R2018b)
MATLAB Compiler SDK                                   Version 6.6         (R2018b)
MATLAB Report Generator                               Version 5.5         (R2018b)
Mapping Toolbox                                       Version 4.7         (R2018b)
Model Predictive Control Toolbox                      Version 6.2         (R2018b)
Model-Based Calibration Toolbox                       Version 5.5         (R2018b)
OPC Toolbox                                           Version 4.0.6       (R2018b)
Optimization Toolbox                                  Version 8.2         (R2018b)
Parallel Computing Toolbox                            Version 6.13        (R2018b)
Partial Differential Equation Toolbox                 Version 3.1         (R2018b)
Phased Array System Toolbox                           Version 4.0         (R2018b)
Polyspace Bug Finder                                  Version 2.6         (R2018b)
Polyspace Code Prover                                 Version 9.10        (R2018b)
Powertrain Blockset                                   Version 1.4         (R2018b)
Predictive Maintenance Toolbox                        Version 1.1         (R2018b)
RF Blockset                                           Version 7.1         (R2018b)
RF Toolbox                                            Version 3.5         (R2018b)
Risk Management Toolbox                               Version 1.4         (R2018b)
Robotics System Toolbox                               Version 2.1         (R2018b)
Robotics Toolbox for MATLAB                           Version 10.3                
Robust Control Toolbox                                Version 6.5         (R2018b)
Sensor Fusion and Tracking Toolbox                    Version 1.0         (R2018b)
Signal Processing Toolbox                             Version 8.1         (R2018b)
SimBiology                                            Version 5.8.1       (R2018b)
SimEvents                                             Version 5.5         (R2018b)
Simscape                                              Version 4.5         (R2018b)
Simscape Driveline                                    Version 2.15        (R2018b)
Simscape Electrical                                   Version 7.0         (R2018b)
Simscape Fluids                                       Version 2.5         (R2018b)
Simscape Multibody                                    Version 6.0         (R2018b)
Simulink 3D Animation                                 Version 8.1         (R2018b)
Simulink Check                                        Version 4.2         (R2018b)
Simulink Code Inspector                               Version 3.3         (R2018b)
Simulink Coder                                        Version 9.0         (R2018b)
Simulink Control Design                               Version 5.2         (R2018b)
Simulink Coverage                                     Version 4.2         (R2018b)
Simulink Design Optimization                          Version 3.5         (R2018b)
Simulink Design Verifier                              Version 4.0         (R2018b)
Simulink Desktop Real-Time                            Version 5.7         (R2018b)
Simulink PLC Coder                                    Version 2.6         (R2018b)
Simulink Real-Time                                    Version 6.9         (R2018b)
Simulink Report Generator                             Version 5.5         (R2018b)
Simulink Requirements                                 Version 1.2         (R2018b)
Simulink Test                                         Version 2.5         (R2018b)
Spreadsheet Link                                      Version 3.4         (R2018b)
Stateflow                                             Version 9.2         (R2018b)
Statistics and Machine Learning Toolbox               Version 11.4        (R2018b)
Symbolic Math Toolbox                                 Version 8.2         (R2018b)
System Identification Toolbox                         Version 9.9         (R2018b)
Text Analytics Toolbox                                Version 1.2         (R2018b)
Trading Toolbox                                       Version 3.5         (R2018b)
Vehicle Dynamics Blockset                             Version 1.1         (R2018b)
Vehicle Network Toolbox                               Version 4.1         (R2018b)
Vision HDL Toolbox                                    Version 1.7         (R2018b)
WLAN Toolbox                                          Version 2.0         (R2018b)
Wavelet Toolbox                                       Version 5.1         (R2018b)
You are using:
 - MATLAB release 2018b
 - Robotics Toolbox for MATLAB 10.3 19-Aug-2018 [mltbx install]
** Toolbox function rotx is shadowed by D:\Matlab\R2018b\toolbox\phased\phased\rotx.m
** Toolbox function roty is shadowed by D:\Matlab\R2018b\toolbox\phased\phased\roty.m
** Toolbox function rotz is shadowed by D:\Matlab\R2018b\toolbox\phased\phased\rotz.m
** Toolbox function angdiff is shadowed by D:\Matlab\R2018b\toolbox\robotics\robotcore\angdiff.m
Some Toolbox files are "shadowed" and will cause problems with the use of this toolbox
Use path tool to move this Toolbox to the top of the path

Apart from that: Is it possible to do the visualization inside the app window? For normal graphs, I have to set the handle of the axes visualization as first argument of the plot function. But that doesn't work for the SerialLink.plot or plot3d.

Peter Corke

unread,
Nov 17, 2018, 5:41:47 PM11/17/18
to Robotics & Machine Vision Toolboxes
Hi Manuel,

you're using MATLAB capability that I'm not very familiar with.  Are you compiling using the AppCompiler or mcc?  There is at least one problem in that you have the Phased Array Toolbox installed which "shadows" some of the functions in my toolbox.  

It might be best to contact MATLAB support about this, it seems more of a MATLAB problem than a RTB problem.

peter

manuel...@gmail.com

unread,
Nov 17, 2018, 6:04:50 PM11/17/18
to Robotics & Machine Vision Toolboxes

Hi Peter,

 

I’m using the AppCompiler. I could try deactivating the Phased Array Toolbox, see if that helps.

Otherwise I’ll contact Matlab support.

 

But it’s not that important right now anyway – there’s a lot of work to do until I would actually benefit from the app distribution functionality – and if it won’t work in the end that would be also fine.

 

Thanks,

Manuel

Peter Corke

unread,
Nov 17, 2018, 6:13:53 PM11/17/18
to Robotics & Machine Vision Toolboxes
The app distribution capability is intriguing.  I did experiment a bit with compiling to a CTF file which can be placed on a web server, which allows the app to effectively run in a web page, but the web server needs a lot of customisation.

peter
Message has been deleted

Manuel Vossel

unread,
Nov 17, 2018, 9:18:11 PM11/17/18
to robotics...@googlegroups.com

Hi Peter,

 

I’m using the AppCompiler. I could try deactivating the Phased Array Toolbox, see if that helps.

Otherwise I’ll contact Matlab support.

 

But it’s not that important right now anyway – there’s a lot of work to do until I would actually benefit from the app distribution functionality – and if it won’t work in the end that would be also fine.

 

Thanks,

Manuel

 

--
You received this message because you are subscribed to the Google Groups "Robotics & Machine Vision Toolboxes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotics-tool-...@googlegroups.com.
To post to this group, send email to robotics...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotics-tool-box.
For more options, visit https://groups.google.com/d/optout.

Mel

unread,
Aug 19, 2020, 10:20:29 AM8/19/20
to Robotics & Machine Vision Toolboxes
Hi Manuel,

I'm referring to your email: 
"Apart from that: Is it possible to do the visualization inside the app window? For normal graphs, I have to set the handle of the axes visualization as first argument of the plot function. But that doesn't work for the SerialLink.plot or plot3d."

Have you tried at the end if you are able to plot SerialLink in App Designer ? 
Please help... 

manuel...@gmail.com

unread,
Aug 19, 2020, 1:17:34 PM8/19/20
to Robotics & Machine Vision Toolboxes
Hi Mel,

well, it's been quite some time since I used the RTB.

I just looked into the code from nearly two years ago - I ended up not using the SerialLink.plot at all.

Instead, I created STL files from the actual robot CAD and visualized those. The STL files I created with the same origin and orienation as the robot was defined from the RTB and then I used the SerialLink.A (or to whatever class this function belongs, the ones calculating the transformation matrix from the robot's base to any joint) function to get the transformation matrix and then shifted all points of the STL.

Best regards,
Manuel

Jay Tailor

unread,
Jan 29, 2021, 5:36:02 PM1/29/21
to Robotics & Machine Vision Toolboxes
Hey Manuel and all in this thread - 

I understand it has been a long time since you last responded. However, I was hoping to get some insight on how you worked with STL files and how to worked with RTB. Specifically can you please expand on :
             - How you found the robots origin and orientation and used that to configure the STL files. 
             - How you got the T matric and shifted the points of the STL exactly. 

I am facing this issue currently, where my STL files are being red but not creating the robot arm structure. I believe my problem is the parameters for the serial link object and the STL link files don't match. Thanks so much! 


Thanks a lot!! 
Jay Tailor 
Reply all
Reply to author
Forward
0 new messages