ROS: runNode and stopNode within a Simulink node
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
is it possible to start and stop another ROS node within my own Simulink node?
0 Commenti
Risposte (1)
Cam Salzberger
il 14 Lug 2020
Modificato: Cam Salzberger
il 14 Lug 2020
Hey Markus,
Generally the best way is to have the stop condition built into the node you want to stop, and signal it from the Simulink node. You could use a publisher/subscriber pair to send a signal to the other node to stop itself. Or set a parameter that the other node checks to stop itself. Either of those would probably work better than a service call, since that requires a response from the node with the server.
If you are running in simulation (not codegen) mode, and the node you want to stopis a deployed Simulink node on other hardware, you could potentially use a MATLAB Function block to use rosdevice, to call stopNode. But that's a heck of a workaround. There are also a few workarounds to make system calls from Simulink, I believe, so you could potentially kill processes of non-MATLAB/Simulink nodes.
Starting nodes is probably similar - system calls for non-MATLAB nodes. I'm not sure if there is a way to start a Simulink model from another Simulink model - model reference wouldn't work since it is implemented as one node at the top level. There are probably options for starting another model/function without being blocking (e.g. using a single-shot timer from a MATLAB Function block), and simulation mode probably opens up more options than codegen mode.
Hope this gives you some ideas.
-Cam
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!