Azzera filtri
Azzera filtri

"Error while processing" while using codegen in Matlab 2023a

3 visualizzazioni (ultimi 30 giorni)
I have a .m file that calls codegen. If I run this script in the matlab command window, it runs without errors.
However, if I run this script in a terminal window using matlab -batch, while the codegen is running, I receive "Error while processing <current directory>", where <current directory> is the directory I run the matlab -batch command from. However the code generation report does not report any errors and I'm able to use the resulting mex function successfully. I find that this happens if the '-report' flag is included in the codegen call. If not, no error is shown.
This happens with Matlab 2023a, but it didn't happen with 2021a. I think this may be a bug with 2023a
  3 Commenti
Jere Knuutinen
Jere Knuutinen il 7 Nov 2023
Modificato: Jere Knuutinen il 7 Nov 2023
Hi @Mukund Sankaran, I have same error message with my code when trying to generate ROS node. Here is my script that is used to generate the code:
cfg = coder.config("exe");
cfg.Hardware = coder.hardware("Robot Operating System (ROS)");
cfg.Hardware.DeployTo = "Localhost";
cfg.Hardware.BuildAction = "Build and run";
cfg.HardwareImplementation.ProdHWDeviceType = "Intel->x86-64 (Linux 64)";
cfg.HardwareImplementation.ProdLongLongMode = true; % Use 'long long' for Int64 or Uint64 data types
codegen mynode -config cfg
Here is my code that I want to get as a ros node
function mynode
%mynode Receive and display sensor_msgs/JointState messages
%#codegen
% Trajectory points to publish
sub = rossubscriber("/servo","sensor_msgs/JointState","DataFormat","struct");
res = double(1);
if coder.target("MATLAB")
else
coder.cinclude("/home/mpc/Desktop/mba/mba/mba.hpp");
coder.cinclude("myInterpolator.h");
coder.cinclude("intpol_codegen.h");
coder.updateBuildInfo("addSourceFiles", "myInterpolator.cpp");
coder.updateBuildInfo("addSourceFiles", "intpol_codegen.cpp");
res = coder.ceval("int_at", 354489, 6704413);
end
% Display position
state = 10;
while (1)
msg = receive(sub);
%out = d_model(mypersonptr, state)
if ~isempty(msg.Position > 0)
fprintf("Position = %f\n",msg.Position(1))
else
fprintf("Received empty message..\n");
end
end
end
Mukund Sankaran
Mukund Sankaran il 7 Nov 2023
Hi @Jere Knuutinen. The original post mentioned that the error seemed to be tied to the '-report' codegen option when running MATLAB with the '-batch' option, but I see that your reproduction doesn't include any mention of these things. When you say "I have same error message with my code", are you saying you see the error message independent of these options ?
Also, your function 'mynode' calls custom C++ code that you have not shared, so we can't attempt to reproduce the issue on our end. Please share full reproduction steps, as well as information on what release you are using and the exact error message or stack trace you see, so we can attempt to help you further. If you are uncomfortable sharing the full reproduction steps here, please reach out to MathWorks Technical Support so we can assist you better.

Accedi per commentare.

Risposte (1)

Josh Chen
Josh Chen il 10 Nov 2023
Hi John,
Thanks for reporting this issue. It would be nice if you could share a script and reproduction step so we can reproduce this on our end and see what is the culprit.
@Jere Knuutinen when you said you have same error message, could you elaborate more about what is the error message and when did you see that message? ROS Toolbox does not support mex code generation, and I also saw you set 'exe' in the coder configuration.
As Mukund suggest, please feel free to reach out to MathWorks Technical Support so we can assist you better.
Thanks,
Josh

Categorie

Scopri di più su Publishers and Subscribers in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by