0
#!/bin/bash
source /home/user/AFROS/catkin_ws/devel/setup.bash
source /opt/ros/melodic/setup.bash
roslaunch /opt/ros/melodic/launchfile.launch

I have this as my bash file that I would like to use to execute a launch file. I am able to launch the launchfile using

 roslaunch launchfile.launch 

just fine, but if I use my bash file then I get the following error:

ERROR: cannot launch node of type [ros_core/connection_commander_node]: ros_core
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/opt/ros/melodic/share
ERROR: cannot launch node of type [ros_core/state_machine_commander_node]: ros_core
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/opt/ros/melodic/share
Axton
  • 25
  • 6
  • Does this help? https://stackoverflow.com/questions/16011245/source-files-in-a-bash-script – doggie_breath Jan 27 '20 at 14:59
  • Could you please share the content of launchfile.launch? – Lucas Coelho Jan 29 '20 at 21:01
  • `roslaunch /opt/ros/melodic/launchfile.launch` and `roslaunch launchfile.launch` are not equivalent. Also the launch file should not be in `/opt/ros/melodic/` but in `/opt/ros/melodic/share/some_package/launch/` if it is a installed package. If you made the launch file yourself then you should put it in your workspace, otherwise you will lose it next time you update ROS. As noted, post the launch file you are launching. Also what directory are you in when you run the command `roslaunch launchfile.launch`. Add the output of `pwd` from the terminal where you ran roslaunch to the question. – MRFalcon Feb 03 '20 at 10:56

0 Answers0