Ask Your Question

How to Run ros2 launch file using service file

asked 2021-02-09 09:11:25 -0500

Flash gravatar image

updated 2021-02-09 12:57:32 -0500

gvdhoorn gravatar image

Hi, I am trying to run launch file in ros2 using service file but I am unable to do it.


Environment=source home/$USER/dev_ws/install/setup.bash
ExecStart=ros2 launch topics


This is the error I am getting

Invalid environment assignment, ignoring: source
Feb 09 09:59:54 USER-pc systemd[1]: /etc/systemd/system/name.service:6: Invalid environment assignment, ignoring: home/USER/dev_ws/install/setup.bash
Feb 09 09:59:54 USER-pc systemd[1]: /etc/systemd/system/name.service:7: Executable "ros2" not found in path "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Can anyone please helpme

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-03-25 10:37:03 -0500

Flash gravatar image

I was able to resolve this issue by sourcing and running the launch file by using /bin/bash -c

ExecStart=/bin/bash -c 'source /opt/ros/foxy/setup.bash; source home/$USER/dev_ws/install/setup.bash; ros2 launch pkg_name; sleep 60'
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-02-09 09:11:25 -0500

Seen: 142 times

Last updated: Mar 25