Run ROS2 launch after startup
Hi Guys, last few hours I'm struggling with the problem how to start ROS launch file automatically after boot. I put all nodes into one script robot_marker_launch.py and it is working fine. But I'm not able to figure out how to start it automatically. I need to source the ROS in the terminal and then start the launch file.
I found Ros_launch but it is for the older versions and not for ROS2 and Foxy
The next Idea was to start the script using of crontab -e
but it went wrong because I was not able source the ros2 files.
Can somebody give me a hint either how to start the script or how to make a workaround and don't use the source
command in the crontab.
I'm using Raspberry Pi with Ubuntu 20.04 and Foxy
Thank you
Not specific to this exact questions but see this question on robot_upstart and maybe look into system services.
For a workaround using crontab you can run your command using an interactive bash like this :
bash -ic "ros2 launch [...]"
. As long as you source your workspace in your.bashrc
it should work.