I search, since few days, how launched complete project at startup.
I found a lot of solution, but never work correctly.
Which file must I used ?
And how is syntax to launch any nodes with differents terminal ?
I found syntax to create bash file and launched roslaunch node in some terminal, but always not where is startup file.
I tried with /etc/rc.local but not worked. …
Hello. Are you asking how the Magni robot launches it’s nodes or are you asking how to autostart your own ROS nodes not involving Magni? Thank You.
I don’t use Magni robot, it’s my own project i would like autostart.
But I seen that it was SystemD who managed it.
I will try …
Have a look at my own private solution, it may work for you. I use this on almost all my own robots that are not magni.
I even explain how to use this to start a ROS node but since the script runs as root you must run your ros system as root. Since you are doing your own project that is often acceptable.
Look at sys_monitor.py writeup here
I tried many different code but never worked good with SystemD. Xterm never start in xxfilenamexx.service!!!
I will try your solution.
Mark I read your code and I don’t understand why my code doesn’t run.
I found another solution, it’ s possible to launch an app script by ~/.config/autostart/MyFile.desktop.
In this case, Xterm is launched but roslaunch isn’t recognized …
Message tell me:
Can’t execvp roslaunch: No such file or directory
Have you an idea why roslaunch is not seen like a ROS command ?
ROS and the environment required to make ros recognize launch files is a semi-complicated thing and in general cannot be guessed to solve these sorts of issues.
I suggest if you are going to use ROS that you go through the ROS tutorials and although that will take a few days it will gain you much understanding for the problem you are asking about as well as other problems you will likely hit after you solve that one.
If you want to learn ROS it will take work but start here: http://wiki.ros.org/ROS/Tutorials
As far as this exact question you ask now I will say that it looks like whatever user is running roslaunch does not have the ROS environment setup in the shell that is running roslaunch.
Note that my sys_monitor.py is NOT tied specifically to ROS in any way. I use it for non-ROS startup as well as ROS startup of nodes.
If you are going to be root when you use roslaunch OR any other user you need to ‘source in’ proper ROS environment (discussed in ROS tutorials.
In my sys_monitor.py I touch on it briefly by saying this:
For starting a ROS node as root we must add to /.bashrc the general and our own ROS env to run roslaunch. To do this I suggest as root you add to the end of roots ~/.bashrc these lines (second line is user specific ROS env)
source /opt/ros/kinetic/setup.bash source /home/ubuntu/catkin_ws/devel/setup.bash