Can I use readArUcoMarker in real-time with Simulink?

13 views (last 30 days)
I am trying to use the built-in readArucoMarker function within Simulink to estimate the pose of an object in real-time. However, I get the following error. Is there a way to implement this correctly? I am running MATLAB R2024a connected with a Quanser QArm with camera attached.

Accepted Answer

Aravind
Aravind on 13 Mar 2025
From your question, it appears you are using MATLAB R2024a with a Quanser arm and are attempting to run Simulink for real-time control. When Simulink interfaces with Quanser, it generates code to create an executable that deploys the model for real-time control.
According to the documentation at https://www.mathworks.com/help/releases/R2024a/vision/ref/readarucomarker.html, the "readArucoMarker" function does not support code generation in MATLAB R2024a. Therefore, when you use this function in a "MATLAB Function" block and attempt to run it with the Quanser arm, Simulink tries to generate code for the block. Since "readArucoMarker" does not support code generation in R2024a, this leads to the error you encountered.
However, the "readArucoMarker" function supports code generation starting from MATLAB R2024b. This is indicated in the R2024b documentation: https://www.mathworks.com/help/vision/ref/readarucomarker.html. To resolve this issue, you can upgrade to MATLAB R2024b, where the "readArucoMarker" function has code generation support.
I hope this answers your question.
  2 Comments
Lowell
Lowell on 13 Mar 2025
Thank you for your response. This makes sense. So it looks like one option is upgrading versions of MATLAB (although this would require purchase of an updated Quanser license). I have looked around for similar functions and found "readAprilTag". Because this is an older function (since R2020b), this should be able to implemented, correct? I tried swapping to readAprilTag but then got the following error. When I run this model without the "Get April Tag" block, it runs normally. Is there something else I am missing?
Aravind
Aravind on 14 Mar 2025
The "readAprilTag" function supports code generation, but only for the host system, not for a target system. This is detailed in the documentation at https://www.mathworks.com/help/releases/R2024a/vision/ref/readapriltag.html#refsect-extended-capabilities. When using Simulink with Quanser, Simulink considers Quanser as a target system as the system target file is typically set to a tlc file provided by Quanser. This incompatibility can potentially lead to the error you are encountering.
As a workaround, you could implement the process of reading the April tag or the ArUco marker manually using MATLAB functions that support code generation for target systems as well. This approach should allow you to generate the necessary code without encountering errors.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!