# How do I run realsense_camera package built with catkin without running a script before?

The realsense_camera package is not available for ROS Lunar, therefore I have built it from source as described in this tutorial. At the end of the tutorial an example on how to use the package is given:

source ~/catkin_ws/devel/setup.bash
roslaunch realsense_camera r200_nodelet_default.launch


So I want to avoid running this script every time and just run the package as if I installed it from repository:

roslaunch realsense_camera r200_nodelet_default.launch


I haven't ever used catkin before so I don't understand what the commands in tutorial actually do. Here is the contents of ~/catkin_ws/devel/setup.bash

#!/usr/bin/env bash
# generated from catkin/cmake/templates/setup.bash.in

CATKIN_SHELL=bash

# source setup.sh from same directory as this file
_CATKIN_SETUP_DIR=$(builtin cd "dirname "${BASH_SOURCE[0]}"" > /dev/null && pwd)
. "\$_CATKIN_SETUP_DIR/setup.sh"


How do I do this? If I understand it correctly, the package is not installed in the system. Does catkin has something like make install?

edit retag close merge delete

Sort by » oldest newest most voted

The script is setting up / extending some environment variable which are necessary to find artifacts in your custom location (~/catkin_ws). You can call env before and after sourcing the script to see the differences.

I assume you anyway source the file /opt/ros/lunar/setup.bash. In that case you could install the package into /opt/ros/lunar. Then it wouldn't require any additional file to be sourced. Assuming your workspace only contains that package you can install it like this: catkin_make_isolated --install --cmake-args -DCMAKE_INSTALL_PREFIX=/opt/ros/lunar (for the install step you will need root permission to copy the files to /opt/ros/lunar). You should be careful though since that might "interact" / "interfere" with Debian packages installed to that location (disclaimer: I haven't run that command and checked if it works or does any harm in your case). But this should give you some idea how to approach it.

more

Thank you for your answer. I tried to execute the command you gave with sudo, but I get error: sudo: catkin_make_isolated: command not found. Also I have to note, that I have two packages in the workspace: realsense_camera and librealsense. Will it work anyway?

( 2018-02-08 12:47:10 -0500 )edit

catkin_make_isolated is part to the standard from-source tutorial ( http://wiki.ros.org/kinetic/Installat... ), Maybe you need to make sure that the environment is correct when using sudo?

( 2018-02-08 13:56:46 -0500 )edit

Both package will then be installed. If any of the packages is already installed from Debian that will overwrite the files. As long as you know what you do (and remember that in the future that you did that) it should be ok. There is no good way to "uninstall" the files again though.

( 2018-02-08 13:57:49 -0500 )edit

Thank you! But I decided to add the script to /opt/ros/lunar/setup.bash, which I source anyway on the start of the system.

( 2018-02-09 15:17:50 -0500 )edit