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
Last week, i tried with these 2 lines added in my ~/.bashrc file, but didn’t work .
I shall read again tutorials and told you when resolved.
I dont think my message got across so i will state it in a different way.
It looks like you are running something at startup and trying to run roslaunch.
At startup generally the user is ‘root’.
So to be specific, the lines to do the source of setup.bash type files must be in the .bashrc of root.
That is this file: /root/.bashrc
That can only be edited with root permissions.
As a bare minumum you need to see this line near end:
If you are going to launch some sort of custom launch file that was perhaps made in the catkin workspace of some user such as in my example ‘ubiquity’ then the /root/.bashrc file also needs to include THAT environment, that was my 2nd line.
I am not talking about fixing up your own .bashrc although that is critical if you yourself after being logged into the system try to run some roslaunch of your own launch file.