How to properly configure cartographer?

asked 2020-05-28 13:06:36 -0500

Py gravatar image

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?

edit retag flag offensive close merge delete

Comments

You could try source ~/catkin_ws/install_isolated/setup.sh --extend

tianb03 gravatar image tianb03  ( 2020-05-28 23:44:21 -0500 )edit

This is not cartographer configuration problem, but workspace and isolated workspace configuration problem.

tianb03 gravatar image tianb03  ( 2020-05-28 23:45:34 -0500 )edit

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?

Py gravatar image Py  ( 2020-05-29 03:07:43 -0500 )edit

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.

tianb03 gravatar image tianb03  ( 2020-06-02 05:21:23 -0500 )edit

ROS_PACKAGE_PATH is /home/user/catkin_ws/src:/opt/ros/kinetic/share and CMAKE_PREFIX_PATH is /home/user/catkin_ws/devel:/opt/ros/kinetic. I'm not really sure whether these are right or not....

Py gravatar image Py  ( 2020-06-03 08:12:17 -0500 )edit
1

I think in your case, the ROS_PACKAGE_PATH should include home/user/catkin_ws/install_isolated/share my .bashrc is like

source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash --extend
source ~/tianbot_ws/devel/setup.bash --extend
source ~/cartographer_ws/install_isolated/setup.bash --extend

and it works well

tianb03 gravatar image tianb03  ( 2020-06-04 06:22:59 -0500 )edit