Even though you have added
source /opt/ros/kinetic/setup.bash to your
.bashrc, the fact you get a "command not found" error indicates that somehow Bash can't find the
roslaunch executable. To double-check your configuration, run the following command:
$ echo $PATH
If your environment is correctly configured to run ROS Kinetic, you should see an output of the form:
Notice that the first entry in the colon-separated list above is
/opt/ros/kinetic/bin; if that's not the case in your system, that's probably the cause of the issue.
Even if the
apt logs say
roslaunch was installed, it's better to double-check whether it really is anywhere to be found. Search for the executable file using the command below:
$ sudo find / -name roslaunch
You should see the following output:
If that's not the case, then
roslaunch is not (correctly) installed. Otherwise, you might also check whether executable permissions are set for good measure:
$ ls -l /opt/ros/kinetic/bin/roslaunch
-rwxr-xr-x 1 root root 1657 Oct 8 2019 /opt/ros/kinetic/bin/roslaunch
Check whether the
x flags are present in the output.
Generally speaking, (re)installing packages should be your last resort when dealing with environment issues. It's all too easy to run into conflicts and wreck your system to a degree that you might as well rebuild it from scratch. It's better to first try and determine what the problem is to begin with, before rushing into attempts at a solution.
If you installed the
ros-kinetic-desktop-full meta-package then you should already have everything needed to run
roslaunch; in any case, that certainly wouldn't have changed because you added another node to your project, either as sources in your workspace or by installing a binary package.
All that said, if
roslaunch isn't found in your environment or you can't otherwise determine why calling it doesn't work, you might want to try reinstalling the whole ROS setup:
$ sudo apt purge ros-kinetic-desktop-full # or whatever meta-package you used
$ sudo apt autoremove
$ sudo apt install ros-kinetic-desktop-full
But I personally think the best approach is to cut your losses and reinstall the system from scratch, then if you get the same issue again try to determine the cause before (re)installing anything.