How to properly configure cartographer?
I've been having some trouble getting cartographer to work with ROS kinetic using these instructions. Whilst I am able to complete the instructions successfully, when I run a cartographer node, the terminal output contains the following error:
ERROR: cannot launch node of type [cartographer_ros/cartographer_node]: cartographer_ros
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/user/catkin_ws/src
ROS path [2]=/opt/ros/kinetic/share
ERROR: cannot launch node of type [cartographer_ros/cartographer_occupancy_grid_node]: cartographer_ros
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/user/catkin_ws/src
ROS path [2]=/opt/ros/kinetic/share
Some internet searches lead me to believe that the following command needs to be run before using cartographer:
source ~/catkin_ws/install_isolated/setup.sh
However, doing this seems to override the following in my .bashrc
file:
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash
and results in the following error:
[demonstration.launch] is neither a launch file in package [contamination_mapping] nor is [my_package] a launch file name
The traceback for the exception was written to the log file
It seems as though I have something wrong in my setup but I am just unsure what this is. Could anyone offer any suggestions?
You could try source ~/catkin_ws/install_isolated/setup.sh --extend
This is not cartographer configuration problem, but workspace and isolated workspace configuration problem.
Thanks for this. I've just tried using the
--extend
option and get the same error. I'm not really sure sure how to configure the workspaces. Any ideas for things to check?You'd better check ROS_PACKAGE_PATH and CMAKE_PREFIX_PATH If you source a bash file without --extend, it will override all the configuration. But it may work because of the workspace chain. However, check ROS_PACKAGE_PATH and CMAKE_PREFIX_PATH will guarantee your workspace configuration.
ROS_PACKAGE_PATH
is/home/user/catkin_ws/src:/opt/ros/kinetic/share
andCMAKE_PREFIX_PATH
is/home/user/catkin_ws/devel:/opt/ros/kinetic
. I'm not really sure whether these are right or not....I think in your case, the ROS_PACKAGE_PATH should include
home/user/catkin_ws/install_isolated/share
my .bashrc is likeand it works well