Deploying a ROS node on Raspberry Pi in external mode with Simulink
5 views (last 30 days)
I am working on a project that uses ROS and the Robotics Toolbox Package to run Simulink models (with ROS publishers and subscribers) on a Raspberry Pi. The model is generated on my laptop running Linux, and I can currently deploy a "standalone" ROS node to the Pi, where it communicates with other nodes running on that system. In this case all Simulink does is create the model, and send it to the Pi. Simulink doesn't have any capabilities of changing controller values within the model on the Pi, or reading data that is output from the model on the Pi.
What I am trying to do is deploy my Simulink model on the Pi, have it communicate with other ROS nodes that are running on the Pi, and then be able to read data back through Simulink. The last part is what I have yet to acheive, and I am wondering if anyone has some tips.
There are two paths that I can possibly see making this work, with each of them having some parts that I don't understand, which is preventing me from my goal:
- Deploy the Simulink model in "external mode" as an executable file. I have seen other projects use this method to communicate data between Simulink (on a PC) and a Raspberry Pi where the model is actually deployed. However, in needing to communicate with other ROS nodes, I am not certain that this deployed model will technically be within the ROS network. It is simply an executable that can be run outside of ROS master's knowledge. Will the model be able to publish and subscribe to ROS topics if it is running as a .elf file?
- Deploy the Simulink model as a standalone ROS node. This is currently how I have approached the problem to this point. Unfortunately, the node appears to be isolated from the laptop after it is deployed and cannot send information back to the Simulink program for reading data.
Any help would be very much appreciated!
Tohru Kikawada on 5 May 2019
Edited: Tohru Kikawada on 5 May 2019
I'd recommend you to try the first path. In the external mode, the deployed model can be running as a ROS node simultaneously like below: https://mathworks.com/help/robotics/ug/enable-external-mode-forrobotics-system-toolbox-models.html
Maitreyee Mordekar on 1 Jul 2020
You could try to go through the following video. The video explains how you can publish and subscribe between an ROS node in Simulink and a standalone ROS node deployed onto Pi:
I hope this helps!