How to do Simulink model run in Raspberry Pi after power on (booting) as standalone? - raspberry-pi

I build a Simulink model to control Dc motor, load into the board, stop Simulink model and plug out the power and Ethernet cable.
Does the Simulink model that has been loaded in the Raspberry Pi board work alone after Raspberry Pi power on (booting / startup) without running Simulink model again on the computer via Ethernet connection?

I assume you are using the official support package.
You will find a binary application built for your system in your home directory. The name of the folder is identical to the name of your simulink model.
You can use ssh to connect to your raspberry and start the application manually each time you boot the system. If you wish to start it automatically, check this question.
Make sure to stop the application before you use the support package to load a new application, for example when you update your model and built it again.

You can download the latest supportpackage for Raspberry Pi - 18a
They introduced "Run on Boot" feature at the Simulink config set.
You can directly add a model to startup during deployment.
Refer the supportpackage page for more information.

Related

Which Raspberry Pis are compatible out of the box?

First, I googled for this question but found no valid answers (may have been inefficient at this though).
I am working with a mix of Raspberry Pis: Raspberry Pi 1B, 2 B+, 3, Zero. I know that those have different chipsets / architectures etc, but it seems that plugging an SD card created for one Rasberry on a Raspberry of a different model works (I created my SD cards for the 2B+, and plugged them also into other models). I use Raspbian, and I run some code that relies on quite a lot of Python packages (numpy, scipy, etc).
My question is:
Why would this work at all despite different hardware? Where is the hardware taken into account when doing a sudo apt-get install? Are there some parts of a sudo apt-get that depend on the RPi model?
As it seems to be working fine, am I at a risk if I switch cards between different RPi models that the program executes, but that its output is somehow 'wrong'?
Some debian/unix packages need to be compiled against specific CPU architectures. Python source code, for the most part, is transferrable because you are not compiling it onto a specific architecture like you would for C/C++
Regarding the SD cards, I wouldn't trust moving them to different models. There are different Linux kernel requirements at least between Pi-1 and the later models.
Although, I see there is only one link to download Rasbian image, the other OS's specifically say "image for Raspberry Pi 2 and 3"

Write Raspberry Pi program, without a Raspberry Pi

Im soon gonna buy a Raspberry Pi, but I dont want to wait until I get it to start writing my program.
My PI is gonna be connected to the TV, and have a GUI.
Im gonna write my program in Python
Can I just start writing a GUI application on my computer, and just push it over, or is is something that I need to think about.
Sure, you can setup a virtual machine with linux on it. This way you can test the compatibility of your code. If it runs on linux, it will most surely will run on the raspberry (which also runs linux).
In the case of Python, it should even run fine when tested on windows, unless you use OS specific features.
Well when you want program in python is simple on windows but you have to choose version (raspberry pi has both) Python In this gui you can program what you want and after raspi comes only transfer program :) have good fun :)

Can I run matlab on raspberry pi?

I have developed a system using signal processing technique in matlab. I want to use raspberry pi to this system.
In this link, they say Octave, Scilab ,FreeMat tools can be used to replace pc with raspberry pi.
Can i use this tools to run signal processing algorithms?
Matlab/Simulink can not run m code directly on raspberries, but you can run Simulink models using the raspberry support package for simulink. This includes Matlab S-Functions, which contain m Code.
The typical workflow is:
Create a simulink model which implements the functionality. Try to generate code and test it if possible on your Pc.
Put in the blocks from the support package to get access to the io of the raspberry. Change the target to the raspberry and built it again.
Download the binary to the raspberry and start it. The application now runs on the raspberry, the pc is not needed.
No it is not possible. MATLAB can only run on Intel x86 architectures, and the Raspberry Pi uses an ARM processor. See here for which platforms MATLAB supports: http://www.mathworks.com/support/sysreq/current_release/.
However, you can use MATLAB to interface with the Raspberry Pi in order to get sensor and image data: http://www.mathworks.com/hardware-support/raspberry-pi-matlab.html
If you want to run signal processing algorithms, if you can, stick with Octave's signal package - http://octave.sourceforge.net/signal/ - and yes it is possible to run Octave on a Raspberry Pi: http://wiki.octave.org/Rasperry_Pi.
Alternatively, try installing NumPy and SciPy together with Python - http://wyolum.com/numpyscipymatplotlib-on-raspberry-pi/ - and use the signal package from that platform: http://docs.scipy.org/doc/scipy/reference/signal.html. NumPy has very similar syntax to MATLAB and it'll take you no time at all to learn it. http://cs231n.github.io/python-numpy-tutorial/
You have lots of alternatives... but unfortunately you can't use MATLAB. Besides which, MATLAB uses Java as the backbone, and running Java on a Raspberry Pi is very slow. Not only that, but MATLAB is several GB large, and to have this program occupy a good chunk of your SD card is very counter productive.
Another option is to use the MATLAB coder or the MATLAB Embedded Coder to generate C code from the MATLAB code. Note that only a sub-set of the MATLAB language supports code generation. That code can then be compiled and run natively on Raspberry Pi.
With the R2018b release of MATLAB, you can deploy your MATLAB code on Raspberry Pi as a standalone executable.
Refer the Deploying MATLAB functions on Raspberry Pi for more information.

Redhat OS with notebook to Embedded controller RPI

Now I have the Redhat:Linux OS on notebook computer there are many applications inside that computer.
Reason that I need to port Redhat:OS to RPI that computer was installed Labview application and Labview with NiDAQmx , VISA I/O.(Now it's running fine on notebook with NI6008)
The question is how can I port that linux OS to my Raspberry PI with driver of RPI?(I need to know step by step)
NI does not support running LabVIEW standard on ARM processors - see What Linux Distributions Do National Instruments Drivers and Software Support?.
NI does have a Real Time modules that supports ARM processors, but not the Pi - see Targetting Raspberry PI.
You can still connect a NI6008 DAQ to your Pi and access the data using a driver such as Low Cost USB DAQ Driver for use with Raspberry Pi, but you will have to consume the data with an application written in a language other than LabVIEW (such as Python).

How can we Interface between Matlab and ROS

I have a face recognition program developed in matlab , I want to get results or output in robot operating system (ROS) also installed on my computer both matlab and ROS are on Ubuntu.
How can I interface both matlab and ROS?
There is ROS io matlab package, have a look here
http://www.brendanandrade.com/2014/02/12/ros-i0-getting-started-with-mathworks-new-ros-package-for-matlab-p1/
Matlab 2015 is supporting ROS as well.
You can connect matlab with ROS with the Matlab-ROS toolbox.
There are plenty of matlab-ros guides available, such as:
https://nl.mathworks.com/help/ros/ug/work-with-basic-ros-messages.html
The approach of such guides is commonly:
Set up connection (e.g. set ROS_IP / ROS_MASTER_URI, create a ros-1 core if you have none running yet)
Create a matlab publisher object that streams your data (messagetype of your choice, depending on the results you want to output) on a topic.
Connect other components by setting up subscribers (on matlab or in other frameworks) that listen to updates on the specified topics.
Matlab-ROS-toolbox allows interfacing with ros on both Windows and Linux, which does not require you to install ROS on your device.
Having ROS installed allows various features such as interaction through terminal (e.g. rostopic list).