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

Problem with converting rosmake package to catkin package

asked 2015-11-10 08:34:03 -0500

cangjiaxuan gravatar image

updated 2015-11-12 07:27:53 -0500

replace the old CMakeList files with new files, update the layout(thank you dornhege), add the layout with tree command

I'm currently working with a project with two rosmake package.

Both package contains several .cpp files and .h files but there are no main function in any those cpp files, and none of this file have ros functions like ros::initial() blah blah, so they are just ordinary cpp files.

I successfully convert the first package into a catkin package(follow http://wiki.ros.org/catkin/migrating_... and the catkin 0.6.15 document) then I run the catkin_make at my work space. Everything works well, I got a lot of .cpp.o files and a libmathlib.so (mathlib is the name of this package) file.

And in the second package, I want to use the first package. But here comes the problem, I convert the menifest.xml and CMakeList.txt into catkin format file, but as I catkin_make this package

This problem shows up

In file included from /home/lc/ros_ws/src/SEDS/src/GMR.cpp:31:0:
/home/lc/ros_ws/src/SEDS/include/GMR.h:28:28: fatal error: mathlib/Mathlib.h: No such file or directory
 #include<mathlib/Mathlib.h>

Thank you for your reading, and does any one know how to solve this problem? If there are any extra information needed for this problem, please tell me.

CmakeLists: mathlib:

cmake_minimum_required(VERSION 2.8.3)
project(mathlib)

find_package(catkin REQUIRED COMPONENTS roscpp)

include_directories(include ${catkin_INCLUDE_DIRS})

catkin_package(CATKIN_DEPENDS roscpp
               INCLUDE_DIRS include
               LIBRARIES ${PROJECT_NAME})

set(THE_SOURCE_FILES
    src/Differentiator.cpp
    src/GradientDescent.cpp
    src/IKGroupSolver.cpp
    src/IKSubSolver.cpp
    src/Macros.cpp
    src/MathLibCommon.cpp
    src/MathLib.cpp
    src/Matrix3.cpp
    src/Matrix4.cpp
    src/Matrix.cpp
    src/ReferenceFrame.cpp
    src/Regression.cpp
    src/SpatialForce.cpp
    src/SpatialFrame.cpp
    src/SpatialInertia.cpp
    src/SpatialMatrix.cpp
    src/SpatialVector.cpp
    src/SpatialVelocity.cpp
    src/TMatrix.cpp
    src/TVector.cpp
    src/Vector3.cpp
    src/Vector.cpp
    )

add_library(${PROJECT_NAME} ${THE_SOURCE_FILES} )
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_gencpp)


install(TARGETS ${PROJECT_NAME}
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})

install(DIRECTORY include/${PROJECT_NAME}
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
    FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")

Another package(seds):

cmake_minimum_required(VERSION 2.8.3)
project(seds)

find_package(catkin REQUIRED COMPONENTS roscpp mathlib)


include_directories(include ${catkin_INCLUDE_DIRS})

catkin_package(CATKIN_DEPENDS mathlib
           DEPENDS roscpp
               INCLUDE_DIRS include
               LIBRARIES seds
)

set(THE_SOURCE_FILES
    src/GMR.cpp
    )


add_library(seds ${THE_SOURCE_FILES})
target_link_libraries(seds ${catkin_LIBRARIES})

install(TARGETS seds
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
        RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})

Layout of mine two packages mathlib package

    .
    ├── CMakeLists.txt
    ├── include
    │   └── mathlib
    │       ├── Differentiator.h
    │       ├── GradientDescent.h
    │       ├── IKGroupSolver.h
    │       ├── IKSubSolver.h
    │       ├── Macros.h
    │       ├── MathLibCommon.h
    │       ├── MathLib.h
    │       ├── Matrix3.h
    │       ├── Matrix4.h
    │       ├── Matrix.h
    │       ├── ReferenceFrame.h
    │       ├── Regression.h
    │       ├── SpatialForce.h
    │       ├── SpatialFrame.h
    │       ├── SpatialInertia.h
    │       ├── SpatialMatrix.h
    │       ├── SpatialVector.h
    │       ├── SpatialVelocity.h
    │       ├── TMatrix.h
    │       ├── tmp.txt
    │       ├── TVector.h
    │       ├── Vector3.h
    │       └── Vector.h
    ├── package.xml
    └── src
        ├── Differentiator.cpp
        ├── GradientDescent.cpp
        ├── IKGroupSolver.cpp
        ├── IKSubSolver.cpp
        ├── Macros.cpp
        ├── MathLibCommon.cpp
        ├── MathLib.cpp
        ├── Matrix3.cpp
        ├── Matrix4.cpp
        ├── Matrix.cpp
        ├── ReferenceFrame.cpp
        ├── Regression.cpp
        ├── SpatialForce.cpp
        ├── SpatialFrame.cpp
        ├── SpatialInertia.cpp
        ├── SpatialMatrix.cpp ...
(more)
edit retag flag offensive close merge delete

Comments

Please add the file layout of the packages and the CMakeLists.txt of both packages.

dornhege gravatar image dornhege  ( 2015-11-10 09:34:56 -0500 )edit

Thank you for your remind I have added those information.

cangjiaxuan gravatar image cangjiaxuan  ( 2015-11-10 19:59:38 -0500 )edit

You can use the tree command to give the actual folder layout. Also remove the header files from cmake, they don't need to be compiled (explicitly) and just clutter up the files.

dornhege gravatar image dornhege  ( 2015-11-12 06:22:21 -0500 )edit

Hi, I have done those changes recommended.

cangjiaxuan gravatar image cangjiaxuan  ( 2015-11-12 07:29:42 -0500 )edit

I can't see anything wrong right now. Does it work? Have you tried a clean build, i.e., remove build/ devel/?

dornhege gravatar image dornhege  ( 2015-11-12 07:52:42 -0500 )edit

:(. I remove the build/ and devel/ but unfortunate nothing changed, I still got the same error message. I check the devel/ folder there are no header file from mathlib generated there, I think this is the reason why seds can't find the .h file. Anyway thank you for your help:)

cangjiaxuan gravatar image cangjiaxuan  ( 2015-11-12 08:00:51 -0500 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2015-11-10 11:11:09 -0500

joq gravatar image

updated 2015-11-10 11:11:36 -0500

Just a guess, but did you remember to export your headers and libraries?

edit flag offensive delete link more

Comments

I read this page yesterday, but I'm not 100% sure about whether I use it correctly in mine packages.

cangjiaxuan gravatar image cangjiaxuan  ( 2015-11-10 20:00:30 -0500 )edit

The catkin_package() needs to go after the message generation.

joq gravatar image joq  ( 2015-11-10 21:57:11 -0500 )edit

I put the catkin_package() element just after include. I think that's what you mean.

cangjiaxuan gravatar image cangjiaxuan  ( 2015-11-11 19:02:43 -0500 )edit

Maybe not, here is the required overall order: http://docs.ros.org/api/catkin/html/h... .

joq gravatar image joq  ( 2015-11-17 13:30:58 -0500 )edit
2

answered 2015-11-11 11:12:03 -0500

dornhege gravatar image

You're including something from mathlib/Mathlib.h, yet your headers seem to be in include, not include/mathlib. This cannot work.

edit flag offensive delete link more

Comments

RIght. Note that it should be in include/mathlib. You need the extra directory level.

joq gravatar image joq  ( 2015-11-11 13:10:42 -0500 )edit

Thank you. I do the change, but still catkin_make says

In file included from /home/lc/ros_ws/src/SEDS/src/GMR.cpp:31:0:
/home/lc/ros_ws/src/SEDS/include/GMR.h:28:28: fatal error: mathlib/Mathlib.h: No such file or directory
 #include<mathlib/Mathlib.h>
cangjiaxuan gravatar image cangjiaxuan  ( 2015-11-11 19:00:12 -0500 )edit

But I get the feeling that I'm getting closer to the right answer:)

cangjiaxuan gravatar image cangjiaxuan  ( 2015-11-11 19:01:05 -0500 )edit

Question Tools

Stats

Asked: 2015-11-10 08:34:03 -0500

Seen: 229 times

Last updated: Nov 12 '15