Call rosrun from Matlab or alternative
I already have a ros package with an executable inside it. From the terminal this is what I do to execute it:
$ source ~/catkin_ws/devel/setup.bash
$ rosrun my_package my_executable
This executable print some text on the shell:
Hello world
I want to call this commands in Matlab and import the printed text. I tried creating a shell script like this:
#!/bin/bash
source ~/catkin_ws/devel/setup.bash
rosrun my_package my_executable
and running it from Matlab in the following way:
[a,b] = system('~/./my_script')
but this is what I get:
[rosrun] Couldn't find executable named my_executable below /home/user/catkin_ws/src/my_package
The script works fine if called directly from the shell. How can I solve?
Please include your script in your question.
I've included the script. Any suggestions?
I don't see anything obviously wrong with your script or the commands you're running. Are you certain your script works?