ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to properly add urdf, config and launch directories to CMakeLists.txt?

asked 2020-10-29 10:49:52 -0500

Py gravatar image

updated 2020-10-29 10:50:46 -0500

I am receiving errors (below) suggesting my CMakeLists.txt file does not properly define my launch folder, which contains .launch files, and my urdf and config folders within my src folder, which are used for various things.

No such file or directory: /snap/robot/x1/opt/ros/melodic/share/mapping/src/urdf/clearpath_jackal.urdf.xacro
RLException: while processing /snap/robot/x1/opt/ros/melodic/share/mapping/launch/robot_simulation.launch:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [['/snap/robot/x1/opt/ros/melodic/lib/xacro/xacro', '/snap/robot/x1/opt/ros/melodic/share/mapping/src/urdf/clearpath_jackal.urdf.xacro', '--inorder']] returned with code [2].     
Param xml is <param command="$(find xacro)/xacro $(find mapping)/src/urdf/clearpath_jackal.urdf.xacro --inorder" name="robot_description"/>
The traceback for the exception was written to the log file

Here's my CMakeLists.txt file:

cmake_minimum_required(VERSION 2.8.3)

project(mapping)

cmake_policy(SET CMP0054 OLD)

find_package(catkin REQUIRED COMPONENTS
        roscpp
        rospy
        std_msgs
        gazebo_ros
        cartographer_ros
        rosbridge_server
        jackal_control
        jackal_description
        gazebo_ros REQUIRED
        )

catkin_package(
        LIBRARIES ${PROJECT_NAME}
        CATKIN_DEPENDS
        roscpp
        rospy
        std_msgs
        gazebo_ros
        cartographer_ros
        rosbridge_server
        jackal_control
        jackal_description
)

include_directories(
        ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS}
)

link_directories(
        ${GAZEBO_LIBRARY_DIRS}
)

catkin_install_python(PROGRAMS
        src/scripts/script_a.py
        src/scripts/script_b.py
        src/scripts/script_c.py
        src/scripts/script_d.py
        DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

install(DIRECTORY launch/
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
        PATTERN ".svn" EXCLUDE)

Can anyone point out whats wrong?

edit retag flag offensive close merge delete

Comments

opt/ros/melodic/share/mapping/src/urdf/clearpath_jackal.urdf.xacro seems like an odd path. Are you expecting your package to be installing that? I don't see anything in your CMakeLists.txt that indicates that you're installing any urdf files.

kyrofa gravatar image kyrofa  ( 2020-10-29 12:33:33 -0500 )edit

Yeah I'm still having trouble with that. What makes it look odd to you?

Py gravatar image Py  ( 2020-11-02 10:36:44 -0500 )edit

Generally you don't see a src directory in an installed location.

kyrofa gravatar image kyrofa  ( 2020-11-02 10:40:36 -0500 )edit

I have various folders within my packages src folder to store files used by each node, e.g. config and simulation related files. Should these be located outside the src folder? Or are you saying that something needs to be done in CMakeLists.txt to better specify their location beyond the answer below?

Py gravatar image Py  ( 2020-11-02 10:52:05 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-10-29 11:31:56 -0500

gvdhoorn gravatar image

updated 2020-10-29 12:12:02 -0500

I always do it like this:

install(DIRECTORY config launch meshes urdf
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

And a general comment:

my CMakeLists.txt file does not properly define my launch folder

this may be language (English isn't my first language), but: the only thing you do with the install(..) is tell CMake you'd like the directories (in this case, could also be FILES, PROGRAMS, etc) to be copied to a DESTINATION.

You don't define anything, or at least not in the programming language sense.

edit flag offensive delete link more

Comments

Perfect. I certainly understand your comment.... this makes a lot of sense. Thanks for the help :)

Py gravatar image Py  ( 2020-10-30 06:15:27 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-10-29 10:49:52 -0500

Seen: 1,066 times

Last updated: Oct 29 '20