Matlab internal error before "mavlinkio" callback - how to catch?
Afficher commentaires plus anciens
I am using the UAV Toolbox for full-duplex communication multiple robots (indexed by {i} below) using a Matlab's mavlink support. Here is the setup code called from an appdesigner application:
% Open mavlink connections
app.dialect = mavlinkdialect(".\ares.xml");
% Connect to a socket for receiving mavlink messages
app.sendSock{i} = mavlinkio(app.dialect,"SystemID",254,"ComponentID",190); % 'send' in the sense of the com2udp bridge
connect(app.sendSock{i},"UDP",'LocalPort',app.NodeTable.Data.UDPport(i));
% Subscribe to whatever messages are sent from the nodes to the UDP port
app.subscriber{i} = mavlinksub(app.sendSock{i}, BufferSize=50, NewMessageFcn=@avsCallback);
% Set a different socket for sending mavlink commands
app.recvSock{i} = mavlinkio(app.dialect,"SystemID",254,"ComponentID",190); % 'recv' in the sense of the com2udp bridge
recvPort = app.NodeTable.Data.UDPport(i)+20;
connect(app.recvSock{i},"UDP",'LocalPort',recvPort);
The callback function executes normally, but occasionally I get mavlink receive errors reported as unknown message IDs:

The Message ID is garbage. It was not sent by the robot, nor is it in any dialect. The reported ID appears to be random, and the error occurs repeatedly throughout a session. I suppose it is a communication error, and I would like to disregard it. The problem is that in order to toss it, I must first catch it. Since this is an internal error not in the direct call stack of any user Matlab code, I have been unable to do so. The exception occurs before the "avsCallback" function is executed and appears to be outside the scope of the main application. How can I catch this error?
This report seems similar to my goal:
but unfortunately was not successful, particularly for a compiled application. Any help will be greatly appreciated.
2 commentaires
Jianxin Sun
le 20 Fév 2025
Hi Jim, what MAVLink version are you using on the robot and MATLAB?
Jim
le 20 Fév 2025
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MAVLink Support dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!