MATLAB Answers

build standalone application running in Raspberry Pi?

186 ビュー (過去 30 日間)
cao lan
cao lan 2014 年 1 月 15 日
コメント済み: Prasanth Sunkara 2020 年 10 月 8 日
Hi all I'm new in using Simulink model to build an application that run in Raspberry Pi. I have a question that can I build a standalone application with the board: means that I build a Simulink model in matlab, load into the board, stop Matlab and plug out the connection with the computer. Does the program that has been loaded in the board can work alone without matlab? Thank for any help :)

  2 件のコメント

Shekhar patil
Shekhar patil 2020 年 6 月 12 日
Hi Guys,
I have a similiar question as mentioned above, but the only problem is I want to deploy a machine learning algorithm on raspberry pi3. Can it be done using MATLAB compiler? your suggestions will be helpful.
Thanks
Prasanth Sunkara
Prasanth Sunkara 2020 年 10 月 8 日
Simulink deployed models are stored in raspberrypi at "MATLAB_ws" folder. Please see this doc page to know more about it.
The generated executables would be of ".elf" extension.
From R2020b, you can monitor and control the running status of your models easily with a simple app. To know where the elf is actually stored and optionally read the log files for any errors, please use the "Raspberry Pi Resource Monitor App"
Thanks,
Prasanth

サインインしてコメントする。

採用された回答

Murat Belge
Murat Belge 2014 年 2 月 25 日
Yes. The Simulink model is converted to an executable that runs on the Raspberry Pi board. Typically, the executable is saved in "/home/pi/<Simulink model name>/MW directory. The name of the executable is the same as the Simulink model name. You can run this executable any time after compiling your Simulink model once.

  5 件のコメント

表示 2 件の古いコメント
Piro
Piro 2015 年 3 月 16 日
but if I start the model by this way, how can I stop it?
Abhishek Kekud
Abhishek Kekud 2018 年 2 月 15 日
@Piro, did you find how to stop a running simulink model? I know ctrl+c is one option. But looking out for a better option to stop the running model.
Anuj Patil
Anuj Patil 2018 年 6 月 28 日
I cant find the command used to execute the file.There are over 20 files in that directory.And once its executed and running,how to watch the results of the Computer Vision model I had uploaded?

サインインしてコメントする。

その他の回答 (5 件)

fatima
fatima 2017 年 4 月 21 日
Hi everyone. I'm facing the same problem. I build a model in matlab; it loads successfully on raspberry pi 3 board and runs OK. My model simply sends an array of uint8 over UDP to a server. I found the project in /home/pi/[ProjectName]_ert_rtw and I was even able to build it again in linux (by renaming the "[ProjectName].mk" file to "Makefile" and "make all" command). However the "[ProjectName].elf" file is not doing the task it's supposed to do (Not before nor after rebuilding in linux). I took a look inside the c files of project and I found out that the executable file accepts some input arguments. I saw that my server IP address was set in one of the c files, but I gave it as input to executable too (Something like this: [ProjectName].elf -hostname [ServerIP] -port [MyPort] -protocol UDP). In my sever, if I send something back, I see that the running code indicated that it received an invalid packet, and sometimes it sends back some gibberish to server too.
I think that some part of the code is running, but it needs something as input argument to tell it to use constant parameters and run the main task.
Any body facing this problem? Any idea to solve the problem would be appreciated.

  2 件のコメント

fatima
fatima 2017 年 4 月 21 日
My bad! I found my problem. I used the Run button to deploy the model on the board. It created the executable file. I tried to run that file and it did not work. To create the standalone executable, "Deploy to Hardware" button is used. It creates the executable file with the same name. That file is running OK and does all the job! I hope it can help anyone else that was confused like me.
Thanh Ngo
Thanh Ngo 2019 年 9 月 9 日
Hi, Could you share how to send and receive data between 2 Pi using Simulink? I am currently doing the project of multirobot cooperates using raspberri pi to communicate and arduino for speed control. I Have problem with communication between 2 Pi in Simulink.

サインインしてコメントする。


Mirko
Mirko 2014 年 5 月 23 日
Hello, I created a model in simulink and I find the files in the directory MW, but I can not get it running independently. If I launch the simulink model to work properly. What is the right command to give Linux to run the model?

  4 件のコメント

表示 1 件の古いコメント
VCOpll
VCOpll 2015 年 7 月 19 日
hi. i created a Simulink model to control a DAC (MCP4921). it works well when I push the run button (external mode) in Simulink. I tried to run it standalone using the Linux command sudo ./Name_of_the__simulink_generated_program_file. It doest work. I only see "**starting the model**" but it doesnt do what is expected. What is the right way to run a simulink model standalone? Appreciate for the help.
Ahmed Desoky
Ahmed Desoky 2016 年 3 月 7 日
"VCOpll ", I am facing the same problem that faced you. Did you solve this problem?
Igor Potocnik
Igor Potocnik 2016 年 8 月 10 日
As far as I can see your model is running on RPi but it doesn't have the code that you expected it to have. Namely, MATLAB Function block (I guess that is the one you were using) doesn't support all the functions you can imagine. With other words: in the phase of compilation Simulink Coder doesn't generate code for those functions. Consult the documentation about that (I would start with MATLAB Function block).

サインインしてコメントする。


Mirko
Mirko 2014 年 5 月 25 日
Hi, I solved by putting a line in / etc / crontab file that launches the program start automatically

  3 件のコメント

Tarun
Tarun 2016 年 1 月 11 日
what line did you put??
Ahmed Desoky
Ahmed Desoky 2016 年 3 月 7 日
what line did you put????????????????
Nguyen Hoang Tam
Nguyen Hoang Tam 2016 年 3 月 14 日
In terminal: sudo crontab -e add line: @reboot sudo /home/pi/./nameapp

サインインしてコメントする。


Basava Chetan
Basava Chetan 2017 年 1 月 12 日
How to bulid digital hearing aid using raspberry pi 3?

  0 件のコメント

サインインしてコメントする。


Dudi Rendusara
Dudi Rendusara 2017 年 10 月 4 日
Hi I am experiencing the same problem. What is the extension for the executable it generates? Is it the model_name.elf file? Too bad Mathworks does not provide detailed explanation on how to run simulink model independently in raspberry pi.

  0 件のコメント

サインインしてコメントする。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by